/**
 * Sistema de Clasificados Hispanos
 * CSS Mobile-First - Diseñado para móviles primero
 */

/* ================================================
   CSS Variables & Reset
   ================================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    
    --header-height: 56px;
    --bottom-nav-height: 60px;
    --container-max: 1280px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font-family: inherit; font-size: 16px; -webkit-appearance: none; appearance: none; }
ul, ol { list-style: none; }

/* ================================================
   Container
   ================================================ */
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-4); }

/* ================================================
   Header - MOBILE FIRST
   ================================================ */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-4);
    max-width: var(--container-max);
    margin: 0 auto;
    gap: var(--space-3);
}

.header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--primary);
    flex-shrink: 0;
}

.header__logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
}

.header__logo-text { display: none; }
.header__search { display: none; }

.header__actions { display: flex; align-items: center; gap: var(--space-2); }
.header__lang { display: none; }
.header__lang a { padding: var(--space-2); color: var(--gray-500); font-size: var(--font-size-sm); font-weight: 500; }
.header__lang a.active { color: var(--primary); }

.header__post-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
}
.header__post-btn span { display: none; }

.header__koin-balance {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: var(--radius-full);
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.header__koin-balance:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.header__koin-icon {
    font-size: 1rem;
}

.header__koin-amount {
    font-weight: 700;
}

.header__user { display: flex; align-items: center; gap: var(--space-2); }
.header__user-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); object-fit: cover; border: 2px solid var(--gray-200); }
.header__user-name { display: none; }
.header__mobile-search { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--gray-600); }

/* ================================================
   Header Dropdown Menu
   ================================================ */
.header__dropdown {
    position: relative;
}

.header__dropdown-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1);
    border-radius: var(--radius);
    transition: background var(--transition-fast);
}

.header__dropdown-toggle:hover {
    background: var(--gray-100);
}

.header__dropdown-toggle i {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    transition: transform var(--transition-fast);
}

.header__dropdown.open .header__dropdown-toggle i {
    transform: rotate(180deg);
}

.header__dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 200px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    padding: var(--space-2);
    z-index: 200;
}

.header__dropdown.open .header__dropdown-menu {
    display: block;
}

.header__dropdown-menu a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--gray-700);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    transition: background var(--transition-fast);
}

.header__dropdown-menu a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.header__dropdown-menu a i {
    width: 16px;
    text-align: center;
    color: var(--gray-500);
}

.header__dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: var(--space-2) 0;
}

.header__dropdown-logout {
    color: var(--danger) !important;
}

.header__dropdown-logout:hover {
    background: #fee2e2 !important;
}

.header__dropdown-logout i {
    color: var(--danger) !important;
}

/* ================================================
   Mobile Bottom Navigation
   ================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    height: var(--bottom-nav-height);
    padding-bottom: var(--safe-area-bottom);
    z-index: 100;
    display: flex;
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray-500);
    font-size: var(--font-size-xs);
    padding: var(--space-2) 0;
}

.bottom-nav__item i { font-size: 1.25rem; }
.bottom-nav__item.active, .bottom-nav__item:hover { color: var(--primary); }

.bottom-nav__item--post { position: relative; }
.bottom-nav__item--post i {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -22px;
    box-shadow: var(--shadow-md);
}
.bottom-nav__item--post span { display: none; }

/* ================================================
   Search Overlay (Mobile)
   ================================================ */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    z-index: 200;
    padding: var(--space-4);
    padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
}

.search-overlay.active { display: block; }

.search-overlay__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-overlay__back {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    flex-shrink: 0;
}

.search-overlay__input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    background: var(--gray-50);
    font-size: 16px;
}

.search-overlay__input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}

