/* Free WebP — design system overrides on top of Bootstrap 5.3 */

:root,
[data-bs-theme='light'] {
    --fw-primary: #6366f1;
    --fw-primary-strong: #4f46e5;
    --fw-accent: #8b5cf6;
    --fw-accent-2: #ec4899;
    --fw-gradient: linear-gradient(135deg, var(--fw-primary) 0%, var(--fw-accent) 55%, var(--fw-accent-2) 100%);
    --fw-surface: #ffffff;
    --fw-surface-muted: #f6f7fb;
    --fw-border: rgba(15, 23, 42, 0.08);
    --fw-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --fw-shadow-md: 0 10px 25px -10px rgba(79, 70, 229, 0.18), 0 4px 12px rgba(15, 23, 42, 0.05);
    --fw-shadow-lg: 0 30px 60px -25px rgba(79, 70, 229, 0.35);
    --bs-primary: var(--fw-primary);
    --bs-primary-rgb: 99, 102, 241;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color-rgb: 67, 56, 202;
    --bs-body-bg: var(--fw-surface-muted);
    --bs-body-color: #0f172a;
    --bs-border-radius: 0.625rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-xl: 1.25rem;
}

/* Dark theme — applied either explicitly via the toggle (data-bs-theme="dark")
 * or as the user's OS preference on the very first visit (before any cookie),
 * via the @media block below. The duplication avoids a flash of light content. */
[data-bs-theme='dark'] {
    --fw-primary: #818cf8;
    --fw-primary-strong: #6366f1;
    --fw-accent: #a78bfa;
    --fw-accent-2: #f472b6;
    --fw-surface: #161826;
    --fw-surface-muted: #0c0e1a;
    --fw-border: rgba(148, 163, 184, 0.14);
    --fw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --fw-shadow-md: 0 12px 30px -12px rgba(0, 0, 0, 0.65);
    --fw-shadow-lg: 0 30px 60px -25px rgba(0, 0, 0, 0.8);
    --bs-primary: var(--fw-primary);
    --bs-primary-rgb: 129, 140, 248;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color-rgb: 199, 210, 254;
    --bs-body-bg: var(--fw-surface-muted);
    --bs-body-color: #e2e8f0;
}

@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme]) {
        --fw-primary: #818cf8;
        --fw-primary-strong: #6366f1;
        --fw-accent: #a78bfa;
        --fw-accent-2: #f472b6;
        --fw-surface: #161826;
        --fw-surface-muted: #0c0e1a;
        --fw-border: rgba(148, 163, 184, 0.14);
        --fw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --fw-shadow-md: 0 12px 30px -12px rgba(0, 0, 0, 0.65);
        --fw-shadow-lg: 0 30px 60px -25px rgba(0, 0, 0, 0.8);
        --bs-primary: var(--fw-primary);
        --bs-primary-rgb: 129, 140, 248;
        --bs-link-color-rgb: 165, 180, 252;
        --bs-link-hover-color-rgb: 199, 210, 254;
        --bs-body-bg: var(--fw-surface-muted);
        --bs-body-color: #e2e8f0;
        color-scheme: dark;
    }
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.005em;
    background:
        radial-gradient(ellipse 60rem 36rem at 80% -10%, rgba(139, 92, 246, 0.10), transparent 60%),
        radial-gradient(ellipse 50rem 30rem at -10% 5%, rgba(99, 102, 241, 0.10), transparent 55%),
        var(--bs-body-bg);
    background-attachment: fixed;
}

[data-bs-theme='dark'] body {
    background:
        radial-gradient(ellipse 60rem 36rem at 80% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
        radial-gradient(ellipse 50rem 30rem at -10% 5%, rgba(99, 102, 241, 0.16), transparent 55%),
        var(--bs-body-bg);
    background-attachment: fixed;
}

@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme]) body {
        background:
            radial-gradient(ellipse 60rem 36rem at 80% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
            radial-gradient(ellipse 50rem 30rem at -10% 5%, rgba(99, 102, 241, 0.16), transparent 55%),
            var(--bs-body-bg);
        background-attachment: fixed;
    }
}

