/* ═══════════════════════════════════════════════════════════
   ParkPilot Vendor Dashboard — Styles
   ═══════════════════════════════════════════════════════════ */

/* ─── Login Page ─── */
.login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    z-index: 500;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    margin: 16px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo svg {
    color: #2563eb;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.login-logo p {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px #dbeafe;
    background: #ffffff;
}

.login-field input::placeholder {
    color: #94a3b8;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 8px;
    justify-content: center;
}

.login-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.login-hint {
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
}

.login-hint strong {
    color: #64748b;
}

/* ─── Dashboard Wrapper ─── */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.dashboard-wrapper.hidden {
    display: none !important;
}

/* ─── Logout Section ─── */
.logout-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logged-in-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

.logged-in-user svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.btn-logout {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.4);
    color: #fca5a5;
}

/* ─── Reset & Variables ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-success: #16a34a;
    --color-success-light: #dcfce7;
    --color-warning: #d97706;
    --color-warning-light: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-light: #fee2e2;
    --color-info: #0891b2;
    --color-info-light: #cffafe;
    --color-neutral: #6b7280;
    --color-neutral-light: #f3f4f6;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;

    --border-color: #e2e8f0;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    --sidebar-width: 260px;
    --header-height: 56px;
    --transition: 0.2s ease;
}

html {
    font-size: 14px;
}

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

/* ─── Sidebar ─── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-sidebar-active);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    color: var(--color-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    color: var(--text-sidebar);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.nav-item.active {
    background: var(--color-primary);
    color: var(--text-sidebar-active);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.product-selector-section label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.product-selector-section label svg {
    opacity: 0.7;
}

.product-selector-section select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-sidebar-active);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.product-selector-section select:focus {
    border-color: var(--color-primary);
}

.product-selector-section select option {
    background: var(--bg-sidebar);
    color: var(--text-sidebar-active);
}

.product-sku {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    letter-spacing: 0.03em;
}

/* ─── Mobile Header ─── */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-sidebar);
    color: var(--text-sidebar-active);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 90;
}

.mobile-brand {
    font-weight: 700;
    font-size: 1.1rem;
}

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* ─── Pages ─── */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ─── Filters Card ─── */
.filters-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.filters-actions {
    display: flex;
    gap: 8px;
}

/* ─── Table Card ─── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--color-primary-light);
}

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

/* ─── Status Badges ─── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-confirmed {
    background: var(--color-success-light);
    color: var(--color-success);
}
.status-confirmed::before { background: var(--color-success); }

.status-amended {
    background: var(--color-warning-light);
    color: var(--color-warning);
}
.status-amended::before { background: var(--color-warning); }

.status-cancelled {
    background: var(--color-danger-light);
    color: var(--color-danger);
}
.status-cancelled::before { background: var(--color-danger); }

.status-checked_in {
    background: var(--color-info-light);
    color: var(--color-info);
}
.status-checked_in::before { background: var(--color-info); }

.status-checked_out {
    background: var(--color-neutral-light);
    color: var(--color-neutral);
}
.status-checked_out::before { background: var(--color-neutral); }

.status-sent {
    background: var(--color-success-light);
    color: var(--color-success);
}
.status-sent::before { background: var(--color-success); }

.status-draft {
    background: var(--color-neutral-light);
    color: var(--color-neutral);
}
.status-draft::before { background: var(--color-neutral); }

.status-paid {
    background: var(--color-primary-light);
    color: var(--color-primary);
}
.status-paid::before { background: var(--color-primary); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--text-secondary);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--border-radius);
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-view {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

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

.btn-download {
    background: var(--color-success-light);
    color: var(--color-success);
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
}

.btn-download:hover {
    background: var(--color-success);
    color: #fff;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-numbers {
    display: flex;
    gap: 2px;
}

.page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.page-num:hover {
    background: var(--bg-body);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.page-num.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.page-num.ellipsis {
    border: none;
    cursor: default;
    background: transparent;
}

.page-num.ellipsis:hover {
    background: transparent;
    color: var(--text-secondary);
}

/* ─── Empty & Loading States ─── */
.empty-state,
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state p,
.loading-state p {
    margin-top: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 0.85rem;
    margin-top: 4px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-header .btn-icon {
    color: var(--text-secondary);
}

.modal-header .btn-icon:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-id {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-vendor-ref {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--color-neutral-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.detail-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.detail-section h3 svg {
    color: var(--color-primary);
}

.detail-section dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
}

.detail-section dt {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-section dd {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

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

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

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(var(--header-height) + 16px);
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .modal {
        margin: 8px;
        max-height: calc(100vh - 16px);
    }

    .modal-body {
        padding: 16px;
    }
}
