/* ═══════════════════════════════════════════
   AutaDo100k – Web Style
   Dark navy automotive theme
   ═══════════════════════════════════════════ */

:root {
    --bg: #080e1a;
    --bg-lighter: #0c1526;
    --card-bg: #111d33;
    --card-border: #1e3050;
    --accent: #4CAF50;
    --accent-dark: #1B5E20;
    --accent-glow: rgba(76, 175, 80, 0.15);
    --text: #FFFFFF;
    --text-secondary: #8899b0;
    --text-muted: #4a5c75;
    --gold: #FFD700;
    --orange: #FF9800;
    --red: #FF5722;
    --blue: #1E88E5;
    --navy: #1a2744;
    --navy-light: #243556;
    --max-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.text-green { color: var(--accent); }

/* ── Header ── */
.header {
    background: linear-gradient(180deg, #0f1b30, #0c1526);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    background: var(--navy);
    border-radius: 12px;
    padding: 2px;
    border: 1px solid var(--navy-light);
}

.logo h1 {
    font-size: 22px;
    color: var(--text);
    line-height: 1.2;
    font-weight: 800;
}

.tagline {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Auth Area ── */
.auth-area {
    display: flex;
    align-items: center;
}

.auth-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.auth-input {
    background: var(--navy);
    border: 1px solid var(--navy-light);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    width: 160px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-input:focus {
    border-color: var(--accent);
}

.auth-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.auth-btn-login {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.25);
}

.auth-btn-login:hover {
    background: #66BB6A;
}

.auth-btn-register {
    background: var(--navy-light);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
}

.auth-btn-register:hover {
    background: var(--navy);
    color: white;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-email-display {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.auth-btn-logout {
    background: rgba(255, 87, 34, 0.15);
    color: var(--red);
    border: 1px solid rgba(255, 87, 34, 0.3);
}

.auth-btn-logout:hover {
    background: rgba(255, 87, 34, 0.3);
}

.auth-forgot {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
    align-self: center;
}

.auth-forgot:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ── Hero Banner ── */
.hero {
    display: flex;
    justify-content: center;
    background: var(--bg);
    padding: 0 16px;
}

.hero-image {
    width: 100%;
    max-width: var(--max-width);
    height: auto;
    display: block;
    border-radius: 12px;
    object-fit: contain;
}

/* ── Filters ── */
.filters {
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--card-border);
}

.filters-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 8px 16px 12px;
}

.filter-toggle {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-dark), #2E7D32);
    color: #a5d6a7;
    border: 1px solid var(--accent);
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(76, 175, 80, 0.15);
}

.filter-toggle:hover {
    background: #2E7D32;
}

.filter-panel {
    display: none;
    padding-top: 12px;
}

.filter-panel.open {
    display: block;
}

.filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px;
    background: #0c1526;
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 14px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.btn-filter {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.btn-filter:hover {
    background: #66BB6A;
}

.btn-reset {
    padding: 10px 16px;
    background: var(--navy);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.btn-reset:hover {
    background: var(--navy-light);
    color: white;
}

/* ── Stats Bar ── */
.stats-bar {
    background: var(--bg);
    border-bottom: 1px solid var(--card-border);
}

.stats-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.sort-label select {
    background: #0c1526;
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
}

/* ── Listings Grid ── */
.listings {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ── Loading Spinner ── */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Car Card ── */
.car-card {
    background: linear-gradient(160deg, var(--card-bg), #0e1a2e);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 150, 220, 0.05);
    border-color: #2a4a70;
}

.car-card.is-top {
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.12);
}

.car-card.is-sold {
    opacity: 0.6;
}

.car-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #060d1a;
}

.car-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.car-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #0a1424;
}

.badge-top {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--gold);
    color: #333;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

.badge-sold {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--red);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

.photo-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.car-info {
    padding: 14px;
}

.car-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 6px;
}

.car-price {
    font-size: 22px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 8px;
}

.car-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.spec-tag {
    background: #0c1a2e;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid #1a2d4a;
}

.car-location {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    margin: 20px auto;
    position: relative;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Modal detail content */
.detail-gallery {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    background: #060d1a;
}

.detail-gallery img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #060d1a;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.gallery-nav:hover {
    background: rgba(0,0,0,0.9);
}

.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }

.gallery-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.detail-body {
    padding: 24px;
}

.detail-title {
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 4px;
}

.detail-price {
    font-size: 28px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 16px;
}

.detail-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.detail-spec {
    background: #0c1a2e;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #1a2d4a;
}

.detail-spec-label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-spec-value {
    font-size: 15px;
    font-weight: 600;
}

.detail-description {
    margin-bottom: 20px;
    padding: 16px;
    background: #0c1a2e;
    border-radius: 10px;
    white-space: pre-wrap;
    color: var(--text-secondary);
    line-height: 1.6;
    border: 1px solid #1a2d4a;
}

.detail-contact {
    background: var(--accent-dark);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 20px;
}

.detail-contact h3 {
    margin-bottom: 12px;
    color: var(--accent);
}

.contact-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.contact-btn {
    flex: 1;
    min-width: 160px;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    transition: opacity 0.2s;
}

.contact-btn:hover {
    opacity: 0.85;
}

.contact-phone {
    background: var(--accent);
    color: white;
}

.contact-email {
    background: var(--blue);
    color: white;
}

/* ── Footer ── */
.footer {
    background: linear-gradient(180deg, var(--bg), #060a14);
    border-top: 1px solid var(--card-border);
    margin-top: 40px;
    padding: 24px 16px;
    text-align: center;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer p {
    color: var(--text-muted);
    font-size: 13px;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--accent);
}

/* ── No results ── */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 18px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .logo {
        justify-content: center;
    }

    .auth-form {
        justify-content: center;
        width: 100%;
    }

    .auth-input {
        width: 100%;
    }

    .auth-btn {
        flex: 1;
    }

    .auth-user {
        justify-content: center;
        width: 100%;
    }

    .filter-row {
        flex-direction: column;
    }

    .listings {
        grid-template-columns: 1fr;
    }

    .detail-gallery {
        height: 260px;
    }

    .detail-specs {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-inner {
        flex-direction: column;
        gap: 8px;
    }

    .form-row {
        flex-direction: column;
    }
}

/* ── Profile Button ── */
.auth-btn-profile {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.25);
}

.auth-btn-profile:hover {
    background: #66BB6A;
}

/* ── Profile Section ── */
.profile-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
}

