/* DhiRide Portal - Shared Styles */
:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --secondary-dark: #059669;
    --accent: #F59E0B;
    --danger: #EF4444;
    --dark: #1F2937;
    --gray: #6B7280;
    --light-gray: #F3F4F6;
    --white: #FFFFFF;
    --shadow: 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: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light-gray);
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* Toast notifications */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius-sm); color: white;
    font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease; min-width: 280px; max-width: 400px;
    display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--secondary); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.warning { background: var(--accent); color: var(--dark); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Desktop layout */
.portal-container {
    display: flex; min-height: 100vh; width: 100%;
}

/* Sidebar (desktop) */
.sidebar {
    width: 260px; background: var(--white); border-right: 1px solid #E5E7EB;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0;
    z-index: 100; transition: var(--transition);
}
.sidebar-header {
    padding: 20px; border-bottom: 1px solid #E5E7EB;
    display: flex; align-items: center; gap: 12px;
}
.sidebar-header .logo {
    width: 40px; height: 40px; background: var(--primary); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; color: white;
    font-weight: 700; font-size: 18px;
}
.sidebar-header .brand {
    font-size: 20px; font-weight: 700; color: var(--primary);
}
.sidebar-nav {
    flex: 1; padding: 12px; overflow-y: auto;
}
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
    font-size: 14px; font-weight: 500; color: var(--gray); text-decoration: none;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--light-gray); color: var(--dark); }
.nav-item.active { background: #EEF2FF; color: var(--primary); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .badge {
    margin-left: auto; background: var(--danger); color: white; font-size: 11px;
    padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.sidebar-footer {
    padding: 16px; border-top: 1px solid #E5E7EB;
}
.user-card {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
}
.user-card:hover { background: var(--light-gray); }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light);
    display: flex; align-items: center; justify-content: center; color: white;
    font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--gray); }

/* Main content */
.main-content {
    flex: 1; margin-left: 260px; min-height: 100vh;
    transition: var(--transition);
}