main { flex: 1 1 auto; }

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em;
    font-weight: 600;
}

/* Navbar — sticky, blurred, no harsh border */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: color-mix(in srgb, var(--fw-surface) 78%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--fw-border) !important;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .brand-mark {
    display: inline-grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.55rem;
    background: var(--fw-gradient);
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.55);
}

.navbar-brand .brand-text {
    background: var(--fw-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    /* Visual: WebKit/Blink/Gecko make the text transparent so the gradient
       shows. Accessibility/Lighthouse: read color as fw-primary-strong (a
       real, high-contrast colour) instead of computed transparency. */
    color: var(--fw-primary-strong);
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    --bs-btn-border-radius: 0.6rem;
    font-weight: 500;
    transition: transform 0.08s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    --bs-btn-bg: var(--fw-primary);
    --bs-btn-border-color: var(--fw-primary);
    --bs-btn-hover-bg: var(--fw-primary-strong);
    --bs-btn-hover-border-color: var(--fw-primary-strong);
    --bs-btn-active-bg: var(--fw-primary-strong);
    --bs-btn-active-border-color: var(--fw-primary-strong);
    background-image: var(--fw-gradient);
    border: none;
    box-shadow: 0 8px 18px -10px rgba(99, 102, 241, 0.7);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-image: linear-gradient(135deg, var(--fw-primary-strong) 0%, #7c3aed 55%, #db2777 100%);
    box-shadow: 0 12px 24px -10px rgba(99, 102, 241, 0.8);
}

.btn-outline-secondary {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-border-color: var(--fw-border);
    --bs-btn-hover-bg: color-mix(in srgb, var(--fw-primary) 8%, transparent);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--fw-primary) 35%, transparent);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-active-bg: color-mix(in srgb, var(--fw-primary) 14%, transparent);
    --bs-btn-active-border-color: var(--fw-primary);
    --bs-btn-active-color: var(--bs-body-color);
    background-color: var(--fw-surface);
}

.btn-outline-primary {
    --bs-btn-color: var(--fw-primary-strong);
    --bs-btn-border-color: color-mix(in srgb, var(--fw-primary) 45%, transparent);
    --bs-btn-hover-bg: var(--fw-primary);
    --bs-btn-hover-border-color: var(--fw-primary);
}

/* Cards */
.card {
    border: 1px solid var(--fw-border);
    border-radius: var(--bs-border-radius-lg);
    background: var(--fw-surface);
    box-shadow: var(--fw-shadow-sm);
}

.card.shadow-sm { box-shadow: var(--fw-shadow-md) !important; }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--fw-border);
    font-weight: 600;
    padding: 0.9rem 1.25rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 2.5rem 0 1.75rem;
}

@media (max-width: 575.98px) {
    .hero { padding-top: 1.25rem; }
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fw-primary-strong);
    background: color-mix(in srgb, var(--fw-primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--fw-primary) 22%, transparent);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

[data-bs-theme='dark'] .hero-eyebrow { color: var(--fw-accent); }

.hero h1 {
    font-size: clamp(1.55rem, 5.5vw, 2.85rem);
    line-height: 1.15;
    font-weight: 700;
    margin-bottom: 0.85rem;
    letter-spacing: -0.03em;
}

.hero p.lead { font-size: 0.95rem; }
@media (min-width: 576px) {
    .hero p.lead { font-size: 1.05rem; }
}

.hero h1 .hero-grad {
    background: var(--fw-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--fw-primary-strong);
    -webkit-text-fill-color: transparent;
}

.hero p.lead {
    font-size: 1.05rem;
    color: var(--bs-secondary-color);
    max-width: 38rem;
    margin: 0 auto;
}

