/* ========================================
   ROOMOS - MODERN DESIGN SYSTEM
   ======================================== */

/* --- CSS VARIABLES --- */
:root {
    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme (Default) */
body {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: rgba(31, 41, 55, 0.6);
    --bg-elevated: rgba(55, 65, 81, 0.4);
    --bg-input: rgba(17, 24, 39, 0.8);

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;

    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.4);
}

/* Light Theme */
body[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-elevated: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(241, 245, 249, 0.8);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;

    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);

    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.12);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* --- BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* --- LAYOUT --- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#view-container {
    flex: 1;
    padding: var(--space-lg);
    padding-bottom: 120px;
    overflow-y: auto;
    overflow-x: hidden;
}

#view-container::-webkit-scrollbar {
    width: 6px;
}

#view-container::-webkit-scrollbar-track {
    background: transparent;
}

#view-container::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

#view-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* --- CARDS --- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

.card h2 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* --- INPUTS --- */
.input-field {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: var(--font-main);
    background: var(--bg-input);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    margin-bottom: var(--space-sm);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* --- BOTTOM NAV (DOCK) --- */
.bottom-nav {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;

    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: var(--space-xs);

    background: var(--bg-card);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 12px 8px;
    box-shadow: var(--shadow-xl);

    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item.active::before {
    opacity: 0.1;
}

.nav-icon {
    font-size: 1.5rem;
    transition: transform var(--transition-fast);
    position: relative;
    z-index: 1;
}

.nav-item.active .nav-icon {
    transform: translateY(-2px) scale(1.1);
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    top: calc(var(--space-lg) + 60px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 200;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-elevated);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;

    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all var(--transition-base);
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-success i {
    color: var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-error i {
    color: var(--danger);
}

.toast-info {
    border-left: 3px solid var(--info);
}

.toast-info i {
    color: var(--info);
}

/* --- ROSTER SPECIFIC --- */
.roster-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.roster-card.today-glow {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.roster-header {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.shift-row {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.shift-row:last-child {
    border-bottom: none;
}

.shift-row.morning {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.05) 0%, transparent 100%);
}

.shift-row.night {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
}

.worker-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: var(--space-sm);
    margin-top: var(--space-sm);
    transition: all var(--transition-fast);
}

.worker-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

/* --- CREW CARDS --- */
.crew-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.crew-card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

.crew-avatar {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

/* --- ROSTER SPECIFIC --- */
.shift-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.shift-icon {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pass-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.today-tag {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.worker-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.time-tiny {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-left: 4px;
}

.editable-day {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.editable-day:active {
    transform: scale(0.98);
}

/* --- DASHBOARD SPECIFIC --- */
.status-big {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin: var(--space-md) 0;
    color: var(--text-primary);
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-m {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-n {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.dash-task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mb-4 {
    margin-bottom: var(--space-lg);
}

.p-4 {
    padding: var(--space-lg);
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: modalPop var(--transition-base) cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVE --- */
@media (max-width: 640px) {
    .app-header {
        padding: var(--space-md);
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    #view-container {
        padding: var(--space-md);
    }

    .card {
        padding: var(--space-md);
    }

    .bottom-nav {
        width: calc(100% - 16px);
        bottom: var(--space-md);
    }
}