/* ZippCar Dashboard — shadcn/ui-inspired design system */

/* ─── Design Tokens ─── */
:root {
    --zinc-50: #fafafa;
    --zinc-100: #f4f4f5;
    --zinc-200: #e4e4e7;
    --zinc-300: #d4d4d8;
    --zinc-400: #a1a1aa;
    --zinc-500: #71717a;
    --zinc-600: #52525b;
    --zinc-700: #3f3f46;
    --zinc-800: #27272a;
    --zinc-900: #18181b;
    --zinc-950: #09090b;

    --white: #ffffff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);

    /* Badge colors */
    --green-bg: #dcfce7; --green-text: #166534;
    --red-bg: #fee2e2; --red-text: #991b1b;
    --amber-bg: #fef3c7; --amber-text: #92400e;
    --blue-bg: #dbeafe; --blue-text: #1e40af;
    --orange-bg: #ffedd5; --orange-text: #9a3412;
    --gray-bg: #f4f4f5; --gray-text: #3f3f46;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: var(--font-mono);
    color: var(--zinc-900);
    background: var(--zinc-100);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--zinc-900); text-decoration: none; }
a:hover { color: var(--zinc-600); }

/* ─── Layout ─── */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    background: var(--zinc-900);
    color: var(--zinc-300);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid var(--zinc-700);
    margin-bottom: 0.75rem;
}

.sidebar-brand h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.025em;
}

.sidebar-brand small {
    font-size: 0.75rem;
    color: var(--zinc-500);
}

.sidebar-nav {
    flex: 1;
    padding: 0 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--zinc-400);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--zinc-800);
    color: var(--zinc-100);
}

.nav-item.active {
    background: var(--zinc-800);
    color: var(--white);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid var(--zinc-700);
    margin-top: auto;
}

.sidebar-footer .user-info {
    font-size: 0.8rem;
    color: var(--zinc-400);
    margin-bottom: 0.5rem;
}

.sidebar-footer a {
    font-size: 0.8rem;
    color: var(--zinc-500);
}

.sidebar-footer a:hover { color: var(--zinc-300); }

/* ─── Main Content ─── */
.main-content {
    padding: 2rem;
    overflow-y: auto;
    min-height: 100vh;
}

/* ─── Page Header ─── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.page-header h2 small {
    font-weight: 400;
    color: var(--zinc-500);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.breadcrumb {
    font-size: 0.8rem;
    color: var(--zinc-500);
    margin-bottom: 0.75rem;
}

.breadcrumb a { color: var(--zinc-500); }
.breadcrumb a:hover { color: var(--zinc-900); }

/* ─── Cards ─── */
.card {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1.5rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--zinc-100);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-header small {
    color: var(--zinc-500);
    font-size: 0.8rem;
}

/* ─── Data Tables ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table thead th.text-right,
.data-table tbody td.text-right {
    text-align: right;
}

.data-table thead th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    background: var(--zinc-50);
    border-bottom: 1px solid var(--zinc-200);
}

.data-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--zinc-100);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--zinc-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr.client-group-start td {
    border-top: 2.5px solid var(--zinc-300);
}

.data-table a {
    color: var(--blue-text);
    font-weight: 500;
}

/* ─── Signature Thumbnail + Hover Preview ─── */
.sig-thumb {
    width: 36px;
    height: 24px;
    object-fit: contain;
    border: 1px solid var(--zinc-200);
    border-radius: 3px;
    background: var(--white);
    cursor: pointer;
}

.sig-preview-wrap {
    position: relative;
}

.sig-preview-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    pointer-events: none;
}

.sig-preview-tooltip img {
    width: 400px;
    height: auto;
    display: block;
}

.sig-preview-wrap:hover .sig-preview-tooltip {
    display: block;
}

/* ─── Document Preview Tooltip ─── */
.doc-preview-wrap {
    position: relative;
}

.doc-preview-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    z-index: 100;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    pointer-events: none;
    overflow: hidden;
}

.doc-preview-tooltip iframe {
    width: 600px;
    height: 450px;
    border: none;
}

.doc-preview-wrap:hover .doc-preview-tooltip {
    display: block;
}

.data-table a:hover {
    text-decoration: underline;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-orange { background: var(--orange-bg); color: var(--orange-text); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray-text); }

/* ─── Status Dots (client list) ─── */
.status-dots {
    display: flex;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.status-dot.missing {
    background: var(--zinc-300);
}

.status-legend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--zinc-400);
    white-space: nowrap;
}

/* ─── Avatar ─── */
.avatar-initials {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--zinc-200);
    color: var(--zinc-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ─── Client Header ─── */
.client-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-header-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
}

.client-header-info p {
    font-size: 0.8rem;
    color: var(--zinc-500);
}

/* ─── Detail Grid (key-value pairs) ─── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
}

.detail-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    margin-bottom: 0.125rem;
}

.detail-item span {
    font-size: 0.875rem;
    color: var(--zinc-900);
}

/* ─── Claims Grid ─── */
.claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.claim-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.claim-card:hover {
    border-color: var(--zinc-400);
    box-shadow: var(--shadow);
    color: var(--zinc-900);
}

.claim-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.claim-card-header strong {
    font-size: 0.9rem;
}

.claim-card-body {
    font-size: 0.8rem;
    color: var(--zinc-600);
    line-height: 1.5;
}

.claim-card-body .row {
    display: flex;
    justify-content: space-between;
}

/* ─── Timeline ─── */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--zinc-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
    padding-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zinc-300);
    border: 2px solid var(--white);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-date {
    font-size: 0.7rem;
    color: var(--zinc-500);
}

.timeline-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--zinc-800);
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--zinc-600);
    margin-top: 0.125rem;
}

.timeline-actions {
    margin-top: 0.25rem;
}

/* ─── Buttons ─── */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--zinc-700);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-sm:hover {
    background: var(--zinc-50);
    color: var(--zinc-900);
}

.btn-primary {
    background: var(--zinc-900);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover { background: var(--zinc-700); }

/* ─── Status Flags ─── */
.status-flags {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-flag {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--zinc-600);
}

.status-flag .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zinc-300);
}

.status-flag.active .dot {
    background: #22c55e;
}

/* ─── Search Input ─── */
.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: var(--white);
    color: var(--zinc-900);
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus {
    border-color: var(--zinc-400);
    box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.1);
}

.search-input::placeholder { color: var(--zinc-400); }

/* ─── Select ─── */
.form-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: var(--white);
    color: var(--zinc-900);
    outline: none;
}

.form-select:focus {
    border-color: var(--zinc-400);
}

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--zinc-600);
    cursor: pointer;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--zinc-500);
}

.pagination a {
    color: var(--blue-text);
    font-weight: 500;
}

.pagination a:hover { text-decoration: underline; }

/* ─── Summary Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--zinc-900);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    margin-top: 0.25rem;
}

/* ─── Login Page ─── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--zinc-100);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--zinc-500);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--zinc-700);
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--zinc-400);
    box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.1);
}

.login-card .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red-text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* ─── Notes Block ─── */
.notes-block {
    background: var(--zinc-50);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    color: var(--zinc-700);
}

/* ─── Hamburger (mobile) ─── */
.hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1000;
    background: var(--zinc-900);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        width: 240px;
        z-index: 900;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .hamburger {
        display: block;
    }

    .main-content {
        padding: 3.5rem 1rem 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .claims-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .card {
        padding: 1rem;
    }
}

/* Table wrapper for horizontal scroll on small screens */
.table-wrapper {
    overflow-x: auto;
}