/* Dropzone */
.dropzone {
    position: relative;
    border: 2px dashed color-mix(in srgb, var(--fw-primary) 30%, var(--fw-border));
    border-radius: var(--bs-border-radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background:
        radial-gradient(ellipse 30rem 12rem at 50% 0%, color-mix(in srgb, var(--fw-primary) 7%, transparent), transparent 70%),
        var(--fw-surface);
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dropzone--over {
    border-color: var(--fw-primary);
    border-style: solid;
    background:
        radial-gradient(ellipse 30rem 14rem at 50% 0%, color-mix(in srgb, var(--fw-primary) 14%, transparent), transparent 70%),
        var(--fw-surface);
    box-shadow: var(--fw-shadow-md);
    transform: translateY(-1px);
}

.dropzone__icon {
    display: inline-grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: var(--fw-gradient);
    color: white;
    font-size: 1.6rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 12px 24px -10px rgba(99, 102, 241, 0.55);
}

/* File preview grid */
.file-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .file-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.file-row {
    border: 1px solid var(--fw-border);
    background: var(--fw-surface);
    border-radius: 0.6rem;
    padding: 0.55rem 0.65rem;
    min-width: 0;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file-row:hover {
    border-color: color-mix(in srgb, var(--fw-primary) 30%, transparent);
    background-color: color-mix(in srgb, var(--fw-primary) 4%, var(--fw-surface));
}

.file-row img { border-radius: 0.45rem; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1); }

.file-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.45rem;
    background: color-mix(in srgb, var(--fw-primary) 10%, var(--fw-surface));
    color: var(--fw-primary-strong);
    flex: none;
}
.file-row__icon i { font-size: 1.1rem; }

.file-summary {
    grid-column: 1 / -1;
    border: 1px solid var(--fw-border);
    background: var(--fw-surface);
    border-radius: 0.7rem;
}
.file-list > .border-bottom { grid-column: 1 / -1; }
.file-summary__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 0.6rem;
    background: var(--fw-gradient);
    color: #fff;
    flex: none;
}
.file-summary__icon i { font-size: 1.4rem; }

/* Dropdown menu (navbar user menu, etc.) */
.dropdown-menu {
    border: 1px solid var(--fw-border);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--fw-shadow-lg);
    padding: 0.4rem;
    background: var(--fw-surface);
    min-width: 14rem;
}

.dropdown-header {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    padding: 0.35rem 0.75rem;
}

