/* style.css - STVS PayPerDay Modern UI & PWA Design System */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #10b981;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-pill: 9999px;
    
    --color-primary: #10b981;
    --color-primary-dark: #059669;
    --color-primary-light: #ecfdf5;
    --color-primary-glow: rgba(16, 185, 129, 0.2);
    
    --color-blue: #2563eb;
    --color-blue-light: #eff6ff;
    --color-purple: #7c3aed;
    --color-purple-light: #f5f3ff;
    --color-orange: #f59e0b;
    --color-orange-light: #fffbeb;
    --color-red: #ef4444;
    --color-red-light: #fef2f2;
    --color-green: #10b981;
    --color-green-light: #ecfdf5;
    
    --color-admin: #3b82f6;
    --color-dealer: #8b5cf6;
    --color-customer: #10b981;
    
    --text-primary: #0f172a;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --text-sub: #94a3b8;
    --text-muted: #94a3b8;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 10px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --card-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Mobile Bottom-Left Floating Download App FAB (Hidden on Desktop) */
.mobile-floating-download-btn {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-floating-download-btn {
        position: fixed;
        left: 14px;
        bottom: 68px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: #ffffff;
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 999;
        border: 2px solid rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
        cursor: pointer;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
        animation: subtlePulse 2.5s infinite ease-in-out;
        padding: 0;
    }

    .mobile-floating-download-btn:active {
        transform: scale(0.92);
    }
}

@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 18px rgba(16, 185, 129, 0.7);
    }
}

/* Dashboard Shell Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

/* Top App Header & Premium Navbar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-bolt {
    font-size: 22px;
    line-height: 1;
}

.brand-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-badge {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--border-radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Desktop User Profile & Logout (Desktop View) */
.desktop-nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: var(--border-radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.desktop-logout-btn {
    color: var(--color-red);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    background: #fef2f2;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.desktop-logout-btn:hover {
    background: #fee2e2;
}

/* Mobile User Profile Dropdown Menu (Hidden on Desktop, Visible on Mobile) */
.mobile-nav-user {
    display: none !important;
}

.user-menu-wrapper {
    position: relative;
}

.user-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 6px 14px;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s ease;
    user-select: none;
    outline: none;
}

.user-pill-btn:hover,
.user-pill-btn:focus,
.user-menu-wrapper.active .user-pill-btn {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

.user-icon-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.chevron-arrow {
    color: #64748b;
    transition: transform 0.2s ease;
}

.user-menu-wrapper.active .chevron-arrow {
    transform: rotate(180deg);
}

.user-dropdown-card {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.user-menu-wrapper.active .user-dropdown-card,
.user-menu-wrapper:hover .user-dropdown-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: #1e293b;
}

.dropdown-avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.dropdown-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 6px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.dropdown-item.logout-link {
    color: #ef4444;
}

.dropdown-item.logout-link:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Dashboard Body Container */
.dashboard-body {
    padding: 24px;
    flex-grow: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 95px;
}

.breadcrumb-area {
    margin-bottom: 24px;
}

.breadcrumb-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.breadcrumbs {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 600;
}

/* Overview Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-purple { background: var(--color-purple-light); color: var(--color-purple); }
.stat-green { background: var(--color-green-light); color: var(--color-green); }
.stat-blue { background: var(--color-blue-light); color: var(--color-blue); }
.stat-red { background: var(--color-red-light); color: var(--color-red); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-sublabel {
    font-size: 11px;
    color: var(--text-muted);
}

/* Table Panels & Cards */
.table-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.filter-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
}

.search-input:focus {
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Dropdown Filters Grid */
.dropdown-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.filter-box label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.filter-select {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    background: #ffffff;
    outline: none;
}

.filter-select:focus {
    border-color: var(--border-focus);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

table th {
    background: #f8fafc;
    padding: 12px 14px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

table tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: var(--border-radius-pill);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.status-badge-ontrack {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge-behind {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-badge-defaulter {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Form Buttons */
.btn-form-submit {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: inline-block;
}

.btn-form-submit:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-action {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* Passbook Specific Card Panes */
.passbook-details-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

@media (max-width: 850px) {
    .passbook-details-container {
        grid-template-columns: 1fr;
    }
}

.passbook-card-pane {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.qr-pane {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.qr-box {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-box img {
    max-width: 100%;
    width: 200px;
    height: 200px;
    display: block;
}

.pb-field-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.pb-label {
    color: var(--text-secondary);
}

.pb-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Payment Quick Amount Chips */
.quick-chips-wrapper {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.amount-chip {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--border-radius-pill);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.amount-chip:hover {
    background: #e2e8f0;
}

.amount-chip.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 700;
    transition: color 0.2s;
}

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

/* Responsive Table / Card toggle */
.desktop-only-table {
    display: block;
}

.mobile-only-list {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only-table {
        display: none !important;
    }
    
    .mobile-only-list {
        display: flex !important;
        flex-direction: column;
        gap: 14px;
    }
    
    .dashboard-body {
        padding: 16px 12px 95px 12px;
    }

    /* Mobile Header Layout */
    .top-navbar {
        padding: 10px 16px;
    }

    .brand-meta {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }

    .brand-title {
        font-size: 16.5px !important;
    }

    .brand-badge {
        font-size: 9.5px !important;
        padding: 1.5px 8px !important;
    }

    .desktop-nav-user {
        display: none !important;
    }

    .mobile-nav-user {
        display: block !important;
    }
}

.mobile-driver-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--card-shadow);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mobile-card-name {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-primary);
}

.mobile-card-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.mobile-card-grid-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
}

.mobile-card-grid-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}
