/* ==========================================================================
   1. VARIABLES Y TEMA OSCURO (NEGRO, GRIS Y MORADO)
   ========================================================================== */
:root {
    /* Paleta Morada / Violeta */
    --purple-primary: #a855f7;       /* Púrpura brillante */
    --purple-light: #c084fc;         /* Lavanda suave */
    --purple-dark: #7e22ce;          /* Violeta profundo */
    --purple-glow: rgba(168, 85, 247, 0.4);

    /* Escala de Negros y Grises */
    --bg-dark-black: #09090b;        /* Negro fondo principal */
    --bg-surface-gray: #121217;      /* Gris grafito para tarjetas */
    --bg-elevated: #18181f;          /* Gris ligeramente elevado */
    --border-gray: #27272a;          /* Bordes gris neutro */
    --border-gray-hover: #3f3f46;

    /* Textos */
    --text-primary: #f4f4f5;         /* Blanco roto / legible */
    --text-secondary: #a1a1aa;       /* Gris medio */
    --text-muted: #71717a;

    /* Utilidades */
    --radius: 12px;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 10px 30px -5px rgba(147, 51, 234, 0.35);
    --touch-size: 48px;
}

/* Propiedad para rotar el gradiente animado en CSS */
@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotarBordeMorado {
    to {
        --angle: 360deg;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark-black);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   2. CONTENEDORES Y TIPOGRAFÍA
   ========================================================================== */
.container {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    margin: 0 auto;
}

.section-padding {
    padding-top: 56px;
    padding-bottom: 56px;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}

/* ==========================================================================
   3. BOTONES E INPUTS TÁCTILES
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-size);
    padding: 0 20px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
    color: #ffffff;
    box-shadow: 0 4px 15px var(--purple-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--purple-light), var(--purple-primary));
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
}

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-gray);
}

.btn-secondary:hover {
    background-color: var(--border-gray);
    border-color: var(--purple-primary);
    color: var(--purple-light);
}

.btn-outline {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
    border-color: var(--purple-light);
    color: var(--purple-light);
    background-color: rgba(168, 85, 247, 0.08);
}

input, select {
    width: 100%;
    height: var(--touch-size);
    padding: 0 14px;
    font-size: 16px;
    border: 1px solid var(--border-gray);
    border-radius: var(--radius);
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

/* ==========================================================================
   HEADER FLOTANTE Y REDONDEADO (ESTILO PÍLDORA)
   ========================================================================== */
.header {
    position: sticky;
    top: 12px;                  /* Separado de la parte superior */
    z-index: 1000;
    max-width: 95%;             /* No toca los bordes de la pantalla */
    margin: 0 auto;
    background-color: rgba(18, 18, 23, 0.75); /* Cristal oscuro traslúcido */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(168, 85, 247, 0.25); /* Toque morado sutil */
    border-radius: 50px;        /* Bordes completamente curvados */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.15);
    transition: all 0.3s ease;
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    padding: 0 20px;
}

.logo {
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--purple-primary);
    text-shadow: 0 0 12px var(--purple-glow);
}

.menu-toggle {
    display: none;
}

.menu-button {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 1001;
}

.menu-button .bar {
    height: 2px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 2px;
    transition: 0.3s ease;
}

.nav-menu {
    position: fixed;
    top: 76px;                  /* Espacio respecto al header flotante */
    left: 5%;
    width: 90%;
    height: auto;
    max-height: calc(100vh - 100px);
    background-color: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-gray);
    border-radius: 24px;        /* Menú móvil también redondeado */
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
}

/* Mostrar menú móvil al abrir */
.menu-toggle:checked ~ .nav-menu {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.menu-toggle:checked + .menu-button .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.menu-toggle:checked + .menu-button .bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle:checked + .menu-button .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-surface-gray);
    color: var(--purple-light);
}

.nav-cta-box {
    margin-top: 24px;
}

/* ==========================================================================
   5. HERO SECTION
   ========================================================================== */
