/* ============================================
   CLASIFICADOS.CO — Sistema de diseño
   Fuentes del sistema: sin dependencia externa
   ============================================ */

:root {
    --primary:      #0f172a;
    --secondary:    #2563eb;
    --secondary-hover: #1d4ed8;
    --accent:       #f59e0b;
    --success:      #059669;
    --danger:       #dc2626;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --surface-3:    #f1f5f9;
    --border:       #e2e8f0;
    --border-strong:#cbd5e1;
    --text-1:       #0f172a;
    --text-2:       #334155;
    --text-3:       #64748b;
    --text-4:       #94a3b8;
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    'SF Mono', 'Fira Code', Consolas, monospace;
    --r-sm:  6px;
    --r:     10px;
    --r-lg:  14px;
    --r-xl:  20px;
    --r-2xl: 28px;
    --sh-sm: 0 1px 3px rgba(0,0,0,.08);
    --sh:    0 4px 12px rgba(0,0,0,.08);
    --sh-lg: 0 8px 24px rgba(0,0,0,.10);
    --sh-xl: 0 16px 40px rgba(0,0,0,.12);
    --t: 180ms ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-1);
    background: var(--surface-2);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: var(--font); }
button { cursor: pointer; }

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: var(--primary);
    padding: 7px 0;
    font-size: 12.5px;
    color: rgba(255,255,255,.55);
}
.topbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 20px;
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.topbar-links { display: flex; gap: 18px; }
.topbar a { color: rgba(255,255,255,.55); transition: color var(--t); }
.topbar a:hover { color: #fff; }

/* ============================================
   BUTTONS (utility — navbar handled in header.php)
   ============================================ */
.btn-ghost {
    background: none; border: 1.5px solid var(--border);
    color: var(--text-2); padding: 7px 16px;
    border-radius: 100px; font-size: 13px; font-weight: 500;
    transition: all var(--t); text-decoration: none; display: inline-flex; align-items: center;
}
.btn-ghost:hover { border-color: var(--secondary); color: var(--secondary); }
.btn-primary {
    background: var(--secondary); color: #fff; border: none;
    padding: 8px 18px; border-radius: 100px;
    font-size: 13.5px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background var(--t);
    white-space: nowrap; text-decoration: none;
}
.btn-primary:hover { background: var(--secondary-hover); }
.btn-danger  { background: var(--danger);  color: #fff; border: none; padding: 8px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-success { background: var(--success); color: #fff; border: none; padding: 8px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600; cursor: pointer; }

/* ============================================
   HERO
   ============================================ */
.hero {
    background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%);
    padding: 56px 20px 72px;
    text-align: center;
    position: relative; overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(37,99,235,.18) 0%, transparent 60%);
    pointer-events: none;
}
.hero-inner { max-width: 680px; margin: 0 auto; position: relative; z-index: 1; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.8); padding: 5px 14px;
    border-radius: 100px; font-size: 12px; font-weight: 600;
    letter-spacing: .4px; text-transform: uppercase; margin-bottom: 18px;
}
.hero h1 {
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 800; color: #fff;
    line-height: 1.15; letter-spacing: -.5px;
    margin-bottom: 14px;
}
.hero h1 span { color: #60a5fa; }
.hero p { font-size: 16px; color: rgba(255,255,255,.62); margin-bottom: 32px; }
.hero-stats {
    display: flex; justify-content: center; gap: 36px; margin-top: 36px; flex-wrap: wrap;
}
.hero-stat .num  { font-size: 26px; font-weight: 800; color: #fff; }
.hero-stat .label { font-size: 11px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .5px; }

/* Hero search box */
.hero-search {
    display: flex; align-items: center;
    background: #fff; border-radius: 100px;
    padding: 5px 5px 5px 22px; gap: 6px;
    box-shadow: 0 16px 48px rgba(0,0,0,.28);
}
.hero-search input {
    flex: 1; border: none; background: transparent;
    font-size: 15px; outline: none; color: var(--text-1);
    min-width: 0;
}
.hero-search input::placeholder { color: var(--text-4); }
.hero-search select {
    border: none; border-left: 1px solid var(--border);
    background: transparent; font-size: 13px; color: var(--text-3);
    padding: 0 14px; outline: none; cursor: pointer;
}
.hero-search .btn-search {
    background: var(--secondary); color: #fff; border: none;
    border-radius: 100px; padding: 11px 24px;
    font-size: 14.5px; font-weight: 700;
    white-space: nowrap; transition: background var(--t);
}
.hero-search .btn-search:hover { background: var(--secondary-hover); }

/* ============================================
   LAYOUT
   ============================================ */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.section    { padding: 48px 0; }
.section-sm { padding: 32px 0; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.section-title  { font-size: 20px; font-weight: 800; color: var(--text-1); letter-spacing: -.3px; }
.section-title span { color: var(--secondary); }
.section-link   { font-size: 13px; font-weight: 600; color: var(--secondary); }
.section-link:hover { text-decoration: underline; }

/* ============================================
   CATEGORÍAS
   ============================================ */
.categories-bg { background: #fff; border-bottom: 1px solid var(--border); }
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.cat-card {
    background: #fff; border: 1.5px solid var(--border);
    border-radius: var(--r-lg); padding: 18px 12px;
    text-align: center; cursor: pointer;
    transition: border-color var(--t), background var(--t), transform var(--t), box-shadow var(--t);
    display: flex; flex-direction: column; align-items: center;
}
.cat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh);
}
.cat-icon { font-size: 30px; margin-bottom: 8px; display: block; line-height: 1; }
.cat-name {
    font-size: 11.5px; font-weight: 600;
    color: var(--text-2); line-height: 1.35;
}

/* ============================================
   AD CARDS
   ============================================ */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.ad-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-lg); overflow: hidden;
    cursor: pointer;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
    position: relative; display: block;
}
.ad-card:hover { box-shadow: var(--sh-xl); transform: translateY(-3px); border-color: #bfdbfe; }
.ad-img-wrap {
    width: 100%; aspect-ratio: 4/3;
    background: var(--surface-3);
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.ad-img-placeholder { font-size: 44px; opacity: .4; }
.ad-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 350ms ease; }
.ad-card:hover .ad-img-wrap img { transform: scale(1.05); }
.ad-badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 700; padding: 3px 8px;
    border-radius: 100px; text-transform: uppercase; letter-spacing: .3px;
}
.ad-fav {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px; background: rgba(255,255,255,.92);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 13px; border: none;
    opacity: 0; transition: opacity var(--t), transform var(--t);
}
.ad-card:hover .ad-fav { opacity: 1; }
.ad-fav:hover { transform: scale(1.12); }
.ad-body    { padding: 12px 14px 14px; }
.ad-cat     { font-size: 11px; font-weight: 600; color: var(--secondary); margin-bottom: 4px; }
.ad-title   {
    font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin-bottom: 8px;
}
.ad-price   { font-size: 17px; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.ad-price.negotiate { font-size: 14px; font-weight: 600; color: var(--text-3); }
.ad-meta    { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-4); }

