:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
    --nav-height: 65px;
    --border-radius: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; /* Prevent scrolling on body, let inner containers scroll */
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography Utilities */
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.w-100 { width: 100%; }

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.98); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:active { background: #fca5a5; }
.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

/* Global View Control */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    transition: opacity 0.3s ease;
    z-index: 1;
}
.view-hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* === Onboarding === */
#onboardingScreen {
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.onboarding-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.app-logo { width: 80px; height: 80px; border-radius: 20px; margin-bottom: 1rem; box-shadow: var(--shadow-md); }
.onboarding-content h1 { font-weight: 800; font-size: 1.8rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; }
.form-group { text-align: right; margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.select-wrapper { position: relative; }
.select-wrapper select {
    width: 100%;
    appearance: none;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Cairo', sans-serif;
}
.select-wrapper select:focus { border-color: var(--primary); }
.select-wrapper i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--text-muted); pointer-events: none; }

/* === Main App Area === */
.main-layout { display: flex; flex-direction: column; }
.content-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding-bottom: var(--nav-height); /* Leave space for bottom nav */
}
.tab-pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}
.tab-pane.active { display: flex; }

.app-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.app-header h2.greeting { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.2rem; }
.date-subtitle { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
.header-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--card-bg);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.4rem; color: var(--text-main);
    box-shadow: var(--shadow-sm); cursor: pointer;
}

.scrollable-y {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 2rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.card-title { font-size: 1rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-bottom: 0.8rem; font-weight: 600; }
.shift-person { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.main-person { font-size: 1.8rem; font-weight: 800; color: var(--primary); }

.premium-card {
    background: linear-gradient(135deg, #eff6ff 0%, #dbf4ff 100%);
    border: 1px solid #bae6fd;
    box-shadow: 0 8px 16px -4px rgba(56, 189, 248, 0.2);
}

.my-status-box {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border-right: 4px solid var(--primary);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
}
.status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.status-header h4 { font-weight: 700; font-size: 1.1rem; }
.badge { background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; }
.next-shift-text { font-size: 1rem; color: var(--text-muted); font-weight: 600; }

/* Calendar */
.month-selector { display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; margin-bottom: 1rem; }
.month-label { font-weight: 800; font-size: 1.2rem; }
.table-wrapper { background: var(--card-bg); border-radius: var(--border-radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.modern-table { width: 100%; border-collapse: collapse; text-align: center; }
.modern-table th { background: var(--primary-light); color: var(--primary); padding: 12px 0; font-weight: 700; font-size: 0.85rem; }
.modern-table td { padding: 12px 4px; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; font-weight: 600; }
.modern-table td span.date { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 2px; }
.modern-table tr:last-child td { border-bottom: none; }
.highlight-day { background: #fef08a; } /* Highlight current day */
.my-shift-day { background: var(--primary-light); border-radius: 8px; color: var(--primary-dark); font-weight: 800; border: 1px solid #bfdbfe;}

/* Settings */
.settings-header { display: flex; align-items: center; gap: 8px; margin-bottom: 0.5rem; }
.settings-header h3 { font-size: 1.2rem; font-weight: 700; }
.settings-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; }
.input-modern { margin-bottom: 1rem; }
.input-modern label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.input-modern input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    background: #f8fafc;
    transition: border-color 0.2s;
}
.input-modern input:focus { outline: none; border-color: var(--primary); background: #fff; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; width: 100%; height: var(--nav-height);
    background: var(--card-bg);
    display: flex; justify-content: space-around; align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 10;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); background: none; border: none; font-size: 0.75rem;
    font-weight: 600; cursor: pointer; transition: color 0.2s; gap: 4px; padding: 5px 15px;
}
.nav-item i { font-size: 1.5rem; transition: transform 0.2s; }
.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: translateY(-2px); }

/* Toast */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    background: rgba(15, 23, 42, 0.9); color: white; padding: 12px 24px;
    border-radius: 30px; font-weight: 600; font-size: 0.9rem; z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Animations */
.fade-in { animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