/* ================================================
   Buttons
   ================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    white-space: nowrap;
    min-height: 44px;
    touch-action: manipulation;
}

.btn--primary { background: var(--primary); color: var(--white); }
.btn--primary:hover, .btn--primary:active { background: var(--primary-dark); }
.btn--secondary { background: var(--gray-200); color: var(--gray-700); }
.btn--secondary:hover { background: var(--gray-300); }
.btn--outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn--outline:hover { background: var(--primary); color: var(--white); }
.btn--danger { background: var(--danger); color: var(--white); }
.btn--success { background: var(--success); color: var(--white); }
.btn--sm { padding: var(--space-2) var(--space-3); font-size: var(--font-size-sm); min-height: 36px; }
.btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--font-size-lg); min-height: 52px; }
.btn--block { width: 100%; }
.btn--icon { width: 44px; height: 44px; padding: 0; }

/* ================================================
   Forms - Touch Optimized
   ================================================ */
.form-group { margin-bottom: var(--space-5); }

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--gray-700);
    font-size: var(--font-size-sm);
}
.form-label--required::after { content: ' *'; color: var(--danger); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-800);
    min-height: 50px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder { color: var(--gray-400); }
.form-input--error { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: var(--font-size-sm); margin-top: var(--space-2); display: block; }
.form-hint { color: var(--gray-500); font-size: var(--font-size-sm); margin-top: var(--space-2); display: block; }
.form-textarea { min-height: 120px; resize: vertical; }

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 44px;
}

.form-checkbox { display: flex; align-items: flex-start; gap: var(--space-3); min-height: 44px; padding: var(--space-2) 0; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.form-checkbox span { color: var(--gray-700); font-size: var(--font-size-sm); line-height: 1.5; }

/* Checkbox Cards (para Gratis/Negociable) */
.checkbox-card { cursor: pointer; }
.checkbox-card input { display: none; }
.checkbox-card__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    min-width: 120px;
    text-align: center;
    transition: all var(--transition-fast);
}
.checkbox-card__box i { font-size: 1.5rem; color: var(--gray-400); }
.checkbox-card__box strong { font-size: var(--font-size-sm); }
.checkbox-card__box small { font-size: var(--font-size-xs); color: var(--gray-500); }
.checkbox-card input:checked + .checkbox-card__box {
    border-color: var(--primary);
    background: var(--primary-light, #EBF5FF);
}
.checkbox-card input:checked + .checkbox-card__box i { color: var(--primary); }
.checkbox-card:hover .checkbox-card__box { border-color: var(--primary); }

/* ================================================
   Cards - Mobile Optimized
   ================================================ */
.card { background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); position: relative; }

.card__image { position: relative; aspect-ratio: 4/3; background: var(--gray-100); overflow: hidden; }
.card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-fast); }
.card:hover .card__image img { transform: scale(1.05); }
.card__image-link { display: block; }

.card__badges { position: absolute; top: var(--space-2); left: var(--space-2); display: flex; flex-wrap: wrap; gap: var(--space-1); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--gray-800);
    color: var(--white);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.badge--featured { background: var(--warning); }
.badge--urgent { background: var(--danger); }

.card__favorite {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    color: var(--gray-400);
    box-shadow: var(--shadow);
    z-index: 10;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}
