:root {
    /* Black & Chrome palette */
    --black: #0a0a0a;
    --black-light: #1a1a1a;
    --black-soft: #2a2a2a;
    --chrome: #c0c0c0;
    --chrome-light: #e8e8e8;
    --chrome-dark: #888888;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #e0e0e0;
    --bg: #fafafa;
    --accent: #0a0a0a;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ============ NAV ============ */
.nav {
    background: var(--white);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
}

.brand-detect {
    color: var(--black);
    background: linear-gradient(90deg, var(--black) 0%, var(--chrome-dark) 50%, var(--black) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: chrome-shimmer 3s linear infinite;
}

@keyframes chrome-shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.brand-dot {
    color: var(--chrome);
    font-weight: 800;
    margin: 0 1px;
}

.brand-autos {
    color: var(--chrome-dark);
    font-weight: 500;
}

.sign-in-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sign-in-btn:hover {
    background: var(--black-soft);
}

.sign-in-btn svg { width: 16px; height: 16px; }

/* ============ MAIN ============ */
.main {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    text-align: center;
    padding: 4rem 1rem 2rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--black);
    margin-bottom: 0.75rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============ ACTION HUB ============ */
.action-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
}

.action-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--black);
    border: 3px solid var(--chrome);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    border-color: var(--chrome-light);
}

.action-btn.active {
    background: var(--white);
    border-color: var(--black);
}

.action-btn.active .action-icon {
    transform: rotate(45deg);
    stroke: var(--black);
}

.action-icon {
    color: var(--white);
    transition: all 0.3s;
}

.action-options {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.action-options.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.action-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 2rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-option:hover {
    border-color: var(--black);
    box-shadow: var(--shadow-lg);
}

.action-option svg { color: var(--black); }
.action-option span { font-size: 0.875rem; font-weight: 600; color: var(--text); }

/* ============ CAPTURE PANEL ============ */
.capture-panel {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.capture-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4/3;
    background: var(--black-light);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--black-soft);
}

.capture-container video,
.capture-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--black);
}

.capture-container img { display: none; }
.capture-container img.visible { display: block; }

.capture-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
}

.capture-overlay.visible { display: flex; }

/* Search mode buttons */
.search-mode-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90%;
    max-width: 320px;
}

.search-mode-buttons.hidden { display: none; }

.search-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.search-mode-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.search-mode-btn.primary {
    background: var(--go-blue);
    border-color: var(--go-blue);
}

.search-mode-btn.primary:hover {
    background: #0095c7;
}

/* Similarity badge on vehicle cards */
.similarity-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,172,215,0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Visual feature tags */
.tag.vibe { background: #9333ea; color: white; }
.tag.color { background: #6b7280; color: white; }
.tag.design { background: #059669; color: white; }

.capture-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--white);
}

.capture-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
}

.capture-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--chrome);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: all 0.2s;
}

.capture-action-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--white);
}

.capture-action-btn.primary {
    background: var(--white);
    border-color: var(--white);
    color: var(--black);
}

/* ============ SEARCH PANEL ============ */
.search-panel {
    max-width: 600px;
    margin: 0 auto;
    animation: slideUp 0.3s ease;
}

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

.search-container {
    display: flex;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.search-container input {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-container input::placeholder { color: var(--text-muted); }

.search-btn {
    padding: 1.25rem 1.5rem;
    background: var(--black);
    border: none;
    cursor: pointer;
    color: var(--white);
    transition: background 0.2s;
}

.search-btn:hover { background: var(--black-soft); }

.search-options {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.radius-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.radius-label input {
    width: 50px;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    justify-content: center;
}

.suggestion-chip {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    border-color: var(--black);
    background: var(--black);
    color: var(--white);
}

/* ============ RESULTS ============ */
.results-section {
    margin-top: 2rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.identified-bar {
    background: var(--white);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
}

.identified-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.identified-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
    padding: 0.375rem 0.75rem;
    background: var(--black);
    color: var(--white);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.map-container {
    position: relative;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

#map { width: 100%; height: 100%; }

.dealer-count {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--black);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.results-header h2 { font-size: 1.25rem; font-weight: 600; }
.results-count { font-size: 0.875rem; color: var(--text-muted); }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ============ VEHICLE CARD ============ */
.vehicle-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.vehicle-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--chrome);
}

.vehicle-card .image {
    height: 200px;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center;
}

.vehicle-card .details { padding: 1.25rem; }

.vehicle-card .title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.vehicle-card .subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.vehicle-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 0.75rem;
}

.vehicle-card .meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.vehicle-card .dealer {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ============ ALTERNATIVES ============ */
.alternatives {
    text-align: center;
    padding: 2rem;
    background: var(--white);
    border-radius: 12px;
    margin-top: 1.5rem;
    box-shadow: var(--shadow);
}

.alternatives p { color: var(--text-muted); margin-bottom: 1rem; }

.alt-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }

.alt-chip {
    padding: 0.5rem 1rem;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.alt-chip:hover {
    background: var(--chrome-dark);
}

/* ============ LOADING ============ */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--black);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--black);
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

.modal-image {
    height: 280px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
}

.modal-body { padding: 1.5rem; }
.modal-body h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.modal-subtitle { color: var(--text-muted); margin-bottom: 1rem; }

.modal-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 1.25rem;
}

.modal-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 10px;
}

.modal-details .detail { text-align: center; }

.modal-details .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-dealer {
    background: var(--bg);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.modal-dealer h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.modal-dealer p { font-size: 0.875rem; color: var(--text-muted); }

.modal-actions { display: flex; gap: 0.75rem; }

.modal-btn {
    flex: 1;
    padding: 0.875rem;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.modal-btn.primary {
    background: var(--black);
    color: var(--white);
}

.modal-btn:not(.primary) {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
}

.toast {
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--black);
    animation: slideIn 0.3s ease;
}

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

.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }

/* ============ FOOTER ============ */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ============ UPLOAD PREVIEW ============ */
.upload-preview {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 500;
    animation: slideInRight 0.3s ease;
}

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

.upload-preview-card {
    position: relative;
    width: 220px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 2px solid var(--black);
}

.upload-preview-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.upload-preview-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.upload-preview-close:hover {
    background: rgba(0,0,0,0.8);
}

.upload-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--black);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 2.5rem 1rem 1.5rem; }
    .action-btn { width: 64px; height: 64px; }
    .action-options { flex-direction: column; width: 100%; max-width: 200px; }
    .action-option { flex-direction: row; justify-content: flex-start; padding: 1rem; }
    .results-grid { grid-template-columns: 1fr; }
    .vehicle-card .image { height: 180px; }
    .modal-details { grid-template-columns: 1fr; }
    .modal-actions { flex-direction: column; }
}

@media (min-width: 768px) {
    .nav { padding: 1rem 2rem; }
    .main { padding: 1.5rem 2rem; }
}