.dropdown-item {
    border-radius: 0.45rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: color-mix(in srgb, var(--fw-primary) 10%, transparent);
    color: var(--bs-body-color);
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
    background-color: color-mix(in srgb, #ef4444 12%, transparent);
    color: #ef4444 !important;
}

.dropdown-divider {
    border-top-color: var(--fw-border);
    margin: 0.35rem 0;
}

/* Hide Bootstrap's default caret on icon-only dropdown triggers */
.user-menu-toggle::after { display: none; }

/* Square icon-only buttons in the navbar — fixed size regardless of icon */
.nav-icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.nav-icon-btn > i { font-size: 1.5rem; line-height: 1; }
.nav-icon-btn > .bi-moon-fill { font-size: 0.8rem; }
.nav-icon-btn > .bi-sun-fill { font-size: 1rem; }
.nav-locale-flag { font-size: 1.05rem; line-height: 1; }

/* Square icon-only action button used in admin tables.
   Slightly larger than .nav-icon-btn so it sits well next to row text. */
.admin-action-btn {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.admin-action-btn > i { font-size: 0.95rem; line-height: 1; }

/* Quality selector */
.quality-selector {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem 0;
}


.quality-selector__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.quality-selector__title {
    font-weight: 600;
    font-size: 0.92rem;
}

.quality-selector__hint {
    display: block;
    margin-top: 0.1rem;
}

.quality-selector__value {
    font-weight: 700;
    font-size: 1.2rem;
    background: var(--fw-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--fw-primary-strong);
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    flex: none;
}

.quality-selector__presets {
    flex-wrap: wrap;
}

.quality-selector__presets .btn {
    flex: 1;
    font-weight: 500;
}

.quality-selector__presets .btn.active {
    background-image: var(--fw-gradient);
    background-color: transparent;
    border-color: transparent;
    color: white;
    box-shadow: 0 6px 14px -8px rgba(99, 102, 241, 0.6);
}

/* Up to Bootstrap md (<768px): the "Personalizable" preset wraps to its own
   full-width row so all 4 labels keep enough breathing room on small viewports.
   From md upward it stays inline as the 4th button of the btn-group. The
   selector must beat `.quality-selector__presets .btn { flex: 1 }` above,
   so it stacks two classes to match its specificity. */
@media (max-width: 767.98px) {
    .quality-selector__presets .quality-selector__preset-custom {
        flex: 0 0 100%;
        min-width: 100%;
        margin-top: 4px;
        margin-left: 0;
        border-left-width: 1px;
        border-radius: var(--bs-border-radius);
    }
    /* The 1920px button is now the rightmost on row 1 — restore its right corners. */
    .quality-selector__presets > .btn:nth-child(3) {
        border-top-right-radius: var(--bs-border-radius);
        border-bottom-right-radius: var(--bs-border-radius);
    }
}

.quality-selector__slider {
    margin: 0;
}

.quality-selector__scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    letter-spacing: 0.02em;
    margin-top: -0.4rem;
}

.form-range::-webkit-slider-thumb {
    background: var(--fw-primary);
    border: 2px solid var(--fw-surface);
    box-shadow: 0 0 0 1px var(--fw-primary), 0 4px 8px -2px rgba(99, 102, 241, 0.5);
}

.form-range::-moz-range-thumb {
    background: var(--fw-primary);
    border: 2px solid var(--fw-surface);
    box-shadow: 0 0 0 1px var(--fw-primary), 0 4px 8px -2px rgba(99, 102, 241, 0.5);
}

/* Badges */
.badge {
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.4em 0.7em;
    border-radius: 999px;
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: color-mix(in srgb, var(--fw-primary) 5%, transparent);
}

.table > :not(caption) > * > * { padding: 0.85rem 0.75rem; }
.table thead th { font-weight: 500; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.06em; }

/* Tabla embebida en una card sin padding: aire en los lados */
.table.table-padded > thead > tr > th:first-child,
.table.table-padded > tbody > tr > td:first-child { padding-left: 1.5rem !important; }
.table.table-padded > thead > tr > th:last-child,
.table.table-padded > tbody > tr > td:last-child { padding-right: 1.5rem !important; }

/* Alerts — softer */
.alert {
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    backdrop-filter: blur(6px);
}

.alert-info {
    background: color-mix(in srgb, var(--fw-primary) 10%, var(--fw-surface));
    border-color: color-mix(in srgb, var(--fw-primary) 22%, transparent);
    color: var(--bs-body-color);
}

/* Forms */
.form-control,
.form-select {
    border-radius: 0.6rem;
    border-color: var(--fw-border);
    background-color: var(--fw-surface);
    padding: 0.55rem 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--fw-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--fw-primary) 22%, transparent);
}

.form-label { font-weight: 500; font-size: 0.92rem; }

.form-check-input:checked {
    background-color: var(--fw-primary);
    border-color: var(--fw-primary);
}

.form-check-input:focus {
    border-color: var(--fw-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--fw-primary) 22%, transparent);
}

/* Feature pills under hero */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.85rem;
    margin-top: 1.75rem;
}

.feature-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--bs-border-radius);
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    font-size: 0.9rem;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-pill:hover {
    border-color: color-mix(in srgb, var(--fw-primary) 35%, transparent);
    transform: translateY(-1px);
    box-shadow: var(--fw-shadow-sm);
    color: var(--bs-body-color);
}

.feature-pill .feature-pill__icon {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--fw-primary) 12%, transparent);
    color: var(--fw-primary-strong);
    font-size: 1.1rem;
    flex: none;
}