.card__favorite:hover { transform: scale(1.1); }
.card__favorite:hover, .card__favorite.active { color: var(--danger); }
.card__favorite.active { background: #FEE2E2; }

.card__favorite-count {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

/* Rating Stars en Cards */
.card__rating {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.card__rating .stars {
    display: flex;
    gap: 2px;
}

.card__rating .stars i {
    font-size: 12px;
    color: var(--warning);
}

.card__rating-text {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

/* Rating Input (para votar) */
.rating-input {
    display: flex;
    gap: var(--space-1);
}

.rating-input .star {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--gray-300);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.rating-input .star:hover,
.rating-input .star.hover {
    color: var(--warning);
    transform: scale(1.1);
}

.rating-input .star.active,
.rating-input .star.active i {
    color: var(--warning);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 350px;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--gray-400);
    animation: slideIn 0.3s ease;
}

.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info { border-left-color: var(--info); }

.toast--success i { color: var(--success); }
.toast--error i { color: var(--danger); }
.toast--warning i { color: var(--warning); }
.toast--info i { color: var(--info); }

.toast span { flex: 1; font-size: var(--font-size-sm); }

.toast__close {
    padding: var(--space-1);
    color: var(--gray-400);
    cursor: pointer;
}

.toast__close:hover { color: var(--gray-600); }

.toast--fade {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

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

/* Card no image placeholder */
.card__no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--gray-200);
}

.card__no-image i {
    font-size: 3rem;
    color: var(--gray-400);
}

.card__body { padding: var(--space-4); }
.card__category { font-size: var(--font-size-xs); color: var(--primary); text-transform: uppercase; font-weight: 600; margin-bottom: var(--space-1); }
.card__title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.card__title a { color: inherit; }
.card__price { font-size: var(--font-size-xl); font-weight: 700; color: var(--primary); }
.card__price--free { color: var(--success); }
.card__meta { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-3); font-size: var(--font-size-sm); color: var(--gray-500); }
.card__meta i { margin-right: var(--space-1); }

/* ================================================
   Grid - Mobile First (1 column)
   ================================================ */
.grid { display: grid; gap: var(--space-4); }
.grid--ads { grid-template-columns: 1fr; }
.grid--categories { grid-template-columns: 1fr; }

/* Categorías compactas (chips) */
.section-header-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.section-header-toggle .section-title {
    margin-bottom: 0;
}

.categories-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.3s ease;
}

.categories-wrapper.hidden {
    display: none;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-chip:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-chip:hover i {
    color: var(--white) !important;
}

.category-chip i {
    font-size: var(--font-size-base);
}

.category-chip small {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.category-chip:hover small {
    background: rgba(255,255,255,0.2);
    color: var(--white);
}

/* ================================================
   Hero Search (Estilo anuncioshispanosgratis)
   ================================================ */
.hero-search {
    background: linear-gradient(135deg, #1a2a3a 0%, #2d3e50 100%);
    padding: var(--space-4) 0;
}

.hero-search__header {
    margin-bottom: var(--space-3);
}

.hero-search__publish {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: transparent;
    border: 2px solid #4ecdc4;
    color: #4ecdc4;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.hero-search__publish:hover {
    background: #4ecdc4;
    color: #1a2a3a;
}

.hero-search__publish i {
    font-size: 1.2rem;
}

.hero-search__title {
    color: #4ecdc4;
    font-size: var(--font-size-base);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-3);
    letter-spacing: 1px;
}

.hero-search__form {
    max-width: 900px;
    margin: 0 auto;
}

.hero-search__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.hero-search__field label {
    display: block;
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-1);
    letter-spacing: 0.5px;
}

.hero-search__select,
.hero-search__input {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid #3d5a73;
    border-radius: var(--radius);
    background: #fff;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.hero-search__select:focus,
.hero-search__input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.hero-search__select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.hero-search__search-row {
    display: flex;
    gap: var(--space-2);
}

.hero-search__search-row .hero-search__input {
    flex: 1;
    min-width: 0;
}

.hero-search__btn {
    padding: var(--space-3) var(--space-4);
    background: #4ecdc4;
    border: none;
    border-radius: var(--radius);
    color: #1a2a3a;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.hero-search__btn:hover {
    background: #3dbdb5;
}

/* Tablet y superior */
@media (min-width: 640px) {
    .hero-search {
        padding: var(--space-5) 0;
    }
    
    .hero-search__grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .hero-search__publish {
        font-size: var(--font-size-base);
        padding: var(--space-3) var(--space-5);
    }
    
    .hero-search__title {
        font-size: var(--font-size-lg);
    }
    
    .hero-search__select,
    .hero-search__input {
        padding: var(--space-4);
        font-size: var(--font-size-base);
    }
    
    .hero-search__btn {
        padding: var(--space-4) var(--space-5);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .hero-search__publish i {
        font-size: 1.5rem;
    }
    
    .hero-search__title {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-4);
    }
}

/* ================================================
   Hero Section - Mobile First
   ================================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: var(--space-8) var(--space-4);
    text-align: center;
}

.hero__title { font-size: var(--font-size-xl); font-weight: 700; margin-bottom: var(--space-2); line-height: 1.3; }
.hero__subtitle { font-size: var(--font-size-sm); opacity: 0.9; margin-bottom: var(--space-6); }

.hero__search { background: var(--white); border-radius: var(--radius-lg); padding: var(--space-3); box-shadow: var(--shadow-lg); }
.hero__search-input { width: 100%; padding: var(--space-4); border: none; border-radius: var(--radius); font-size: var(--font-size-base); margin-bottom: var(--space-3); background: var(--gray-50); }
.hero__search-input:focus { outline: none; background: var(--white); }
.hero__search-btn { width: 100%; }

/* ================================================
   Categories Section
   ================================================ */
.section { padding: var(--space-6) 0; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.section-title { font-size: var(--font-size-lg); font-weight: 700; color: var(--gray-800); }
.section-link { font-size: var(--font-size-sm); font-weight: 500; }

.category-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-height: 70px; }
.category-card__icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); font-size: var(--font-size-lg); flex-shrink: 0; }
.category-card__info { flex: 1; min-width: 0; }
.category-card__name { font-weight: 600; color: var(--gray-800); font-size: var(--font-size-sm); }
.category-card__count { font-size: var(--font-size-xs); color: var(--gray-500); }

