/* ── Variables ───────────────────────────────────────────── */
:root {
    --bg:          #0A0F1F;
    --surface:     #111827;
    --surface-2:   #0D1526;
    --border:      #1E2D45;
    --border-2:    #253450;
    --accent:      #6D28D9;
    --accent-h:    #7C3AED;
    --accent-text: #8B5CF6;
    --text:        #F8FAFC;
    --muted:       #94A3B8;
    --muted-2:     #64748B;
    --success:     #10B981;
    --success-bg:  rgba(16,185,129,.08);
    --danger:      #EF4444;
    --danger-bg:   rgba(239,68,68,.08);
    --warning:     #FBBF24;
    --warning-bg:  rgba(251,191,36,.08);
}

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

html { scroll-behavior: smooth; }

body {
    background:              var(--bg);
    color:                   var(--text);
    font-family:             'Inter', -apple-system, system-ui, sans-serif;
    font-size:               16px;
    line-height:             1.6;
    min-height:              100vh;
    -webkit-font-smoothing:  antialiased;
}

/* ── Utilidades ──────────────────────────────────────────── */
.hidden       { display: none !important; }

.size-saving  { color: var(--success); margin-left: 3px; }

/* ── Container ───────────────────────────────────────────── */
.container {
    max-width: 880px;
    margin:    0 auto;
    padding:   0 24px;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    position:            sticky;
    top:                 0;
    z-index:             100;
    background:          rgba(10, 15, 31, 0.9);
    backdrop-filter:     blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom:       1px solid rgba(255,255,255,0.05);
}

.navbar-inner {
    max-width:       880px;
    margin:          0 auto;
    padding:         0 24px;
    height:          52px;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
}

.brand {
    display:         flex;
    align-items:     center;
    gap:             9px;
    text-decoration: none;
    color:           var(--text);
    font-weight:     700;
    font-size:       0.93rem;
    letter-spacing:  -0.02em;
}

.brand-mark {
    width:          26px;
    height:         26px;
    background:     rgba(109, 40, 217, 0.15);
    border:         1px solid rgba(139, 92, 246, 0.18);
    border-radius:  7px;
    display:        flex;
    align-items:    center;
    justify-content:center;
    font-size:      0.76rem;
    line-height:    1;
    flex-shrink:    0;
    transition:     background 0.15s, border-color 0.15s;
}

.brand:hover .brand-mark {
    background:   rgba(109, 40, 217, 0.25);
    border-color: rgba(139, 92, 246, 0.3);
}

.nav-badge {
    display:        inline-flex;
    align-items:    center;
    gap:            7px;
    color:          var(--muted-2);
    font-size:      0.74rem;
    font-weight:    500;
    letter-spacing: 0.01em;
}

.pulse-dot {
    width:        5px;
    height:       5px;
    background:   var(--success);
    border-radius:50%;
    flex-shrink:  0;
    animation:    pulse-anim 2.5s ease-in-out infinite;
}

@keyframes pulse-anim {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    padding:    80px 0 64px;
    text-align: center;
}

.trust-row {
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-wrap:       wrap;
    gap:             8px 12px;
    margin-bottom:   32px;
}

.trust-item {
    display:     inline-flex;
    align-items: center;
    gap:         5px;
    font-size:   0.76rem;
    font-weight: 500;
    color:       var(--muted);
}

.tick {
    color:       var(--success);
    font-weight: 700;
}

.trust-sep {
    color:       var(--border-2);
    font-size:   0.9rem;
    user-select: none;
}

.hero-title {
    font-size:      clamp(2.4rem, 6vw, 3.8rem);
    font-weight:    800;
    letter-spacing: -0.03em;
    line-height:    1.1;
    color:          var(--text);
    margin-bottom:  20px;
}

.hero-accent { color: var(--accent-text); }

.hero-sub {
    font-size:     1.05rem;
    color:         var(--muted);
    max-width:     520px;
    margin:        0 auto 36px;
    line-height:   1.65;
    font-weight:   400;
}

.hero-ctas {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             16px;
    flex-wrap:       wrap;
}