[data-bs-theme='dark'] .feature-pill .feature-pill__icon { color: var(--fw-accent); }

/* Quota badge variant */
.quota-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--bs-body-color);
    /* Match btn-sm rendered height so it lines up with adjacent buttons. */
    height: calc(0.875rem * 1.5 + 0.5rem + 2px);
    white-space: nowrap;
}

.quota-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent);
    flex: none;
}

.quota-pill.is-low .quota-dot,
.quota-row .quota-dot.is-low { background: #f59e0b; box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 25%, transparent); }

.quota-pill.is-empty .quota-dot,
.quota-row .quota-dot.is-empty { background: #ef4444; box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 25%, transparent); }

.quota-pill.is-unlimited .quota-dot,
.quota-row .quota-dot.is-unlimited { background: var(--fw-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fw-primary) 25%, transparent); }

.quota-row {
    padding: 0.4rem 0.75rem;
    white-space: nowrap;
    gap: 1rem;
}
.quota-row > span { white-space: nowrap; }

/* Auth pages */
.auth-card {
    max-width: 26rem;
    margin: 1.5rem auto 0;
    padding: 2rem 1.75rem;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    border-radius: var(--bs-border-radius-xl);
    box-shadow: var(--fw-shadow-lg);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.25rem;
}

.auth-card .auth-sub {
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

/* Footer */
footer { border-top: 1px solid var(--fw-border) !important; }

/* Fade-in */
.fade-in { animation: fade-in 0.25s ease-in; }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* Breadcrumb */
.breadcrumb {
    --bs-breadcrumb-divider-color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

/* Progress bar */
.progress {
    background-color: color-mix(in srgb, var(--fw-primary) 12%, transparent);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar { background-image: var(--fw-gradient); }

/* Status pills variants — softened backgrounds */
.text-bg-success { background-color: #16a34a !important; }
.text-bg-warning { background-color: #f59e0b !important; color: #1a1300 !important; }
.text-bg-danger { background-color: #ef4444 !important; }
.text-bg-info { background-color: #0ea5e9 !important; color: #fff !important; }

/* Batch history grid — always 1 card per row */
.batch-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.batch-card {
    position: relative;
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr) minmax(0, 14rem) auto;
    align-items: center;
    column-gap: 1.1rem;
    row-gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--fw-shadow-sm);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.18s ease;
}

.batch-card:hover {
    border-color: color-mix(in srgb, var(--fw-primary) 28%, transparent);
    transform: translateY(-1px);
    box-shadow: var(--fw-shadow-md);
}

.batch-card__date {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--bs-body-color);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.batch-card__date i { color: var(--bs-secondary-color); font-size: 0.9rem; }
.batch-card__date--disabled { cursor: default; }
.batch-card__date--disabled:hover { color: var(--bs-body-color); }
.batch-card__date--disabled:hover i { color: var(--bs-secondary-color); }
.batch-card__date:hover { color: var(--fw-primary-strong); }
.batch-card__date:hover i { color: var(--fw-primary); }
[data-bs-theme='dark'] .batch-card__date:hover { color: var(--fw-accent); }

.batch-card__time {
    color: var(--bs-secondary-color);
    font-weight: 500;
}

.batch-card__chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-width: 0;
}

.batch-card__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bs-body-color);
    white-space: nowrap;
}

.batch-card__chip i { color: var(--bs-secondary-color); font-size: 0.82rem; }

/* Fixed widths so the chips line up between rows regardless of values
   (1 vs 90, WEBP vs AVIF, Q40 vs Q100). */
.batch-card__chip { min-width: 3.3rem; justify-content: center; }
.batch-card__chips .format-badge { min-width: 3.6rem; justify-content: center; text-align: center; }

/* Metrics — fixed-width column so rows align */
.batch-card__metrics {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 0.5rem;
    row-gap: 0;
    justify-content: end;
    text-align: right;
    white-space: nowrap;
    min-height: 2.4rem;
}

.batch-card__savings-num {
    grid-row: 1 / span 2;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.55rem;
    border-radius: 0.45rem;
    background: color-mix(in srgb, var(--fw-primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--fw-primary) 28%, transparent);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.03em;
    color: var(--fw-primary-strong);
    font-variant-numeric: tabular-nums;
    min-width: 3.6rem;
}

[data-bs-theme='dark'] .batch-card__savings-num {
    color: var(--fw-accent);
    background: color-mix(in srgb, var(--fw-primary) 16%, transparent);
    border-color: color-mix(in srgb, var(--fw-primary) 40%, transparent);
}

.batch-card__sizes-out {
    grid-column: 2;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--bs-body-color);
    font-variant-numeric: tabular-nums;
    text-align: left;
}

.batch-card__sizes-orig {
    grid-column: 2;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
    text-align: left;
}

/* Actions — expires + download */
.batch-card__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    justify-self: end;
}

.batch-card__expires {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.batch-card__expires i { font-size: 0.78rem; }

.batch-card__download i { margin-right: 0.3rem; }
.batch-card__download.btn-primary {
    background-image: none;
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.batch-card__download.btn-primary:hover,
.batch-card__download.btn-primary:focus-visible {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Progress bar inside metrics column when batch is processing */
.batch-card__metrics--progress {
    display: flex;
    align-items: center;
    grid-column: 3 / -1;
    grid-template-columns: none;
    width: 100%;
    min-height: 2.4rem;
    padding: 0;
}

.batch-progress {
    position: relative;
    width: 100%;
    height: 1.6rem;
    background: color-mix(in srgb, var(--fw-primary) 10%, var(--fw-surface));
    border: 1px solid color-mix(in srgb, var(--fw-primary) 25%, transparent);
    border-radius: 999px;
    overflow: hidden;
}

.batch-progress__fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--fw-gradient);
    background-size: 200% 100%;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    animation: batch-progress-shimmer 1.6s linear infinite;
}

.batch-progress__label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--bs-body-color);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    text-shadow: 0 0 6px color-mix(in srgb, var(--fw-surface) 80%, transparent);
}