.hero {
    position: relative;
    background: radial-gradient(circle at 50% 15%, rgba(168, 85, 247, 0.28), transparent 65%),
                linear-gradient(rgba(9, 9, 11, 0.75), rgba(9, 9, 11, 0.95)), 
                url('https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1200&q=80') center/cover no-repeat;
    color: #ffffff;
    padding: 70px 0 100px;
    text-align: center;
    
    /* Curva orgánica en la base: 0 en la parte superior, 40px o curva elíptica abajo */
    border-bottom-left-radius: 50% 30px;
    border-bottom-right-radius: 50% 30px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.hero-tag {
    display: inline-block;
    background-color: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: var(--purple-light);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 18px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 14px;
}

.hero p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 26px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   6. BUSCADOR RÁPIDO (MÓVIL)
   ========================================================================== */
.search-section {
    margin-top: -30px;
    position: relative;
    z-index: 10;
}

.search-card {
    background-color: var(--bg-surface-gray);
    padding: 24px 28px;
    border-radius: 36px; /* <-- Bordes bien redondeados estilo píldora/cápsula */
    box-shadow: var(--shadow-md), 0 0 25px rgba(168, 85, 247, 0.12); /* Sutil aura morada */
    border: 1px solid rgba(168, 85, 247, 0.25);
    backdrop-filter: blur(10px);
}

.search-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #ffffff;
}

.search-form select {
    border-radius: 20px;
    padding: 0 18px;
}

.search-form .btn-search {
    border-radius: 25px;
}

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

/* ==========================================================================
   7. TARJETAS DE COCHES CON BORDE DINÁMICO MULTICOLOR / MORADO
   ========================================================================== */
.car-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.car-card {
    position: relative;
    border-radius: var(--radius);
    background: var(--bg-surface-gray);
    box-shadow: var(--shadow-md);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid var(--border-gray);
}

/* Borde dinámico animado (conic gradient) */
.car-card::before {
    content: "";
    position: absolute;
    inset: -2px; /* Grosor del borde */
    border-radius: calc(var(--radius) + 2px);
    background: conic-gradient(
        from var(--angle),
        #a855f7, /* Morado vibrante */
        #3b82f6, /* Azul neón */
        #ec4899, /* Fucsia / Rosa */
        #6366f1, /* Índigo */
        #c084fc, /* Lavanda brillante */
        #a855f7
    );
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Capa que mantiene el fondo oscuro para el texto y contenido */
.car-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: var(--bg-surface-gray);
    z-index: 1;
}

/* Contenido por encima del degradado */
.car-card .car-media,
.car-card .car-body {
    position: relative;
    z-index: 2;
}

/* Activación al pasar el ratón o con focus */
.car-card:hover,
.car-card:focus-within {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: transparent;
}

.car-card:hover::before,
.car-card:focus-within::before {
    opacity: 1;
    animation: rotarBordeMorado 3s linear infinite;
}

.car-media {
    position: relative;
    height: 210px;
    background-color: var(--bg-elevated);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    overflow: hidden;
}

.car-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.95);
    transition: transform 0.3s ease;
}

.car-card:hover .car-media img {
    transform: scale(1.03);
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    color: #ffffff;
    backdrop-filter: blur(8px);
}

.badge-primary { background-color: rgba(168, 85, 247, 0.85); }
.badge-accent { background-color: rgba(13, 148, 136, 0.85); }
.badge-secondary { background-color: rgba(24, 24, 31, 0.85); border: 1px solid var(--border-gray); }

.car-body {
    padding: 18px;
}

.car-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}

.car-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.car-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-gray);
}

.price-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--purple-light);
}

/* ==========================================================================
   8. SECCIÓN VENDER COCHE
   ========================================================================== */