.btn-cta {
    display:        inline-flex;
    align-items:    center;
    gap:            8px;
    background:     var(--accent);
    color:          #fff;
    border:         none;
    padding:        12px 26px;
    border-radius:  9px;
    font-size:      0.9rem;
    font-weight:    600;
    font-family:    inherit;
    cursor:         pointer;
    letter-spacing: -0.01em;
    transition:     background 0.15s, transform 0.15s;
}

.btn-cta:hover  { background: var(--accent-h); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); }

.btn-ghost {
    display:        inline-flex;
    align-items:    center;
    gap:            5px;
    color:          var(--muted);
    font-size:      0.88rem;
    font-weight:    500;
    text-decoration:none;
    padding:        12px 4px;
    transition:     color 0.15s;
}

.btn-ghost:hover { color: var(--text); }

.ghost-arrow {
    display:    inline-block;
    transition: transform 0.2s;
}

.btn-ghost:hover .ghost-arrow { transform: translateY(2px); }

/* ── Upload ──────────────────────────────────────────────── */
.upload-section { padding: 0 0 48px; }

.drop-zone {
    position:      relative;
    border:        1.5px dashed var(--border-2);
    border-radius: 16px;
    min-height:    260px;
    display:       flex;
    align-items:   center;
    justify-content:center;
    cursor:        pointer;
    background:    var(--surface-2);
    overflow:      hidden;
    transition:    border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--accent-text);
    background:   rgba(109, 40, 217, 0.04);
    outline:      none;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    border-style: solid;
    background:   rgba(109, 40, 217, 0.07);
}

.drop-zone.drag-over .dz-icon { transform: translateY(-4px); }

.dz-inner {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            10px;
    padding:        48px 24px;
    text-align:     center;
    pointer-events: none;
    user-select:    none;
}

.dz-icon {
    width:          64px;
    height:         64px;
    background:     var(--surface);
    border:         1px solid var(--border);
    border-radius:  14px;
    display:        flex;
    align-items:    center;
    justify-content:center;
    margin-bottom:  6px;
    transition:     transform 0.2s;
}

.dz-title {
    font-size:      1rem;
    font-weight:    600;
    color:          var(--text);
    letter-spacing: -0.01em;
}

.dz-sub {
    font-size: 0.8rem;
    color:     var(--muted-2);
}

#fileInput { display: none; }

/* ── Controls ────────────────────────────────────────────── */
.controls-section {
    padding:   0 0 64px;
    animation: fadeUp 0.22s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stats-bar {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             16px;
    background:      var(--surface);
    border:          1px solid var(--border);
    border-radius:   12px;
    padding:         16px 20px;
    margin-bottom:   24px;
    flex-wrap:       wrap;
}

.stats-left {
    display:     flex;
    align-items: center;
    flex-wrap:   wrap;
}

.stat {
    display:        flex;
    flex-direction: column;
    gap:            1px;
    padding:        0 20px;
}

.stat:first-child { padding-left: 0; }

.stat-sep {
    width:       1px;
    height:      32px;
    background:  var(--border);
    flex-shrink: 0;
}

.stat-lbl {
    font-size:      0.68rem;
    font-weight:    600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--muted-2);
}

.stat-val {
    font-size:      1.3rem;
    font-weight:    700;
    color:          var(--text);
    letter-spacing: -0.02em;
    line-height:    1.2;
}

.stat-val.stat-success { color: var(--success); }

.stats-right {
    display:     flex;
    align-items: center;
    gap:         10px;
    flex-shrink: 0;
    flex-wrap:   wrap;
}