@keyframes batch-progress-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Processing state — pulsing border + traveling gradient bar */
.batch-card--processing {
    border-color: color-mix(in srgb, var(--fw-primary) 55%, transparent);
    animation: batch-card-pulse 1.8s ease-in-out infinite;
    overflow: hidden;
}

.batch-card--processing::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--fw-primary) 50%,
        transparent 100%);
    background-size: 200% 100%;
    animation: batch-card-bar 1.4s linear infinite;
}

@keyframes batch-card-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--fw-primary) 28%, transparent),
                    var(--fw-shadow-sm);
    }
    50% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--fw-primary) 18%, transparent),
                    var(--fw-shadow-md);
    }
}

@keyframes batch-card-bar {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .batch-card--processing,
    .batch-card--processing::after { animation: none; }
}

@media (max-width: 767.98px) {
    .batch-card {
        grid-template-columns: 1fr auto;
        padding: 0.75rem 0.9rem;
        row-gap: 0.6rem;
        column-gap: 0.75rem;
    }
    .batch-card__date { grid-column: 1; grid-row: 1; }
    .batch-card__chips { grid-column: 1 / -1; grid-row: 2; }
    .batch-card__metrics {
        grid-column: 1; grid-row: 3;
        display: inline-grid;
        grid-template-columns: auto auto;
        column-gap: 0.55rem;
        row-gap: 0;
        align-items: baseline;
        justify-content: start;
        text-align: left;
        white-space: nowrap;
        min-height: 0;
    }
    .batch-card__metrics--empty { display: none; }
    .batch-card__metrics--progress {
        grid-column: 1 / -1; grid-row: 3;
        display: flex;
        align-items: center;
    }
    .batch-card__savings-num { font-size: 0.95rem; padding: 0.25rem 0.55rem; min-width: 3.4rem; }
    .batch-card__sizes-out, .batch-card__sizes-orig { text-align: left; }
    .batch-card__actions { grid-column: 2; grid-row: 3; justify-self: end; align-self: center; }

    /* Compact download button: icon only, label hidden */
    .batch-card__download .batch-card__download-label { display: none; }
    .batch-card__download i { margin: 0; font-size: 1rem; }
    .batch-card__download { padding: 0.35rem 0.6rem; }
}