/* ================================================
   Alerts & Flash Messages
   ================================================ */
.alert { padding: var(--space-4); border-radius: var(--radius); margin-bottom: var(--space-4); display: flex; align-items: flex-start; gap: var(--space-3); }
.alert--success { background: #dcfce7; color: #166534; }
.alert--error { background: #fee2e2; color: #991b1b; }
.alert--warning { background: #fef3c7; color: #92400e; }
.alert__close { margin-left: auto; color: inherit; opacity: 0.7; }

.flash-messages { position: fixed; top: calc(var(--header-height) + var(--space-4)); left: var(--space-4); right: var(--space-4); z-index: 150; }

/* ================================================
   Empty State
   ================================================ */
.empty-state { text-align: center; padding: var(--space-10) var(--space-4); }
.empty-state__icon { font-size: 3rem; color: var(--gray-300); margin-bottom: var(--space-4); }
.empty-state__title { font-size: var(--font-size-lg); font-weight: 600; color: var(--gray-800); margin-bottom: var(--space-2); }
.empty-state__text { color: var(--gray-500); margin-bottom: var(--space-6); }

/* ================================================
   Pagination
   ================================================ */
.pagination { display: flex; justify-content: center; align-items: center; gap: var(--space-2); margin-top: var(--space-6); flex-wrap: wrap; }
.pagination__link, .pagination__current { display: flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 var(--space-3); border-radius: var(--radius); font-weight: 500; }
.pagination__link { color: var(--gray-600); background: var(--white); border: 1px solid var(--gray-200); }
.pagination__current { background: var(--primary); color: var(--white); }

/* ================================================
   Footer - Mobile First
   ================================================ */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: var(--space-8) var(--space-4) calc(var(--space-8) + var(--bottom-nav-height));
}

.footer__logo { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-lg); font-weight: 700; color: var(--white); margin-bottom: var(--space-4); }
.footer__section { margin-bottom: var(--space-6); }
.footer__section h4 { color: var(--white); font-size: var(--font-size-sm); margin-bottom: var(--space-3); }
.footer__links { display: flex; flex-direction: column; gap: var(--space-2); }
.footer__links a { color: var(--gray-400); font-size: var(--font-size-sm); padding: var(--space-1) 0; }
.footer__bottom { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--gray-800); text-align: center; font-size: var(--font-size-xs); color: var(--gray-500); }