.btn-outline {
    display:        inline-flex;
    align-items:    center;
    gap:            6px;
    background:     transparent;
    border:         1px solid var(--border);
    color:          var(--muted);
    padding:        8px 16px;
    border-radius:  8px;
    font-size:      0.82rem;
    font-weight:    500;
    font-family:    inherit;
    cursor:         pointer;
    transition:     border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-outline:hover {
    border-color: var(--danger);
    color:        var(--danger);
    background:   var(--danger-bg);
}

.btn-zip {
    display:        inline-flex;
    align-items:    center;
    gap:            7px;
    background:     var(--accent);
    color:          #fff;
    border:         none;
    padding:        8px 18px;
    border-radius:  8px;
    font-size:      0.82rem;
    font-weight:    600;
    font-family:    inherit;
    cursor:         pointer;
    transition:     background 0.15s, transform 0.15s, opacity 0.15s;
}

.btn-zip:hover:not(:disabled) { background: var(--accent-h); transform: translateY(-1px); }
.btn-zip:disabled              { opacity: 0.4; cursor: not-allowed; }

.zip-spinner {
    display:      inline-block;
    width:        12px;
    height:       12px;
    border:       2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius:50%;
    flex-shrink:  0;
    animation:    spin 0.65s linear infinite;
}

/* ── Image grid ──────────────────────────────────────────── */
.grid-header   { margin-bottom: 14px; }

.grid-label {
    font-size:      0.7rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:          var(--muted-2);
}

#imageGrid {
    max-height:     640px;
    overflow-y:     auto;
    padding-right:  4px;
    /* Scrollbar estándar (Firefox) */
    scrollbar-width:thin;
    scrollbar-color:var(--border) transparent;
}

/* Scrollbar WebKit */
#imageGrid::-webkit-scrollbar        { width: 4px; }
#imageGrid::-webkit-scrollbar-track  { background: transparent; }
#imageGrid::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 2px; }

.img-row {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap:                   12px;
}

/*
 * display:contents hace que .img-item sea invisible para el modelo de caja,
 * permitiendo que .img-card participe directamente en el grid de .img-row.
 */
.img-item { display: contents; }

.img-card {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: 11px;
    overflow:      hidden;
    transition:    transform 0.18s, border-color 0.18s;
}

.img-card:hover             { transform: translateY(-2px); border-color: var(--border-2); }
.img-card.status-done       { border-color: rgba(16,185,129,.25); }
.img-card.status-error      { border-color: rgba(239,68,68,.25); }

.thumb-wrap {
    position:   relative;
    height:     145px;
    overflow:   hidden;
    background: #080d1a;
}

.thumb-wrap img {
    width:       100%;
    height:      100%;
    object-fit:  cover;
    display:     block;
}

.processing-overlay {
    position:        absolute;
    inset:           0;
    background:      rgba(8, 13, 26, 0.7);
    display:         flex;
    align-items:     center;
    justify-content: center;
}

.spinner-ring {
    width:           30px;
    height:          30px;
    border:          2.5px solid rgba(139,92,246,.2);
    border-top-color:var(--accent-text);
    border-radius:   50%;
    animation:       spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.status-badge {
    position:       absolute;
    top:            8px;
    right:          8px;
    padding:        3px 8px;
    border-radius:  999px;
    font-size:      0.65rem;
    font-weight:    700;
    letter-spacing: 0.02em;
    line-height:    1.5;
}

.badge-done       { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,.25); }
.badge-error      { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.badge-processing { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251,191,36,.25); }

.card-body-inner { padding: 10px 11px 11px; }

.filename {
    font-size:      0.75rem;
    font-weight:    600;
    color:          var(--text);
    white-space:    nowrap;
    overflow:       hidden;
    text-overflow:  ellipsis;
    margin-bottom:  3px;
    letter-spacing: -0.01em;
}

.size-info {
    font-size:     0.68rem;
    color:         var(--muted-2);
    margin-bottom: 9px;
    min-height:    1rem;
}

.size-arrow { color: var(--accent-text); margin: 0 3px; }

.btn-dl-single {
    width:           100%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             5px;
    padding:         6px;
    border-radius:   7px;
    border:          1px solid var(--border);
    background:      transparent;
    color:           var(--success);
    font-size:       0.73rem;
    font-weight:     600;
    font-family:     inherit;
    cursor:          pointer;
    transition:      background 0.15s, border-color 0.15s;
}

.btn-dl-single:hover:not(:disabled) { background: var(--success-bg); border-color: rgba(16,185,129,.3); }
.btn-dl-single:disabled             { opacity: 0.3; cursor: not-allowed; color: var(--muted-2); }

/* ── How it works ────────────────────────────────────────── */
.how-section {
    padding:    80px 0;
    border-top: 1px solid var(--border);
}

.eyebrow {
    font-size:      0.72rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color:          var(--accent-text);
    margin-bottom:  10px;
}