/* ----- Batch detail: per-item cards (reuses .batch-card visual language) ----- */
.item-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1.1rem;
    row-gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--fw-shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.18s ease;
}

/* Inside item-card, metrics hug the right edge instead of reserving 14rem */
.item-card .batch-card__metrics {
    grid-template-columns: auto auto;
    justify-content: end;
    justify-self: end;
    min-height: 0;
}

.item-card__head {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.item-card:hover { border-color: color-mix(in srgb, var(--fw-primary) 22%, transparent); }

.item-card--failed {
    border-color: color-mix(in srgb, #ef4444 35%, transparent);
    background: color-mix(in srgb, #ef4444 4%, var(--fw-surface));
}

.item-card__name {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--bs-body-color);
    min-width: 0;
}
.item-card__name i { color: var(--bs-secondary-color); font-size: 0.95rem; flex: none; }
.item-card__name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.item-card__error {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.1rem;
    padding-top: 0.5rem;
    border-top: 1px solid color-mix(in srgb, #ef4444 25%, transparent);
    color: #b91c1c;
    font-size: 0.82rem;
    line-height: 1.35;
}
.item-card__error i { font-size: 0.95rem; margin-top: 0.1rem; flex: none; }

[data-bs-theme='dark'] .item-card__error { color: #fecaca; }

@media (max-width: 767.98px) {
    .item-card {
        grid-template-columns: 1fr;
        padding: 0.7rem 0.85rem;
        row-gap: 0.5rem;
    }
    .item-card__head { grid-column: 1; }
    .item-card .batch-card__metrics {
        grid-column: 1;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.4rem;
        justify-content: flex-start;
        text-align: left;
        white-space: normal;
        min-height: 0;
    }
    .item-card .batch-card__metrics--empty { display: none; }
    .item-card .batch-card__savings-num { font-size: 1.1rem; }
    .item-card__error { padding-top: 0.4rem; }
}

/* Subtle, distinct background for format badges */
.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
}

.format-badge--webp {
    background: color-mix(in srgb, #0ea5e9 14%, transparent);
    border-color: color-mix(in srgb, #0ea5e9 35%, transparent);
    color: #0369a1;
}

.format-badge--avif {
    background: color-mix(in srgb, var(--fw-primary) 14%, transparent);
    border-color: color-mix(in srgb, var(--fw-primary) 35%, transparent);
    color: var(--fw-primary-strong);
}

[data-bs-theme='dark'] .format-badge--webp { color: #7dd3fc; }
[data-bs-theme='dark'] .format-badge--avif { color: var(--fw-accent); }

/* SEO landing pages: highlights, article body, related cards */
.seo-highlights {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    display: grid;
    gap: 0.5rem;
}
.seo-highlights li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}
.seo-highlights li i { color: var(--fw-primary); font-size: 1.1rem; flex-shrink: 0; }

.seo-article { margin-top: 2rem; }
.seo-section { margin-bottom: 2.25rem; }
.seo-section:last-child { margin-bottom: 0; }
.seo-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    letter-spacing: -0.01em;
}
.seo-body { line-height: 1.65; color: var(--bs-body-color); }
.seo-body p { margin: 0 0 0.85rem 0; }
.seo-body p:last-child { margin-bottom: 0; }
.seo-body ol, .seo-body ul { padding-left: 1.25rem; margin: 0 0 0.85rem 0; }
.seo-body li { margin-bottom: 0.35rem; }
.seo-body code {
    background: var(--fw-surface-muted);
    border: 1px solid var(--fw-border);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.88em;
}

.seo-faq .accordion-item {
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    margin-bottom: 0.6rem;
    border-radius: 10px !important;
    overflow: hidden;
}
.seo-faq .accordion-item:last-child { margin-bottom: 0; }
.seo-faq .accordion-button {
    font-weight: 600;
    font-size: 0.98rem;
    padding: 0.9rem 1.1rem;
}
.seo-faq .accordion-body {
    padding: 1rem 1.1rem 1.2rem;
    color: var(--bs-secondary-color);
    line-height: 1.6;
}

.seo-related {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.seo-related__card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--bs-body-color);
    transition: border-color 0.15s, transform 0.15s;
}
.seo-related__card:hover {
    border-color: color-mix(in srgb, var(--fw-primary) 35%, transparent);
    transform: translateY(-1px);
    color: var(--bs-body-color);
}
.seo-related__pair { font-weight: 600; }
.seo-related__cta { font-size: 0.85rem; color: var(--fw-primary-strong); }

/* Footer: converter quick-links grid */
.footer-converters {
    margin-bottom: 1.25rem;
}
.footer-converters__title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--bs-body-color);
    margin-bottom: 0.75rem;
}
.footer-converters__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}
.footer-converters__list li { display: block; }
.footer-converters__list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--fw-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--bs-body-color);
    background: var(--fw-surface);
    font-size: 0.92rem;
    font-weight: 600;
    transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.footer-converters__list a::after {
    content: "→";
    color: var(--fw-primary-strong);
    font-weight: 400;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s, transform 0.15s;
}
.footer-converters__list a:hover {
    border-color: color-mix(in srgb, var(--fw-primary) 35%, transparent);
    color: var(--fw-primary-strong);
    background: color-mix(in srgb, var(--fw-primary) 6%, var(--fw-surface));
    transform: translateY(-1px);
}
.footer-converters__list a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Footer: bottom legal links row */
.footer-legal {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--fw-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    align-items: center;
    font-size: 0.82rem;
}
.footer-legal a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.footer-legal a:hover { color: var(--fw-primary-strong); }
.footer-legal > span[aria-hidden="true"] { color: var(--fw-border); }
.footer-credit { margin-left: auto; color: var(--bs-body-color); }
.footer-credit a {
    color: var(--fw-primary-strong);
    text-decoration: none;
    font-weight: 600;
}
.footer-credit a:hover { color: var(--fw-primary); text-decoration: underline; }

