/**
 * Emex Cars — Global Styles
 * Base, Reset, Botones, Formularios, Grid, Utilidades
 */

/* === Base & Reset === */
.emex-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: var(--emex-font-main);
    color: var(--emex-coffee-beam);
}

/* Fondo principal (Se recomienda aplicar al body del tema, pero lo forzamos aquí para contenedores) */
.emex-bg-seashell {
    background-color: var(--emex-seashell);
}

/* === Botones (Interacción Principal) === */
.emex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--emex-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--emex-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CTA Principal (Acción) */
.emex-btn-primary {
    background-color: var(--emex-punch-red);
    color: var(--emex-white);
    box-shadow: 0 4px 12px rgba(238, 33, 57, 0.3);
}

.emex-btn-primary:hover {
    background-color: #d61c32; /* Un poco más oscuro */
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(238, 33, 57, 0.4);
}

/* CTA Secundario (Elegancia) */
.emex-btn-secondary {
    background-color: var(--emex-night-bordeaux);
    color: var(--emex-white);
}

.emex-btn-secondary:hover {
    background-color: #3a040a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76, 6, 14, 0.3);
}

/* Botón Outline (Filtros, acciones terciarias) */
.emex-btn-outline {
    background-color: transparent;
    border: 2px solid var(--emex-gray-olive);
    color: var(--emex-coffee-beam);
}

.emex-btn-outline:hover {
    border-color: var(--emex-night-bordeaux);
    color: var(--emex-night-bordeaux);
    background-color: rgba(151, 143, 132, 0.1);
}

/* === Tarjetas Base === */
.emex-card {
    background-color: var(--emex-white);
    border-radius: var(--emex-radius-md);
    overflow: hidden;
    box-shadow: var(--emex-shadow-sm);
    transition: var(--emex-transition);
    position: relative;
    border: 1px solid rgba(0,0,0,0.02);
}

.emex-card:hover {
    box-shadow: var(--emex-shadow-hover);
    transform: translateY(-4px);
}

/* Etiquetas flotantes (ej. Precio, Estado) */
.emex-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--emex-night-bordeaux);
    color: var(--emex-white);
    padding: 6px 12px;
    border-radius: var(--emex-radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
    backdrop-filter: blur(4px); /* Efecto cristal moderno */
}

/* === Formularios Modernos === */
.emex-form-group {
    margin-bottom: 20px;
}

.emex-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--emex-night-bordeaux);
    font-size: 0.9rem;
}

.emex-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E0E0E0; /* Gris muy suave neutral */
    border-radius: var(--emex-radius-sm);
    background-color: var(--emex-white);
    font-size: 1rem;
    color: var(--emex-coffee-beam);
    transition: var(--emex-transition);
    /* El input no puede ser más ancho que su padre */
    max-width: 100%; 
    box-sizing: border-box; /* Vital para que el padding no sume al ancho */
}

.emex-input:focus {
    outline: none;
    border-color: var(--emex-night-bordeaux);
    box-shadow: 0 0 0 4px rgba(76, 6, 14, 0.1); /* Focus ring elegante */
}

/* === Utilidades de Grid Responsivo === */
.emex-grid {
    display: grid;
    grid-template-columns: 1fr; /* Móvil: 1 columna */
    gap: 24px;
}

@media (min-width: 768px) {
    .emex-grid {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columnas */
    }
}

@media (min-width: 1024px) {
    .emex-grid {
        grid-template-columns: repeat(3, 1fr); /* Desktop: 3 columnas */
    }
}

/* Animación de carga (Skeleton) */
@keyframes emex-pulse {
    0% { background-color: #eee; }
    50% { background-color: #ddd; }
    100% { background-color: #eee; }
}
.emex-skeleton {
    animation: emex-pulse 1.5s infinite ease-in-out;
    border-radius: var(--emex-radius-sm);
}

/* === SOLUCIÓN DESBORDAMIENTO Y MÁRGENES (Global Fixes) === */

/* 1. Evitar scroll horizontal por el buscador */
body {
    overflow-x: hidden; /* Seguridad extra */
}

/* Contenedor del Catálogo y Contenido General */
.emex-public-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    /* ESTO ES LO QUE FALTABA: Padding en escritorio también */
    padding: 0 40px !important; 
    box-sizing: border-box;
    width: 100%;
}

/* 2. Márgenes en Móvil para las tarjetas */
@media (max-width: 768px) {
    .emex-public-wrapper {
        /* Padding lateral generoso en móvil */
        padding: 20px 20px !important; 
        width: 100%;
        box-sizing: border-box;
    }
    
    .emex-grid {
        /* Asegurar que el grid respete el padding del padre */
        width: 100%;
        margin: 0;
        gap: 20px; /* Espacio entre tarjetas verticales */
    }
    
    .emex-card {
        /* Asegurar que la tarjeta no se salga */
        width: 100%;
        box-sizing: border-box;
    }
}
