/* ── Office Task Manager -- Mobile-First Styles ── */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Header / Nav ── */

.header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
}

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

.lang-toggle {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.lang-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.lang-toggle.active {
    background: white;
    color: var(--primary);
}

.user-name {
    font-size: 0.85rem;
    opacity: 0.9;
}

.logout-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
}

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

/* ── Nav tabs (admin) ── */

.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 10px;
    max-width: 900px;
    margin: 12px auto;
    overflow-x: auto;
}

.nav-tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* ── Container ── */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Login Page ── */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}

.login-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    text-align: center;
    font-size: 1.4rem;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ── Forms ── */

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-success:hover {
    background: #15803d;
}

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    width: auto;
}

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

/* ── Cards ── */

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1.05rem;
    color: var(--gray-800);
}

.card-body {
    padding: 16px;
}

/* ── Zone Badge ── */

.zone-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.zone-1 { background: #dbeafe; color: #1e40af; }
.zone-2 { background: #fce7f3; color: #9d174d; }
.zone-3 { background: #d1fae5; color: #065f46; }

/* ── Status Badges ── */

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-assigned { background: var(--gray-100); color: var(--gray-600); }
.status-in_progress { background: var(--warning-light); color: #92400e; }
.status-completed { background: var(--success-light); color: #166534; }

/* ── Task Checklist ── */

.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 2px;
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox.checked::after {
    content: '\2713';
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.task-content {
    flex: 1;
}

.task-description {
    font-size: 0.95rem;
    color: var(--gray-800);
}

.task-description.done {
    text-decoration: line-through;
    color: var(--gray-400);
}

.task-conditional {
    font-size: 0.8rem;
    color: var(--warning);
    font-style: italic;
    margin-top: 2px;
}

.task-timestamp {
    font-size: 0.75rem;
    color: var(--success);
    margin-top: 2px;
}

.task-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.photo-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.photo-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.photo-btn.has-photo {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
}

.photo-thumbnail {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--gray-200);
}

/* ── Progress Bar ── */

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ── Alerts ── */

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #0c4a6e;
    border-left: 4px solid var(--info);
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* ── Employee Cards (Admin) ── */

.employee-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.employee-card:hover {
    background: var(--gray-50);
}

.employee-card:last-child {
    border-bottom: none;
}

.employee-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.employee-info {
    flex: 1;
    min-width: 0;
}

.employee-info h3 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.employee-info .zone-name {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ── Schedule Info ── */

.schedule-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    margin-bottom: 16px;
}

.schedule-day {
    background: var(--info-light);
    color: #0c4a6e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ── Week Selector ── */

.week-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.week-selector select {
    padding: 8px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

/* ── Photo Lightbox ── */

.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* ── Ad-hoc tasks ── */

.adhoc-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adhoc-item:last-child {
    border-bottom: none;
}

.adhoc-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.adhoc-due {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ── Flash Messages ── */

.flash-messages {
    max-width: 900px;
    margin: 8px auto;
    padding: 0 16px;
}

/* ── History table ── */

.history-card {
    margin-bottom: 12px;
}

.history-week {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ── Settings form ── */

.settings-employee {
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.settings-employee:last-child {
    border-bottom: none;
}

.settings-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}

.settings-row .form-group {
    flex: 1;
    min-width: 120px;
}

/* ── Trash Calendar ── */

.calendar-row {
    display: flex;
    gap: 12px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.calendar-row .form-group {
    flex: 1;
    min-width: 100px;
}

/* ── Responsive ── */

@media (max-width: 480px) {
    .header-title {
        font-size: 0.95rem;
    }

    .card-header h2 {
        font-size: 0.95rem;
    }

    .task-item {
        gap: 10px;
    }

    .settings-row {
        flex-direction: column;
    }

    .nav-tabs {
        margin: 8px 12px;
    }
}

/* ── Complete zone button ── */

.complete-zone-section {
    padding: 16px;
    border-top: 2px solid var(--gray-100);
    text-align: center;
}

/* ── Hidden file input ── */

.file-input-hidden {
    display: none;
}

/* ── Loading spinner ── */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Empty state ── */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ── Day Cards ── */

.day-card {
    border: 2px solid var(--gray-200);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.day-card-today {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.day-card-confirmed {
    border-color: var(--success);
    background: var(--success-light);
}

.day-card-past {
    border-color: var(--gray-200);
    opacity: 0.75;
}

.day-card-upcoming {
    border-color: var(--gray-200);
    opacity: 0.6;
}

.day-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}

.day-card-confirmed .day-card-header {
    border-bottom-color: rgba(22, 163, 74, 0.15);
}

.day-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-800);
}

.day-date-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.day-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.day-badge-today {
    background: var(--primary);
    color: white;
}

.day-badge-confirmed {
    background: var(--success);
    color: white;
}

.day-badge-past {
    background: var(--warning-light);
    color: #92400e;
}

.day-badge-upcoming {
    background: var(--gray-100);
    color: var(--gray-500);
}

.day-card-body {
    padding: 0;
}

/* ── Confirm Section ── */

.confirm-section {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
    text-align: center;
}

.btn-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-confirm:hover {
    background: #15803d;
}

.btn-confirm:active {
    transform: scale(0.98);
}

.btn-confirm:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* ── Day Card Responsive ── */

@media (max-width: 480px) {
    .day-card-header {
        padding: 12px 14px;
    }

    .day-name {
        font-size: 0.9rem;
    }

    .btn-confirm {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}