/* SEO breadcrumb above hero */
.seo-breadcrumb { margin: 1.25rem 0 0.5rem; font-size: 0.85rem; }
.seo-breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    color: var(--bs-secondary-color);
}
.seo-breadcrumb li + li::before {
    content: "›";
    margin-right: 0.4rem;
    color: var(--fw-border);
}
.seo-breadcrumb a { color: var(--bs-secondary-color); text-decoration: none; }
.seo-breadcrumb a:hover { color: var(--fw-primary-strong); }
.seo-breadcrumb [aria-current="page"] { color: var(--bs-body-color); font-weight: 600; }


/* Cookie consent banner — fijo abajo, max-width 480px en desktop, full-width
   en móvil. Aceptar y rechazar visualmente equivalentes en peso. */
.cookie-consent {
    position: fixed;
    z-index: 1080;
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: 480px;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    border-radius: 14px;
    box-shadow: var(--fw-shadow-lg);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    animation: cookieConsentIn 0.25s ease-out;
}
@media (min-width: 576px) {
    .cookie-consent { left: auto; }
}
@keyframes cookieConsentIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cookie-consent__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bs-body-color);
}
.cookie-consent__text {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--bs-body-color);
}
.cookie-consent__text a { color: var(--fw-primary-strong); }
.cookie-consent__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cookie-consent__actions .btn {
    flex: 1 1 0;
    min-width: 120px;
    font-weight: 600;
}
