/**
 * ============================================================================
 * GLOBAL STYLES - INTERCITY Driver App
 * ============================================================================
 * Same typography and structure as client app
 */

/* ============================================================================
   THEME VARIABLES
   ============================================================================ */

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

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

    /* Transitions */
    --transition-fast: 0.2s ease;

    /* Safe Area for Mobile */
    --sat: env(safe-area-inset-top);
    --sab: env(safe-area-inset-bottom);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #10b981;
    --primary-light: #34d399;
    --secondary: #f59e0b;
    --background: #111827;
    --surface: #1f2937;
    --surface-light: #374151;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #374151;
    --header-bg: rgba(17, 24, 39, 0.95);
}

/* Light Theme */
[data-theme="light"] {
    --primary: #059669;
    --primary-light: #10b981;
    --secondary: #f59e0b;
    --background: #f9fafb;
    --surface: #ffffff;
    --surface-light: #f3f4f6;
    --text-main: #111827;
    --text-muted: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #e5e7eb;
    --header-bg: rgba(255, 255, 255, 0.95);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--sat));
    padding: var(--sat) var(--spacing-md) 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--surface-light);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--error);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

#main-content {
    flex: 1;
    padding: calc(60px + var(--sat) + var(--spacing-md)) var(--spacing-md) calc(80px + var(--sab));
    overflow-y: auto;
}

/* ============================================================================
   BOTTOM NAVIGATION
   ============================================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + var(--sab));
    padding-bottom: var(--sab);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    padding: 8px 20px 10px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
    position: relative;
    min-width: 64px;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    transition: all 0.25s ease;
}

/* Active Nav Item - Subtle Highlight */
.nav-item.active {
    color: var(--primary);
}

.nav-item.active span {
    font-weight: 600;
    color: var(--primary);
}

.nav-item.active svg {
    color: var(--primary);
    transform: scale(1.1);
}

/* Active indicator dot below icon */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

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

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    color: #1f2937;
}

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

.btn-full {
    width: 100%;
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-completed {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================================
   SECTION HEADERS
   ============================================================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.section-link {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

/* ============================================================================
   PAGE HEADER (with back button)
   ============================================================================ */

.page-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.back-btn:hover {
    background: var(--surface-light);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

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

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    bottom: 80px;
    /* Above nav bar */
    left: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInUp 0.3s ease forwards;
    pointer-events: auto;
    width: 100%;
}

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

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

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

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}