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

:root {
    --primary: #2c3e50;
    --secondary: #e74c3c;
    --accent: #f39c12;
    --success: #27ae60;
    --warning: #e67e22;
    --info: #3498db;
    --bg-main: #ecf0f1;
    --bg-card: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border: #bdc3c7;
}

body {
    font-family: 'Work Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, #34495e 100%);
    padding: 40px;
    color: white;
}

.header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.controls {
    display: flex;
    gap: 20px;
    padding: 30px 40px;
    background: var(--bg-main);
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--secondary);
    color: white;
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

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

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.week-range-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--primary);
}

.week-range-label {
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.week-range-input {
    padding: 7px 10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    color-scheme: dark;
}

.week-range-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.7);
}

.week-range-display {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 6px 14px;
}

.week-range-print {
    display: none;
}

/* Sync status indicator */
.sync-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
}

.sync-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27ae60;
}

.sync-status.saving .dot {
    background: #f39c12;
    animation: pulse 1s infinite;
}

.sync-status.offline .dot {
    background: #e74c3c;
}

.sync-status.error .dot {
    background: #e74c3c;
}

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

/* Install PWA banner */
.install-banner {
    display: none;
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    align-items: center;
    gap: 15px;
}

.install-banner.show {
    display: flex;
}

.install-banner .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.install-banner .btn-install {
    background: white;
    color: #667eea;
}

.install-banner .btn-dismiss {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Migration banner */
.migration-banner {
    display: none;
    padding: 15px 40px;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    font-weight: 600;
    align-items: center;
    gap: 15px;
}

.migration-banner.show {
    display: flex;
}

.migration-banner .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.migration-banner .btn-migrate {
    background: white;
    color: #e67e22;
}

.migration-banner .btn-dismiss {
    background: rgba(255,255,255,0.2);
    color: white;
}

.schedule-grid {
    padding: 15px;
    overflow-x: auto;
}

.employee-row {
    display: grid;
    grid-template-columns: 88px repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.employee-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px;
    background: linear-gradient(135deg, var(--primary) 0%, #34495e 100%);
    color: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.7rem;
    position: relative;
    text-align: center;
    word-wrap: break-word;
}

.employee-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.employee-info span {
    line-height: 1.1;
    font-size: 0.7rem;
}

.employee-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    width: 100%;
    justify-content: center;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.print-btn:hover {
    background: #3498db;
}

.whatsapp-btn:hover {
    background: #25d366;
}

.avatar {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
}

.day-cell {
    background: #f8f9fa;
    padding: 5px;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.day-cell-header {
    text-align: center;
    font-weight: 700;
    font-size: 0.6rem;
    color: var(--primary);
    padding: 2px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 3px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.shift-group {
    margin-bottom: 4px;
}

.shift-label {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.shift-inputs {
    display: flex;
    gap: 2px;
    align-items: center;
}

.shift-inputs span {
    font-size: 0.6rem;
    color: var(--text-light);
}

.time-input {
    flex: 1;
    padding: 4px 2px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.68rem;
    text-align: center;
}

.time-input.rest-day {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-weight: 700;
    border: none;
}

.time-input.normal-day {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-weight: 700;
    border: none;
}

.time-input.guard-day {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    font-weight: 700;
    border: none;
}

.button-row {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}

.rest-toggle,
.single-toggle,
.guard-toggle {
    flex: 1;
    padding: 3px 1px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.rest-toggle:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.rest-toggle.active {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.single-toggle:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.single-toggle.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.guard-toggle:hover {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.guard-toggle.active {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.employee-weekly-hours {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    margin-top: 3px;
    letter-spacing: 0.03em;
}

.delete-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: absolute;
    top: 2px;
    right: 2px;
}

.delete-btn:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px 40px;
    background: var(--bg-main);
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 4px solid var(--accent);
}

.stat-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
}

.legend {
    display: flex;
    gap: 20px;
    padding: 20px 40px;
    background: white;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

.legend-color.rest {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.legend-color.normal {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.legend-color.guard {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.legend-color.single {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

/* Print styles */
@media print {
    .print-hidden,
    .no-print {
        display: none !important;
    }

    .week-range-print {
        display: block !important;
        text-align: center;
        font-size: 0.85rem;
        font-weight: 700;
        color: #2c3e50;
        padding: 4px 0 6px 0;
        letter-spacing: 0.04em;
        border-bottom: 1px solid #bdc3c7;
        margin: 0 6px 6px 6px;
    }

    @page {
        size: A4 landscape;
        margin: 6mm;
    }

    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
    }

    .controls, .stats, .legend, .delete-btn, .button-row, .employee-actions, .migration-banner, .install-banner, .sync-status {
        display: none !important;
    }

    .header {
        background: #2c3e50 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 8px 15px !important;
    }

    .header h1 {
        font-size: 1.3rem !important;
        margin-bottom: 2px !important;
    }

    .header p {
        font-size: 0.7rem !important;
    }

    .schedule-grid {
        padding: 6px !important;
    }

    .employee-row {
        grid-template-columns: 80px repeat(7, 1fr) !important;
        gap: 3px !important;
        margin-bottom: 5px !important;
        page-break-inside: avoid;
    }

    .employee-name {
        padding: 4px 2px !important;
        font-size: 0.7rem !important;
        background: white !important;
        color: #000 !important;
        border: 2px solid #2c3e50 !important;
    }

    .employee-info span {
        font-size: 0.7rem !important;
        color: #000 !important;
    }

    .avatar {
        width: 20px !important;
        height: 20px !important;
        font-size: 0.55rem !important;
        background: #e9ecef !important;
        color: #2c3e50 !important;
    }

    .day-cell {
        padding: 3px !important;
    }

    .day-cell-header {
        font-size: 0.55rem !important;
        padding: 1px !important;
        margin-bottom: 2px !important;
    }

    .shift-label {
        font-size: 0.5rem !important;
        margin-bottom: 1px !important;
    }

    .time-input {
        padding: 2px 1px !important;
        font-size: 0.6rem !important;
        border: 1px solid #000 !important;
    }

    .time-input.rest-day,
    .time-input.normal-day,
    .time-input.guard-day {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 0.55rem !important;
        padding: 3px 1px !important;
    }

    .shift-inputs span {
        font-size: 0.55rem !important;
    }

    .shift-group {
        margin-bottom: 2px !important;
    }
}