.profile-inner {
    max-width: 800px;
    margin: 0 auto;
}

.back-btn {
    background: none;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--navy);
    color: white;
}

.profile-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.profile-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.profile-card p {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 6px 0;
}

.profile-separator {
    height: 1px;
    background: var(--card-border);
    margin: 12px 0;
}

.section-title {
    font-size: 20px;
    font-weight: bold;
    margin: 16px 0 12px;
}

.profile-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ── Profile Car Cards ── */
.profile-car-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-car-card:hover {
    border-color: #2a4a70;
    transform: translateY(-2px);
}

.profile-car-card.sold {
    opacity: 0.6;
    border-color: var(--red);
}

.profile-car-card.suspended {
    border-color: var(--orange);
    background: #2E1A00;
}

.profile-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.badge-suspended {
    background: var(--orange);
    color: white;
}

.badge-sold-profile {
    background: var(--red);
    color: white;
}

.badge-top-active {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
}

.profile-car-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}

.profile-car-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.profile-car-views {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.profile-car-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.btn-top {
    background: var(--gold);
    color: #333;
}

.btn-sold {
    background: var(--orange);
    color: white;
}

.btn-edit {
    background: var(--blue);
    color: white;
    min-width: 44px;
}

.btn-delete-car {
    background: #D32F2F;
    color: white;
    min-width: 44px;
}

/* ── Profile Action Buttons ── */
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding-bottom: 40px;
}

.profile-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.profile-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.btn-add {
    background: var(--accent);
    color: white;
}

.btn-browse {
    background: var(--blue);
    color: white;
}

.btn-favorites {
    background: #E91E63;
    color: white;
}

.btn-report {
    background: var(--navy-light);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
}

.btn-logout {
    background: #D32F2F;
    color: white;
}

.btn-delete-account {
    background: #880000;
    color: #FF6666;
}

/* ── Add Car Form ── */
.add-car-form .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.add-car-form .form-group {
    flex: 1;
    min-width: 150px;
}

.add-car-form .form-group.full {
    flex-basis: 100%;
}

.add-car-form label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.add-car-form input,
.add-car-form select,
.add-car-form textarea {
    width: 100%;
    padding: 10px;
    background: var(--navy);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.add-car-form input:focus,
.add-car-form select:focus,
.add-car-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.photos-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.photo-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item button {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
}

/* ── Form Groups in Modals ── */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    background: var(--navy);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.form-actions .profile-btn {
    flex: 1;
}

/* ── Verification Modal ── */
.verify-modal {
    max-width: 440px;
}

.verify-content {
    padding: 32px 24px;
    text-align: center;
}

.verify-content h2 {
    margin-bottom: 16px;
}

.verify-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.verify-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* ── Detail Actions (Favorite + Report) ── */
.detail-user-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.fav-btn-detail,
.report-btn-detail {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--navy);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.fav-btn-detail:hover {
    background: #E91E63;
    color: white;
    border-color: #E91E63;
}

.report-btn-detail:hover {
    background: var(--red);
    color: white;
    border-color: var(--red);
}
