/* VIN Lookup page — styles */

.vin-lookup-container {
    padding: 24px 32px 64px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------- Header + Search ---------- */
.vin-header {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.vin-header-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vin-title-block h1 {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    letter-spacing: -0.02em;
}

.vin-title-block p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 640px;
}

.vin-search-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
    max-width: 720px;
    flex-wrap: wrap;
}

.vin-input-wrap {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.vin-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #64748b);
    pointer-events: none;
    font-size: 15px;
}

.vin-input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
    letter-spacing: 0.06em;
    color: var(--text-main, #0f172a);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.vin-input:focus {
    outline: none;
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.vin-input.invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.vin-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    background: var(--accent, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.vin-submit-btn:hover:not(:disabled) {
    background: var(--accent-dark, #2563eb);
}

.vin-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.vin-input-error {
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}

/* ---------- States ---------- */
.vin-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
}

.vin-state i {
    font-size: 2.5rem;
    color: var(--text-muted, #64748b);
}

.vin-state h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.vin-state p {
    margin: 0;
    max-width: 480px;
    font-size: 0.95rem;
}

.vin-empty i { color: #94a3b8; }

.vin-error i { color: #dc2626; }

/* ---------- Results layout ---------- */
.vin-results {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.vin-top-grid,
.summary-strip {
    margin-bottom: 4px;
}

.vin-section {
    margin-top: 4px;
}

/* ---------- Top grid: Vehicle + Carrier ---------- */
.vin-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .vin-top-grid { grid-template-columns: 1fr; }
}

.vin-card {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 20px 24px;
}

.vin-card-title {
    margin: 0 0 16px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 8px;
}

.vin-card-title i { color: var(--accent, #3b82f6); }

.vin-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Vehicle specs list */
.spec-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 14px;
}

.spec-row:last-child { border-bottom: none; }

.spec-label {
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
    align-self: center;
}

.spec-value {
    font-weight: 600;
    color: var(--text-main, #0f172a);
    word-break: break-all;
}

.text-light { color: #cbd5e1; }

/* Carrier card */
.carrier-name-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 12px;
}

.carrier-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    line-height: 1.3;
}

.carrier-dba {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.carrier-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 16px;
}

@media (max-width: 500px) {
    .carrier-meta { grid-template-columns: 1fr; }
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 13px;
}

.meta-label {
    color: var(--text-muted, #64748b);
    font-weight: 600;
}

.meta-val {
    font-weight: 700;
    color: var(--text-main, #0f172a);
    text-align: right;
}

.carrier-drilldown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--accent, #3b82f6);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.15s;
}

.carrier-drilldown-btn:hover { background: var(--accent-dark, #2563eb); }

.empty-carrier {
    padding: 16px 0;
    text-align: center;
}

/* ---------- Summary strip ---------- */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .summary-strip { grid-template-columns: repeat(2, 1fr); }
}

.summary-tile {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 80px;
    justify-content: center;
}

.summary-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    line-height: 1;
    letter-spacing: -0.02em;
}

.summary-num-sm {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    line-height: 1.3;
}

.summary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #64748b);
}

.summary-oos { background: linear-gradient(135deg, #fef2f2, #fff); border-color: #fecaca; }
.summary-oos .summary-num { color: #dc2626; }

.summary-crashes { background: linear-gradient(135deg, #fff7ed, #fff); border-color: #fed7aa; }
.summary-crashes .summary-num { color: #c2410c; }

/* ---------- Sections (collapsible via <details>) ---------- */
.vin-section {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    overflow: hidden;
}

.vin-section > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.vin-section > summary::-webkit-details-marker {
    display: none;
}

.vin-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.vin-section[open] > summary .vin-section-header {
    border-bottom-color: var(--border-color, #e2e8f0);
}

.vin-section > summary:hover .vin-section-header {
    background: #f1f5f9;
}

.vin-section-chevron {
    margin-left: auto;
    color: var(--text-muted, #64748b);
    transition: transform 0.2s ease;
    font-size: 12px;
}

.vin-section[open] > summary .vin-section-chevron {
    transform: rotate(180deg);
}

.vin-section-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-main, #0f172a);
    display: flex;
    align-items: center;
    gap: 8px;
}

.vin-section-header h3 i { color: var(--accent, #3b82f6); }

.vin-section-badge {
    background: var(--accent, #3b82f6);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}

.vin-section-body {
    padding: 16px 24px;
}

.empty-line {
    padding: 16px 0;
    color: var(--text-muted, #64748b);
    font-style: italic;
    text-align: center;
    margin: 0;
}

/* ---------- Tables ---------- */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.vin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vin-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #64748b);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    white-space: nowrap;
}

.vin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main, #0f172a);
    vertical-align: middle;
}

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

.vin-table tbody tr:hover { background: #f8fafc; }

.vin-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
}

.row-oos {
    background: #fef2f2;
}

.row-oos:hover { background: #fee2e2 !important; }

/* ---------- Chips ---------- */
.chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.chip-danger { background: #fee2e2; color: #991b1b; }
.chip-warn { background: #fef3c7; color: #92400e; }
.chip-ok { background: #dcfce7; color: #166534; }

/* ---------- Timeline (inspections) ---------- */
.timeline {
    list-style: none;
    padding: 0 0 0 8px; /* inner shift so dots aren't clipped by the section body padding */
    margin: 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    padding: 12px 12px 12px 38px;
    border-bottom: 1px dashed #f1f5f9;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
    position: absolute;
    left: 10px;
    top: 18px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent, #3b82f6);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #cbd5e1;
}

.timeline-item.oos .timeline-dot {
    background: #dc2626;
    box-shadow: 0 0 0 2px #fecaca;
}

.timeline-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.timeline-date {
    font-weight: 800;
    color: var(--text-main, #0f172a);
    font-size: 13px;
}

.timeline-state {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

.timeline-meta span::before {
    content: '•';
    margin-right: 6px;
    color: #cbd5e1;
}

.timeline-meta span:first-child::before { content: none; }

/* ---------- Violation groups ---------- */
.viol-group {
    margin-bottom: 20px;
}

.viol-group:last-child { margin-bottom: 0; }

.viol-group h4 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    display: flex;
    align-items: center;
    gap: 10px;
}

.viol-group-count {
    background: #f1f5f9;
    color: var(--text-muted, #64748b);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

/* ---------- Clickable drill-down rows ---------- */
.clickable-row {
    cursor: pointer;
    transition: background 0.12s;
}

tr.clickable-row:hover {
    background: #eff6ff !important;
}

.timeline-item.clickable-row:hover {
    background: #f8fafc;
    border-radius: 6px;
}

.col-action {
    width: 32px;
    color: var(--text-muted, #64748b);
    text-align: center;
}

.timeline-chevron {
    margin-left: auto;
    color: var(--text-muted, #64748b);
    font-size: 12px;
}

/* ---------- Drill-down modal ---------- */
.vin-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    animation: vin-fade-in 0.15s ease;
}

@keyframes vin-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.vin-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 880px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: vin-slide-up 0.2s ease;
}

@keyframes vin-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.vin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.vin-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
}

.vin-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.15s;
}

.vin-modal-close:hover { color: var(--text-main, #0f172a); }

.vin-modal-body {
    padding: 24px 28px 28px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* ---------- Modal content ---------- */
.modal-crash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.modal-crash-date {
    font-size: 14px;
    color: var(--text-muted, #64748b);
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-crash-loc {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.sev-badge {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.sev-fatal { background: #fee2e2; color: #991b1b; }
.sev-injury { background: #ffedd5; color: #9a3412; }
.sev-tow { background: #e0e7ff; color: #3730a3; }

.modal-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .modal-metrics { grid-template-columns: repeat(2, 1fr); }
}

.modal-metric {
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.modal-metric-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    line-height: 1;
    margin-bottom: 6px;
}

.modal-metric-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #64748b);
}

.text-danger { color: #dc2626 !important; }
.text-warning { color: #c2410c !important; }

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

@media (max-width: 700px) {
    .modal-grid { grid-template-columns: 1fr; }
}

.modal-section h4 {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #64748b);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 13px;
    gap: 12px;
}

.info-row:last-child { border-bottom: none; }

.info-label {
    color: var(--text-muted, #64748b);
    font-weight: 600;
    flex-shrink: 0;
}

.info-value {
    font-weight: 700;
    color: var(--text-main, #0f172a);
    text-align: right;
    word-break: break-word;
}

.info-value.mono {
    font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
    font-size: 12px;
    letter-spacing: 0.03em;
}

.modal-actions {
    margin-top: 20px;
    text-align: right;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--accent, #3b82f6);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    transition: background 0.15s;
}

.modal-btn:hover { background: var(--accent-dark, #2563eb); }

/* ---------- OOS Yes / No pill ---------- */
.oos-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.oos-pill.oos-yes { background: #fee2e2; color: #991b1b; }
.oos-pill.oos-no  { background: #dcfce7; color: #166534; }

/* ---------- Violation secondary lines (sequence / severity / raw desc) ---------- */
.viol-meta {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #64748b);
}

.viol-raw-desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted, #64748b);
    font-style: italic;
}

/* ---------- Carrier history rows ---------- */
.carriers-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.carrier-history-row {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s, border-color 0.12s;
}

.carrier-history-row:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.carrier-history-dot {
    font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    letter-spacing: 0.04em;
}

.carrier-history-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    line-height: 1.2;
}

.carrier-history-meta {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin-top: 2px;
}

.carrier-history-badge {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    white-space: nowrap;
}

.carrier-history-badge.prev {
    background: #f1f5f9;
    color: var(--text-muted, #64748b);
}

@media (max-width: 600px) {
    .carrier-history-row { grid-template-columns: 1fr auto; }
    .carrier-history-dot { grid-column: 1 / -1; }
}
