/* Modern Color Palette & Variables */
:root {
    /* Brand Colors */
    --primary-color: #2563EB;
    /* Vibrant Blue */
    --primary-hover: #1D4ED8;
    --primary-light: #EFF6FF;

    /* Semantic Colors */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;

    /* Neutral Colors */
    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;

    /* Status Colors (Pastel-ish for better look) */
    --status-working-bg: #D1FAE5;
    --status-working-text: #065F46;
    --status-off-bg: #F3F4F6;
    --status-off-text: #374151;
    --status-mc-bg: #FEE2E2;
    --status-mc-text: #991B1B;
    --status-trip-bg: #DBEAFE;
    --status-trip-text: #1E40AF;
    --status-meal-bg: #FEF3C7;
    --status-meal-text: #92400E;
    --status-break-bg: #E0F2FE;
    --status-break-text: #075985;
    --status-home-bg: #F3E8FF;
    --status-home-text: #6B21A8;
    --status-other-bg: #E5E7EB;
    --status-other-text: #374151;

    /* Effects */
    --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);
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in inputs and textareas */
input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

html, body {
    overscroll-behavior-y: none; /* Prevent pull-to-refresh bounce */
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 16px;
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
    /* Optimized for mobile readability */
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    /* Space for footer/safe area */
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    /* padding: 1rem 1.5rem; */
    /* Original padding was bigger */
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), #8B5CF6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.nav-user {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-user a {
    color: var(--text-main);
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Hover effect only for non-touch devices or interactive cards might be better, keeping it subtle */
/* .card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
} */

.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: #FCFCFD;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--bg-card);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    touch-action: manipulation;
}

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

.btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 4px -1px rgba(37, 99, 235, 0.2);
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-body);
    box-shadow: var(--shadow-md);
}

/* Status Grid (Dashboard) */
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.status-grid .btn {
    border-radius: var(--radius-md);
    /* Softer corners for grid items */
    font-size: 0.95rem;
    padding: 1rem 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
    /* Reset specific backgrounds to use variables logic later if needed, but keeping inline override support */
    box-shadow: var(--shadow-sm);
    opacity: 0.95;
}

.status-grid .btn:hover {
    opacity: 1;
    transform: scale(1.02);
}

/* Login Page Specifics */
.login-page {
    background: linear-gradient(135deg, #F9FAFB 0%, #E5E7EB 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    margin: 0;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), #8B5CF6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

/* Status Specific Styles */
.status-working {
    background-color: var(--status-working-bg);
    color: var(--status-working-text);
}

.status-off {
    background-color: var(--status-off-bg);
    color: var(--status-off-text);
}

.status-mc {
    background-color: var(--status-mc-bg);
    color: var(--status-mc-text);
}

.status-out_business {
    background-color: var(--status-trip-bg);
    color: var(--status-trip-text);
}

.status-out_meal {
    background-color: var(--status-meal-bg);
    color: var(--status-meal-text);
}

.status-break {
    background-color: var(--status-break-bg);
    color: var(--status-break-text);
}

.status-home {
    background-color: var(--status-home-bg);
    color: var(--status-home-text);
}

.status-other {
    background-color: var(--status-other-bg);
    color: var(--status-other-text);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background-color: #F9FAFB;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Toast */
#toast {
    background: rgba(17, 24, 39, 0.9) !important;
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 24px !important;
    border-radius: 9999px !important;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    font-size: 0.95rem;
    bottom: 30px !important;
}

/* Offline Indicator */
#offlineIndicator {
    background-color: #EF4444;
    color: white !important;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Admin Specific Tweaks (Keep in style.css for simplicity or moved) */
.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 15px;
    }

    .card {
        padding: 1.25rem;
    }

    .status-grid {
        grid-template-columns: 1fr 1fr;
        /* Keep 2 cols on mobile for ease of tapping */
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
}

/* Status Path Breadcrumbs */
.status-path {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.path-pill {
    padding: 8px 18px;
    background: #E5E7EB;
    color: #4B5563;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    border: 2px solid #D1D5DB;
}

.path-pill.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.path-arrow {
    color: var(--primary-color);
    font-weight: 900;
    font-size: 1.4rem;
}