/* ================================================
   Auth Pages
   ================================================ */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 0; }
.auth-container { flex: 1; display: flex; flex-direction: column; padding: var(--space-6) var(--space-4); }
.auth-header { text-align: center; margin-bottom: var(--space-6); }
.auth-header__logo { display: flex; align-items: center; justify-content: center; gap: var(--space-2); font-size: var(--font-size-xl); font-weight: 700; color: var(--primary); margin-bottom: var(--space-4); }
.auth-header__title { font-size: var(--font-size-2xl); font-weight: 700; color: var(--gray-800); margin-bottom: var(--space-2); }
.auth-header__subtitle { color: var(--gray-500); }
.auth-form { background: var(--white); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow); }
.auth-footer { text-align: center; padding: var(--space-6) 0; color: var(--gray-500); }
.auth-footer a { font-weight: 500; }

/* ================================================
   TABLET (640px)
   ================================================ */
@media (min-width: 640px) {
    .grid--ads { grid-template-columns: repeat(2, 1fr); }
    .grid--categories { grid-template-columns: repeat(2, 1fr); }
    .hero__title { font-size: var(--font-size-2xl); }
    .hero__search { display: flex; gap: var(--space-3); padding: var(--space-4); }
    .hero__search-input { flex: 1; margin-bottom: 0; }
    .hero__search-btn { width: auto; }
    .auth-container { justify-content: center; max-width: 440px; margin: 0 auto; }
}

/* ================================================
   TABLET/DESKTOP (768px)
   ================================================ */
@media (min-width: 768px) {
    :root { --header-height: 64px; }
    body { padding-bottom: 0; }
    
    .bottom-nav { display: none; }
    
    .header__logo-text { display: inline; }
    .header__search {
        display: flex;
        flex: 1;
        max-width: 400px;
        position: relative;
    }
    .header__search-input {
        width: 100%;
        padding: var(--space-2) var(--space-4);
        padding-right: 44px;
        border: 2px solid var(--gray-200);
        border-radius: var(--radius-full);
        background: var(--gray-50);
        min-height: 40px;
    }
    .header__search-input:focus { background: var(--white); border-color: var(--primary); outline: none; }
    .header__search-btn {
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: var(--primary);
        color: var(--white);
        border-radius: var(--radius-full);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: var(--font-size-sm);
    }
    .header__mobile-search { display: none; }
    .header__lang { display: flex; gap: var(--space-1); }
    .header__post-btn { width: auto; padding: var(--space-2) var(--space-4); gap: var(--space-2); }
    .header__post-btn span { display: inline; }
    .header__user-name { display: inline; font-weight: 500; color: var(--gray-700); }
    
    .grid--ads { grid-template-columns: repeat(3, 1fr); }
    .grid--categories { grid-template-columns: repeat(3, 1fr); }
    
    .hero { padding: var(--space-12) var(--space-6); }
    .hero__title { font-size: var(--font-size-3xl); }
    .hero__subtitle { font-size: var(--font-size-base); }
    
    .section { padding: var(--space-8) 0; }
    .section-title { font-size: var(--font-size-xl); }
    
    .footer { padding-bottom: var(--space-8); }
    .footer__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-8); }
    
    .flash-messages { left: 50%; right: auto; transform: translateX(-50%); width: 100%; max-width: 500px; }
}

/* ================================================
   DESKTOP (1024px)
   ================================================ */
@media (min-width: 1024px) {
    .header__search { max-width: 500px; }
    .grid--ads { grid-template-columns: repeat(4, 1fr); }
    .grid--categories { grid-template-columns: repeat(4, 1fr); }
    .hero { padding: var(--space-16) var(--space-8); }
    .hero__title { font-size: var(--font-size-4xl); }
    .hero__search { max-width: 600px; margin: 0 auto; }
    .footer__grid { grid-template-columns: 2fr repeat(3, 1fr); }
}

