* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ==================== 인증 오버레이 ==================== */
.auth-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-header {
    background: #2c3e50;
    color: white;
    padding: 30px;
    text-align: center;
}

.auth-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.auth-header p {
    opacity: 0.8;
    font-size: 14px;
}

.auth-body {
    padding: 30px;
}

.auth-error {
    color: #dc3545;
    font-size: 13px;
    margin-bottom: 15px;
    min-height: 20px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

header p {
    opacity: 0.8;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.live-indicator {
    color: #2ecc71;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.card h2 .subtitle {
    font-size: 12px;
    font-weight: normal;
    color: #999;
}

.computer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: all 0.2s;
}

.computer-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    cursor: pointer;
}

.computer-main:hover {
    background: #e9ecef;
}

.computer-item.clickable {
    cursor: pointer;
}

.computer-item.clickable:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.hostname-badge {
    font-size: 10px;
    background: #e9ecef;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: normal;
}

.ip-badge {
    font-size: 10px;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: normal;
    font-family: monospace;
}

.computer-actions {
    display: flex;
    gap: 4px;
    margin-left: 10px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s;
}

.action-btn:hover {
    opacity: 1;
    background: #e9ecef;
}

.computer-item:last-child {
    margin-bottom: 0;
}

.computer-name {
    font-weight: 600;
    font-size: 14px;
}

.computer-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status.online {
    background: #d4edda;
    color: #155724;
}

.status.offline {
    background: #f8d7da;
    color: #721c24;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: #28a745;
    animation: blink 1s infinite;
}

.status-dot.offline {
    background: #dc3545;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.event-list {
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-left: 3px solid #ddd;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 0 6px 6px 0;
}

.event-item.boot {
    border-left-color: #28a745;
}

.event-item.shutdown {
    border-left-color: #dc3545;
}

.event-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.event-item.boot .event-icon {
    color: #28a745;
}

.event-item.shutdown .event-icon {
    color: #dc3545;
}

.event-details {
    flex: 1;
}

.event-computer {
    font-weight: 600;
    font-size: 13px;
}

.event-time {
    font-size: 12px;
    color: #666;
}

.event-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.event-item.boot .event-type {
    background: #d4edda;
    color: #155724;
}

.event-item.shutdown .event-type {
    background: #f8d7da;
    color: #721c24;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.stat-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.refresh-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.refresh-btn:hover {
    background: #2980b9;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state p {
    margin-top: 10px;
    font-size: 14px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #2c3e50;
    color: white;
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
    border: none;
    padding: 0;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.date-filter label {
    font-size: 14px;
    color: #666;
}

.date-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.history-list {
    max-height: 500px;
    overflow-y: auto;
}

.history-date-group {
    margin-bottom: 20px;
}

.history-date {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.history-events {
    padding-left: 15px;
    border-left: 2px solid #eee;
}

.history-event {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #fafafa;
    border-radius: 4px;
}

.history-time {
    font-size: 13px;
    color: #666;
    font-family: monospace;
}

.history-type {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.history-type.boot {
    background: #d4edda;
    color: #155724;
}

.history-type.shutdown {
    background: #f8d7da;
    color: #721c24;
}

/* 소형 모달 */
.modal-small {
    max-width: 400px;
}

.modal-label {
    margin-bottom: 15px;
    color: #666;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover {
    background: #dee2e6;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.modal-header-danger {
    background: #dc3545;
}

.delete-warning {
    font-size: 16px;
    margin-bottom: 10px;
}

.delete-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}

/* ==================== 컴퓨터 목록 & 일별 요약 ==================== */
.computers-list-card {
    grid-column: 1 / -1;
}

.date-summary-card {
    grid-column: 1 / -1;
}

/* 날짜 선택 UI */
.date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.date-picker input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.date-picker input[type="date"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.date-nav-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.date-nav-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.today-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.today-btn:hover {
    background: #2980b9;
}

/* 차트 컨테이너 */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.today-summary-card h2 .today-date {
    font-size: 14px;
    font-weight: normal;
    color: #666;
    margin-left: 8px;
}

.today-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.today-summary-table th,
.today-summary-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.today-summary-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

.today-summary-table td.computer-cell {
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
}

.today-summary-table td.time-cell {
    font-family: monospace;
    font-size: 15px;
}

.today-summary-table td.time-cell.boot {
    color: #28a745;
}

.today-summary-table td.time-cell.shutdown {
    color: #dc3545;
}

.today-summary-table tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== 타임라인 ==================== */
.timeline-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.timeline-filter label {
    font-size: 14px;
    color: #666;
}

.timeline-filter select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.timeline-wrapper {
    overflow-x: auto;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.timeline-table th,
.timeline-table td {
    padding: 10px 12px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.timeline-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.timeline-table .date-cell {
    background: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
    text-align: left;
}

.timeline-table .time-cell {
    font-family: monospace;
    font-size: 14px;
    color: #2c3e50;
}

.timeline-table .time-cell.empty {
    color: #ccc;
}

.timeline-table tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== 히스토리 모달 컨트롤 ==================== */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.view-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: #2c3e50;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* 요약 테이블 */
.summary-table-wrapper {
    overflow-x: auto;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.summary-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

.summary-table td.date-cell {
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
}

.summary-table td.time-cell {
    font-family: monospace;
    font-size: 15px;
}

.summary-table td.time-cell.boot {
    color: #28a745;
}

.summary-table td.time-cell.shutdown {
    color: #dc3545;
}

.summary-table tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== 전체 타임라인 ==================== */
.all-timeline-list {
    max-height: 500px;
    overflow-y: auto;
}

.timeline-date-group {
    margin-bottom: 20px;
}

.timeline-date-header {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.timeline-events {
    padding-left: 15px;
    border-left: 2px solid #eee;
    margin-left: 10px;
}

.timeline-event {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: #fafafa;
    border-radius: 6px;
    transition: background 0.2s;
}

.timeline-event:hover {
    background: #f0f0f0;
}

.timeline-time {
    font-size: 13px;
    color: #666;
    font-family: monospace;
    min-width: 70px;
}

.timeline-computer {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.timeline-type {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

.timeline-type.boot {
    background: #d4edda;
    color: #155724;
}

.timeline-type.shutdown {
    background: #f8d7da;
    color: #721c24;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        justify-content: center;
    }

    .timeline-event {
        flex-wrap: wrap;
        gap: 8px;
    }

    .timeline-computer {
        order: -1;
        flex-basis: 100%;
    }
}