.section-title {
    font-size:      clamp(1.6rem, 3.5vw, 2.1rem);
    font-weight:    700;
    letter-spacing: -0.025em;
    color:          var(--text);
    margin-bottom:  48px;
    line-height:    1.2;
}

.steps {
    display:               grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items:           start;
}

.step {
    padding: 0 8px;
}

.step:first-child { padding-left: 0; }
.step:last-child  { padding-right: 0; }

.step-connector {
    width:       48px;
    height:      1px;
    background:  var(--border);
    align-self:  start;
    margin-top:  22px;
}

.step-num {
    display:        block;
    font-size:      0.72rem;
    font-weight:    800;
    letter-spacing: 0.06em;
    color:          var(--accent-text);
    margin-bottom:  12px;
}

.step-title {
    font-size:      1.05rem;
    font-weight:    700;
    color:          var(--text);
    margin-bottom:  8px;
    letter-spacing: -0.015em;
}

.step-desc {
    font-size:   0.86rem;
    color:       var(--muted);
    line-height: 1.6;
}

/* ── FAQ ─────────────────────────────────────────────────── */
.faq-section {
    padding:    80px 0;
    border-top: 1px solid var(--border);
}

.faq-list {
    display:        flex;
    flex-direction: column;
    border:         1px solid var(--border);
    border-radius:  12px;
    overflow:       hidden;
}

.faq-item             { border-bottom: 1px solid var(--border); }
.faq-item:last-child  { border-bottom: none; }

.faq-q {
    width:           100%;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             16px;
    padding:         18px 22px;
    background:      transparent;
    border:          none;
    color:           var(--text);
    font-size:       0.9rem;
    font-weight:     500;
    font-family:     inherit;
    cursor:          pointer;
    text-align:      left;
    transition:      background 0.15s;
}

.faq-q:hover,
.faq-item.open .faq-q { background: var(--surface); }
.faq-item.open .faq-q { font-weight: 600; }

.faq-icon {
    flex-shrink:     0;
    width:           20px;
    height:          20px;
    border:          1px solid var(--border-2);
    border-radius:   50%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       1rem;
    font-weight:     300;
    color:           var(--muted);
    line-height:     1;
    transition:      transform 0.2s, border-color 0.2s, color 0.2s;
}

.faq-item.open .faq-icon {
    transform:    rotate(45deg);
    border-color: var(--accent-text);
    color:        var(--accent-text);
}

/*
 * grid-template-rows: 0fr → 1fr anima el alto sin necesitar max-height fijo.
 * El <div> interno con overflow:hidden evita que el contenido se desborde.
 */
.faq-a                 { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; }
.faq-item.open .faq-a  { grid-template-rows: 1fr; }
.faq-a > div           { overflow: hidden; }

.faq-a p {
    padding:     2px 22px 20px;
    font-size:   0.86rem;
    color:       var(--muted);
    line-height: 1.65;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    padding:    28px 0;
}

.footer-inner {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             16px;
    flex-wrap:       wrap;
}

.footer-brand {
    font-weight:    700;
    font-size:      0.88rem;
    color:          var(--text);
    letter-spacing: -0.01em;
}

.footer-note  { font-size: 0.78rem; color: var(--muted-2); }

.footer-lock {
    display:     inline-flex;
    align-items: center;
    gap:         6px;
    font-size:   0.75rem;
    color:       var(--muted-2);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    .nav-badge  { display: none; }

    .hero       { padding: 56px 0 48px; }

    .trust-sep  { display: none; }
    .trust-row  { flex-direction: column; gap: 6px; }
    .br-desktop { display: none; }
    .hero-ctas  { flex-direction: column; gap: 10px; }

    .stats-bar  { flex-direction: column; align-items: flex-start; gap: 14px; }
    .stats-left { flex-wrap: wrap; row-gap: 10px; }
    .stat       { padding: 0 16px; }
    .stat:first-child { padding-left: 0; }

    .steps            { grid-template-columns: 1fr; gap: 32px; }
    .step-connector   { display: none; }
    .step             { padding: 0; }

    .how-section  { padding: 56px 0; }
    .faq-section  { padding: 56px 0; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }

    .img-row { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
    .navbar-inner { padding: 0 16px; }
    .container    { padding: 0 16px; }
    .img-row      { grid-template-columns: repeat(2, 1fr); }
}