/* ================================================
   LARGE DESKTOP (1280px)
   ================================================ */
@media (min-width: 1280px) {
    .grid--categories { grid-template-columns: repeat(5, 1fr); }
}

/* ================================================
   Utilities
   ================================================ */
.hide-mobile { display: none !important; }
.hide-desktop { display: block; }
@media (min-width: 768px) {
    .hide-mobile { display: block !important; }
    .hide-desktop { display: none !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* ================================================
   BANNERS
   ================================================ */
.banners-container {
    margin: var(--space-4) 0;
}

.banner {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 120px;
}

.banner a {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.banner__imagen{
  width: 100%;
  height: 400px;
  display: block;
  object-fit: contain;         /* ✅ se ve completa */
  object-position: top center; /* ✅ “prioriza” la parte de arriba */
}



.banner__contenido {
    padding: var(--space-6) var(--space-4);
    color: var(--white);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.banner__titulo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0 0 var(--space-2);
}

.banner__descripcion {
    font-size: var(--font-size-base);
    opacity: 0.9;
    margin: 0 0 var(--space-3);
    max-width: 600px;
}

.banner__codigo {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
}

.banner__codigo strong {
    color: #fef08a;
}

/* Banner CON imagen - overlay en la parte inferior */
.banner--con-imagen {
    min-height: auto;
}

.banner--con-imagen .banner__contenido {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    text-align: left;
    align-items: flex-start;
    min-height: auto;
    padding: var(--space-6) var(--space-4) var(--space-4);
}

.banner--con-imagen .banner__titulo {
    font-size: var(--font-size-lg);
}

.banner--con-imagen .banner__descripcion {
    font-size: var(--font-size-sm);
}

/* Banner Slider */
.banner-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.banner-slider__track {
    display: flex;
    transition: transform 0.5s ease;
}

.banner-slider__slide {
    min-width: 100%;
    flex-shrink: 0;
}

.banner-slider__slide .banner {
    border-radius: 0;
}

.banner-slider__dots {
    position: absolute;
    bottom: var(--space-3);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-2);
    z-index: 10;
}

.banner-slider__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.banner-slider__dot.active,
.banner-slider__dot:hover {
    background: var(--white);
    transform: scale(1.2);
}

.banner-slider__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 10;
}

.banner-slider:hover .banner-slider__arrow {
    opacity: 1;
}

.banner-slider__arrow:hover {
    background: rgba(0,0,0,0.8);
}

.banner-slider__arrow--prev { left: var(--space-3); }
.banner-slider__arrow--next { right: var(--space-3); }

/* Banner Sidebar (más pequeño) */
.banner--sidebar {
    margin-bottom: var(--space-4);
}

.banner--sidebar .banner__imagen {
    max-height: 200px;
}

.banner--sidebar .banner__contenido {
    padding: var(--space-3);
}

.banner--sidebar .banner__titulo {
    font-size: var(--font-size-base);
}

/* Page Layout con Sidebar */
.page-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.page-layout__main {
    flex: 1;
    min-width: 0;
}

.page-layout__sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

@media (min-width: 1024px) {
    .page-layout {
        flex-direction: row;
    }
    
    .page-layout__sidebar {
        width: 300px;
        flex-shrink: 0;
    }
}

/* Banner responsive */
@media (max-width: 767px) {
    .banner__imagen {
        max-height: 180px;
    }
    
    .banner-slider__arrow {
        width: 32px;
        height: 32px;
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .banner__imagen {
        max-height: 350px;
    }
    
    .banner__titulo {
        font-size: var(--font-size-xl);
    }
}

@media print {
    .header, .footer, .bottom-nav, .flash-messages, .banner, .banner-slider { display: none !important; }
    body { padding: 0; background: white; }
}