/* ============================================
   CTA BANNER
   ============================================ */
.cta-banner {
    background: linear-gradient(135deg, var(--secondary) 0%, #7c3aed 100%);
    border-radius: var(--r-2xl); padding: 40px 36px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    position: relative; overflow: hidden;
}
.cta-banner::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 180px; height: 180px;
    background: rgba(255,255,255,.07); border-radius: 50%;
}
.cta-content h2 { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.cta-content p  { color: rgba(255,255,255,.72); font-size: 14.5px; }
.cta-actions    { display: flex; gap: 10px; flex-shrink: 0; }
.btn-white {
    background: #fff; color: var(--secondary); border: none;
    padding: 11px 22px; border-radius: 100px; font-size: 14px; font-weight: 700;
    white-space: nowrap; transition: all var(--t);
}
.btn-white:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.btn-outline-white {
    background: transparent; color: #fff;
    border: 2px solid rgba(255,255,255,.45);
    padding: 9px 20px; border-radius: 100px; font-size: 14px; font-weight: 600;
    white-space: nowrap; transition: all var(--t);
}
.btn-outline-white:hover { border-color: #fff; background: rgba(255,255,255,.1); }

/* ============================================
   POPULAR TAGS
   ============================================ */
.popular-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    background: #fff; border: 1.5px solid var(--border);
    color: var(--text-2); padding: 6px 14px;
    border-radius: 100px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all var(--t);
}
.tag:hover { border-color: var(--secondary); color: var(--secondary); background: rgba(37,99,235,.04); }

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-layout { display: grid; grid-template-columns: 248px 1fr; gap: 24px; align-items: start; }
@media(max-width: 900px){ .search-layout { grid-template-columns: 1fr; } }
.sidebar-filters {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 22px;
    position: sticky; top: 80px;
}
.filter-group   { margin-bottom: 20px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-label   { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-4); margin-bottom: 8px; }
.filter-input   { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r); padding: 8px 12px; font-size: 13.5px; color: var(--text-1); outline: none; background: #fff; transition: border-color var(--t); }
.filter-input:focus { border-color: var(--secondary); }
.price-range    { display: flex; gap: 8px; align-items: center; }
.price-range span { color: var(--text-4); font-size: 13px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(37,99,235,.07); color: var(--secondary);
    border: 1px solid rgba(37,99,235,.2); padding: 4px 12px;
    border-radius: 100px; font-size: 12px; font-weight: 600;
}

/* ============================================
   FORMS (publicar / registro)
   ============================================ */
.form-control {
    width: 100%; border: 1.5px solid var(--border);
    border-radius: var(--r); padding: 10px 13px;
    font-size: 14px; color: var(--text-1); outline: none;
    background: #fff; transition: border-color var(--t), box-shadow var(--t);
}
.form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea.form-control { resize: vertical; min-height: 96px; line-height: 1.55; }

.upload-zone {
    border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
    padding: 28px; text-align: center; cursor: pointer;
    background: var(--surface-3); transition: all var(--t);
}
.upload-zone:hover { border-color: var(--secondary); background: rgba(37,99,235,.03); }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 13.5px; color: var(--text-3); line-height: 1.6; }
.upload-text strong { color: var(--secondary); }