/* Top bar */
.topbar {
    position: sticky; top: 0; background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px); border-bottom: 1px solid #E5E7EB;
    padding: 16px 24px; display: flex; align-items: center;
    justify-content: space-between; z-index: 50;
}
.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* Cards */
.card {
    background: var(--white); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); border: 1px solid #E5E7EB;
}
.card-sm { padding: 16px; }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    border: none; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-dark); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover:not(:disabled) { background: var(--light-gray); color: var(--dark); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* Form controls */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600; color: var(--dark);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 2px solid #E5E7EB;
    border-radius: var(--radius-sm); font-size: 14px; transition: var(--transition);
    background: var(--white); color: var(--dark); outline: none;
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-input::placeholder { color: #9CA3AF; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-pending { background: #FEF3C7; color: #92400E; }
.status-accepted { background: #DBEAFE; color: #1E40AF; }
.status-ongoing { background: #D1FAE5; color: #065F46; }
.status-completed { background: #E0E7FF; color: #3730A3; }
.status-cancelled { background: #FEE2E2; color: #991B1B; }

/* Grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat cards */
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 20px;
    border: 1px solid #E5E7EB; display: flex; align-items: flex-start; gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.blue { background: #EEF2FF; color: var(--primary); }
.stat-icon.green { background: #D1FAE5; color: var(--secondary); }
.stat-icon.amber { background: #FEF3C7; color: var(--accent); }
.stat-icon.red { background: #FEE2E2; color: var(--danger); }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--gray); }

/* Map */
.map-container {
    width: 100%; height: 400px; border-radius: var(--radius);
    overflow: hidden; border: 1px solid #E5E7EB; position: relative;
}
.map-container.full { height: calc(100vh - 200px); }

/* Loader */
.loader {
    display: flex; align-items: center; justify-content: center; padding: 40px;
}
.spinner {
    width: 36px; height: 36px; border: 3px solid #E5E7EB;
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--gray);
}
.empty-state svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--dark); }
.empty-state p { font-size: 14px; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn 0.2s ease; padding: 20px;
}
.modal-content {
    background: var(--white); border-radius: var(--radius); padding: 24px;
    width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.3s ease; box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: var(--light-gray); cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: var(--transition);
}
.modal-close:hover { background: #E5E7EB; }

/* Auth pages */
.auth-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    padding: 20px;
}
.auth-card {
    background: var(--white); border-radius: 16px; padding: 40px;
    width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
}
.auth-logo {
    text-align: center; margin-bottom: 32px;
}
.auth-logo h1 { color: var(--primary); font-size: 28px; font-weight: 800; }
.auth-logo p { color: var(--gray); font-size: 14px; margin-top: 4px; }
.auth-divider {
    display: flex; align-items: center; gap: 12px; margin: 20px 0;
    color: var(--gray); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: #E5E7EB;
}
.auth-footer {
    text-align: center; margin-top: 20px; font-size: 13px; color: var(--gray);
}
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* Ride request flow */
.location-input-group {
    background: var(--white); border-radius: var(--radius); padding: 16px;
    border: 1px solid #E5E7EB;
}
.location-input-row {
    display: flex; align-items: center; gap: 12px; padding: 8px 0;
}
.location-dot {
    width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.location-dot.pickup { background: var(--secondary); }
.location-dot.destination { background: var(--danger); }
.location-line {
    width: 2px; height: 16px; background: #D1D5DB; margin-left: 5px;
}

/* Vehicle category cards */
.vehicle-card {
    border: 2px solid #E5E7EB; border-radius: var(--radius); padding: 16px;
    cursor: pointer; transition: var(--transition); text-align: center;
}
.vehicle-card:hover { border-color: var(--primary-light); }
.vehicle-card.selected { border-color: var(--primary); background: #EEF2FF; }
.vehicle-card img { width: 60px; height: 40px; object-fit: contain; margin-bottom: 8px; }
.vehicle-card .name { font-size: 14px; font-weight: 600; }
.vehicle-card .fare { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: 4px; }

/* Trip card */
.trip-card {
    background: var(--white); border-radius: var(--radius); padding: 20px;
    border: 1px solid #E5E7EB; margin-bottom: 12px; cursor: pointer;
    transition: var(--transition);
}
.trip-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.trip-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.trip-locations { margin-bottom: 12px; }
.trip-location { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.trip-location .icon { margin-top: 2px; }
.trip-location .text { font-size: 14px; }
.trip-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid #E5E7EB; }
.trip-fare { font-size: 18px; font-weight: 700; color: var(--primary); }
.trip-meta { font-size: 13px; color: var(--gray); }

/* Driver info card */
.driver-card {
    display: flex; align-items: center; gap: 16px; padding: 16px;
    background: var(--white); border-radius: var(--radius); border: 1px solid #E5E7EB;
}
.driver-avatar {
    width: 56px; height: 56px; border-radius: 50%; background: var(--primary-light);
    display: flex; align-items: center; justify-content: center; color: white;
    font-weight: 700; font-size: 20px; flex-shrink: 0;
}
.driver-details { flex: 1; }
.driver-name { font-size: 16px; font-weight: 700; }
.driver-vehicle { font-size: 13px; color: var(--gray); margin-top: 2px; }
.driver-rating { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--accent); font-size: 13px; font-weight: 600; }

/* Bid cards */
.bid-card {
    background: var(--white); border: 1px solid #E5E7EB; border-radius: var(--radius);
    padding: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 16px;
}
.bid-amount { font-size: 20px; font-weight: 700; color: var(--primary); }
.bid-driver { flex: 1; }

/* Search / Location picker */
.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--white);
    border: 1px solid #E5E7EB; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg); z-index: 100; max-height: 300px; overflow-y: auto;
}
.search-item {
    padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #F3F4F6;
    display: flex; align-items: flex-start; gap: 10px; font-size: 14px;
    transition: var(--transition);
}
.search-item:hover { background: var(--light-gray); }
.search-item:last-child { border-bottom: none; }

/* Tabs */
.tabs {
    display: flex; border-bottom: 2px solid #E5E7EB; margin-bottom: 20px;
}
.tab {
    padding: 10px 20px; font-size: 14px; font-weight: 600; color: var(--gray);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: var(--transition);
}
.tab:hover { color: var(--dark); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Pulse animation for searching */
.pulse-ring {
    width: 80px; height: 80px; border-radius: 50%; background: rgba(79,70,229,0.1);
    animation: pulse 1.5s ease-in-out infinite; display: flex; align-items: center;
    justify-content: center; margin: 0 auto;
}
.pulse-ring .inner {
    width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
    display: flex; align-items: center; justify-content: center; color: white;
}

/* OTP Input */
.otp-group { display: flex; gap: 10px; justify-content: center; }
.otp-input {
    width: 50px; height: 56px; text-align: center; font-size: 24px;
    font-weight: 700; border: 2px solid #E5E7EB; border-radius: var(--radius-sm);
    transition: var(--transition); outline: none;
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: #D1D5DB; border-radius: 13px;
    cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; width: 20px; height: 20px; left: 3px;
    bottom: 3px; background: white; border-radius: 50%; transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--secondary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ===== MOBILE STYLES ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding-bottom: 80px; }
    .topbar { padding: 12px 16px; }
    .topbar-title { font-size: 17px; }

    .mobile-bottom-nav {
        display: flex !important; position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--white); border-top: 1px solid #E5E7EB; z-index: 100;
        padding: 6px 0; padding-bottom: calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1);
    }
    .mobile-nav-item {
        flex: 1; display: flex; flex-direction: column; align-items: center;
        gap: 2px; padding: 6px 4px; cursor: pointer; color: var(--gray);
        font-size: 10px; font-weight: 600; transition: var(--transition);
        text-decoration: none; position: relative;
    }
    .mobile-nav-item.active { color: var(--primary); }
    .mobile-nav-item svg { width: 22px; height: 22px; }
    .mobile-nav-item .nav-badge {
        position: absolute; top: 0; right: calc(50% - 18px);
        background: var(--danger); color: white; font-size: 9px;
        width: 16px; height: 16px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
    }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .modal-content { padding: 20px; }
    .auth-card { padding: 24px; }
    .map-container.full { height: calc(100vh - 160px); }
}

/* Desktop: hide bottom nav */
@media (min-width: 769px) {
    .mobile-bottom-nav { display: none !important; }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Large screens */
@media (min-width: 1400px) {
    .sidebar { width: 280px; }
    .main-content { margin-left: 280px; }
}

/* Page transition */
.page-content {
    padding: 24px; animation: fadeIn 0.3s ease;
}
@media (max-width: 768px) {
    .page-content { padding: 16px; }
}

/* Autocomplete */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
    position: absolute; top: 100%; left: 0; right: 0;
    background: white; border: 1px solid #E5E7EB;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg); z-index: 200; max-height: 250px; overflow-y: auto;
}
.autocomplete-item {
    padding: 10px 14px; cursor: pointer; font-size: 14px;
    border-bottom: 1px solid #F3F4F6; display: flex; align-items: center; gap: 10px;
}
.autocomplete-item:hover { background: var(--light-gray); }

/* Progress steps */
.progress-steps {
    display: flex; align-items: center; justify-content: center; gap: 0; margin: 20px 0;
}
.progress-step {
    display: flex; align-items: center; gap: 0;
}
.progress-circle {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid #E5E7EB;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: var(--gray); transition: var(--transition);
}
.progress-circle.active { border-color: var(--primary); background: var(--primary); color: white; }
.progress-circle.done { border-color: var(--secondary); background: var(--secondary); color: white; }
.progress-line { width: 40px; height: 2px; background: #E5E7EB; }
.progress-line.active { background: var(--primary); }
.progress-line.done { background: var(--secondary); }

/* Fare breakdown */
.fare-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.fare-row.total { border-top: 2px solid #E5E7EB; padding-top: 12px; margin-top: 4px; font-weight: 700; font-size: 16px; }

/* Notification bell w animation */
.notification-bell { position: relative; }
.notification-bell .dot {
    position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%; border: 2px solid var(--white);
}

/* Chat */
.chat-container { display: flex; flex-direction: column; height: 400px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; }
.chat-bubble {
    max-width: 70%; padding: 10px 14px; border-radius: 16px; margin-bottom: 8px;
    font-size: 14px; line-height: 1.5;
}
.chat-bubble.sent { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-bubble.received { background: var(--light-gray); border-bottom-left-radius: 4px; }
.chat-input-area {
    display: flex; gap: 8px; padding: 12px; border-top: 1px solid #E5E7EB;
}