.sell-section {
    background: linear-gradient(180deg, var(--bg-dark-black) 0%, #151022 50%, var(--bg-dark-black) 100%);
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
    padding: 56px 0;
}

.sell-wrapper {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.highlight-badge {
    display: inline-block;
    color: var(--purple-light);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sell-info h2 {
    font-size: 1.7rem;
    line-height: 1.25;
    margin-bottom: 12px;
    color: #ffffff;
}

.sell-info p {
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.check-list li::before {
    content: "✓ ";
    color: var(--purple-light);
    font-weight: bold;
    margin-right: 6px;
}

.sell-card {
    background-color: var(--bg-surface-gray);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-gray);
}

.sell-card h3 {
    font-size: 1.2rem;
    color: #ffffff;
    margin-bottom: 16px;
}

.sell-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   9. VENTAJAS (CARDS OSCURAS CON HOVER)
   ========================================================================== */
.features-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-card {
    background-color: var(--bg-surface-gray);
    padding: 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border-gray);
    text-align: center;
    transition: border-color 0.25s, transform 0.25s;
}

.feature-card:hover {
    border-color: var(--purple-primary);
    transform: translateY(-3px);
}

.feature-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 1.15rem;
    color: #ffffff;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================================================
   10. BOTÓN FLOTANTE MÓVIL
   ========================================================================== */
.floating-contact {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #044cc0, #128c7e);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

/* ==========================================================================
   11. FOOTER (TEMA OSCURO)
   ========================================================================== */
.footer {
    background-color: #050507;
    color: var(--text-secondary);
    padding-top: 48px;
    border-top: 1px solid var(--border-gray);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.footer-brand .logo {
    color: #ffffff;
    display: inline-block;
    margin-bottom: 8px;
}

.footer h4 {
    color: #ffffff;
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--purple-light);
}

.footer-bottom {
    margin-top: 36px;
    padding: 20px 0 80px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   12. TABLETS & PANTALLAS MEDIANAS (min-width: 640px)
   ========================================================================== */
@media (min-width: 640px) {
    .hero h1 {
        font-size: 2.35rem;
    }

    .hero-actions {
        flex-direction: row;
        justify-content: center;
    }

    .hero-actions .btn {
        width: auto;
    }

    .car-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .features-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* ==========================================================================
   13. ESCRITORIO (min-width: 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .section-padding {
        padding-top: 80px;
        padding-bottom: 80px;
    }

    .menu-button {
        display: none;
    }

    /* --- AQUÍ ENTRAN TUS REGLAS DEL HEADER Y NAV --- */
    .header {
        max-width: 1100px;
        top: 18px;
    }

    .nav-menu {
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        border: none;
        box-shadow: none;
        background-color: transparent;
        padding: 0;
        max-height: none;
        height: auto;
        width: auto;
        flex-direction: row;
        align-items: center;
        overflow-y: visible;
        gap: 32px;
    }

    .nav-list {
        flex-direction: row;
        gap: 24px;
    }

    .nav-link {
        padding: 0;
        font-size: 0.95rem;
    }

    .nav-cta-box {
        margin-top: 0;
    }

    /* --- AQUÍ ENTRA TU REGLA DEL HERO --- */
    .hero {
        padding: 100px 0 130px;
        border-bottom-left-radius: 50% 60px;
        border-bottom-right-radius: 50% 60px;
    }

    .hero h1 {
        font-size: 3rem;
        max-width: 820px;
        margin-left: auto;
        margin-right: auto;
    }

    .hero p {
        max-width: 650px;
        margin-left: auto;
        margin-right: auto;
    }

    .search-card {
        padding: 24px 30px;
    }

    .search-form {
        flex-direction: row;
        align-items: flex-end;
    }

    .search-form .form-group {
        flex: 1;
    }

    .btn-search {
        width: auto;
        padding-left: 28px;
        padding-right: 28px;
    }

    .car-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }

    .sell-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 60px;
    }

    .sell-info, .sell-card {
        flex: 1;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }

    .footer-brand {
        max-width: 380px;
    }

    .footer-bottom {
        padding-bottom: 24px;
    }

    .floating-contact {
        display: none;
    }
    .search-card {
        border-radius: 50px;       /* Cápsula completa en pantallas grandes */
        padding: 16px 32px;
    }

    .search-form select {
        border-radius: 30px;
    }

    .search-form .btn-search {
        border-radius: 30px;
        height: var(--touch-size);  /* Misma altura alineada con los selects */
    }
}