/* ============================================
   PUBLICAR PASOS
   ============================================ */
.pub-section {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 26px 28px;
    margin-bottom: 16px; box-shadow: var(--sh-sm);
}
.pub-section-header { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 20px; }
.pub-step {
    width: 30px; height: 30px; flex-shrink: 0;
    background: var(--secondary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 13px;
}
.pub-section-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.pub-section-desc  { font-size: 13px; color: var(--text-3); }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 6px; }
.cat-radio-card {
    border: 2px solid var(--border); border-radius: var(--r-lg);
    padding: 14px 10px; text-align: center; cursor: pointer;
    transition: all var(--t);
    display: flex; flex-direction: column; align-items: center;
}
.cat-radio-card:hover { border-color: var(--secondary); background: rgba(37,99,235,.04); }
.cat-radio-card.selected { border-color: var(--secondary); background: rgba(37,99,235,.06); }
.img-preview-item {
    position: relative; aspect-ratio: 1;
    border-radius: var(--r); overflow: hidden; border: 2px solid var(--border);
}
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-item .remove-img {
    position: absolute; top: 4px; right: 4px;
    background: rgba(220,38,38,.9); color: #fff; border: none;
    border-radius: 50%; width: 22px; height: 22px; font-size: 11px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ============================================
   PANEL MIS ANUNCIOS
   ============================================ */
.stat-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 20px;
    text-align: center;
}
.stat-card .num   { font-size: 26px; font-weight: 800; }
.stat-card .label { font-size: 12px; color: var(--text-4); margin-top: 2px; }

/* ============================================
   PÁGINA DETALLE ANUNCIO
   ============================================ */
.ad-detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
@media(max-width: 920px){ .ad-detail-layout { grid-template-columns: 1fr; } }

.contact-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 22px;
    box-shadow: var(--sh);
    position: sticky; top: 80px;
}
.btn-whatsapp {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; background: #25d366; color: #fff; border: none;
    padding: 14px; border-radius: var(--r-lg);
    font-size: 15px; font-weight: 700; cursor: pointer;
    text-decoration: none;
    transition: background var(--t), transform var(--t);
    margin-bottom: 10px;
}
.btn-whatsapp:hover { background: #128c7e; transform: translateY(-1px); }
.btn-phone {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; background: #fff; color: var(--text-1);
    border: 2px solid var(--border);
    padding: 12px; border-radius: var(--r-lg);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all var(--t); margin-bottom: 10px;
}
.btn-phone:hover { border-color: var(--secondary); color: var(--secondary); }
.btn-call {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; background: var(--secondary); color: #fff; border: none;
    padding: 12px; border-radius: var(--r-lg);
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background var(--t);
}
.btn-call:hover { background: var(--secondary-hover); }
.seller-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 20px; margin-top: 14px;
}
.avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 20px; flex-shrink: 0;
}

/* ============================================
   GALERÍA
   ============================================ */
.gallery-main {
    width: 100%; aspect-ratio: 4/3; border-radius: var(--r-xl);
    overflow: hidden; background: var(--surface-3);
    display: flex; align-items: center; justify-content: center;
    font-size: 80px; position: relative;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumb {
    width: 72px; height: 58px; flex-shrink: 0;
    border-radius: var(--r); overflow: hidden; cursor: pointer;
    border: 2px solid var(--border); transition: border-color var(--t);
}
.gallery-thumb:hover, .gallery-thumb.active { border-color: var(--secondary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================
   ALERTS & TOASTS
   ============================================ */
.alert { padding: 12px 16px; border-radius: var(--r-lg); font-size: 14px; margin-bottom: 20px; display: flex; align-items: flex-start; gap: 8px; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-warn    { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--primary); color: rgba(255,255,255,.56);
    padding: 52px 0 0; margin-top: 72px;
}
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 44px; margin-bottom: 44px;
}
@media(max-width:900px){ .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
@media(max-width:560px){ .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { font-size: 13.5px; line-height: 1.7; margin: 14px 0 18px; }
.footer-title  { font-size: 12px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .7px; margin-bottom: 14px; }
.footer-links  { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13.5px; transition: color var(--t); }
.footer-links a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; gap: 16px; flex-wrap: wrap;
}
.footer-bottom-links { display: flex; gap: 18px; }
.footer-bottom-links a { transition: color var(--t); }
.footer-bottom-links a:hover { color: #fff; }
.social-links { display: flex; gap: 8px; }
.social-btn {
    width: 34px; height: 34px; background: rgba(255,255,255,.08);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all var(--t);
}
.social-btn:hover { background: var(--secondary); transform: translateY(-2px); }

/* ============================================
   MISC
   ============================================ */
.empty-state { text-align: center; padding: 56px 20px; }
.empty-state .icon { font-size: 52px; margin-bottom: 14px; }
.empty-state h3    { font-size: 18px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.empty-state p     { font-size: 14px; color: var(--text-3); }
.badge-estado {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 100px;
    font-size: 11.5px; font-weight: 700;
}
.badge-activo   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-pausado  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-vendido  { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-eliminado{ background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-4); }
.breadcrumb a:hover { color: var(--secondary); }
.breadcrumb span { color: var(--text-4); font-size: 11px; }

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 11px; border-radius: var(--r); 
    font-size: 13.5px; font-weight: 500; color: var(--text-1);
    transition: background var(--t);
}
.dropdown-item:hover { background: var(--surface-3); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media(max-width: 768px){
    .topbar { display: none; }
    .hero { padding: 40px 16px 52px; }
    .hero-stats { gap: 20px; }
    .ads-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .cta-banner { flex-direction: column; padding: 28px 20px; text-align: center; }
    .cta-actions { justify-content: center; flex-wrap: wrap; }
    .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .cat-card { padding: 12px 6px; }
    .cat-icon { font-size: 24px; }
    .cat-name { font-size: 10.5px; }
}
@media(max-width: 480px){
    .ads-grid { grid-template-columns: 1fr; }
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-search { flex-wrap: wrap; border-radius: 14px; padding: 10px; gap: 8px; }
    .hero-search select { display: none; }
    .hero-search .btn-search { width: 100%; justify-content: center; border-radius: 10px; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
