/**
 * Design enhancements — frontend-design skill
 * Dirección: editorial cálido · marca Susanita · finanzas con carácter
 */

:root {
    --font-display: "Visby Round CF", "Century Gothic", sans-serif;
    --font-body: "Visby Round CF", "Century Gothic", sans-serif;

    --font-brand-heavy: var(--font-display);
    --font-brand-regular: var(--font-body);
    --font-web-ui: var(--font-body);

    --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-soft: 0 4px 24px rgba(26, 26, 26, 0.06);
    --shadow-panel: 0 12px 40px rgba(26, 26, 26, 0.09), 0 0 0 1px rgba(255, 255, 255, 0.65) inset;
    --shadow-float: 0 24px 64px rgba(212, 21, 25, 0.1), 0 8px 24px rgba(26, 26, 26, 0.08);

    --color-brand-bar: var(--susanita-red);
}

/* ─── Atmósfera ─────────────────────────────────────────── */
body {
    font-family: var(--font-body);
    font-weight: 400;
    background: #ddd8ce;
    letter-spacing: 0.01em;
}

.app-page-bg {
    background:
        rgba(255, 251, 235, 0.88),
        url('assets/images/fondo-susanita.png') center center / cover no-repeat;
    filter: blur(5px) saturate(1.08);
}

.app-grain {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.045;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
}

.app-accent-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
    opacity: 0.35;
}

.app-accent-orb--red {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -80px;
    background: rgba(212, 21, 25, 0.18);
    animation: orbDrift 18s ease-in-out infinite alternate;
}

.app-accent-orb--gold {
    width: 360px;
    height: 360px;
    bottom: -100px;
    left: -60px;
    background: rgba(248, 210, 9, 0.22);
    animation: orbDrift 22s ease-in-out infinite alternate-reverse;
}

@keyframes orbDrift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(24px, 16px) scale(1.08); }
}

/* ─── Header ────────────────────────────────────────────── */
.app-header {
    position: sticky;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: none;
    box-shadow: 0 1px 0 rgba(212, 21, 25, 0.06), var(--shadow-soft);
}

.app-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--color-brand-bar);
}

.header-titles h1 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--susanita-black);
    -webkit-text-fill-color: var(--susanita-black);
}

.header-subtitle {
    font-family: var(--font-body);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.72rem !important;
    font-weight: 600;
    color: var(--text-muted) !important;
}

.app-logo {
    transition: none;
}

.btn-header {
    border-radius: 999px;
    transition: transform 0.25s var(--ease-smooth), box-shadow 0.25s var(--ease-smooth), background 0.2s;
}

.btn-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.08);
}

/* ─── Step wizard ───────────────────────────────────────── */
.step-wizard {
    position: relative;
    padding: 0.5rem 0 1.25rem;
}

.step {
    transition: transform 0.4s var(--ease-spring);
}

.step.active {
    transform: scale(1.04);
}

.step.active .step-number {
    background: var(--color-brand-bar);
    box-shadow: 0 4px 16px rgba(212, 21, 25, 0.35);
}

.step.completed .step-number {
    background: var(--susanita-green);
    box-shadow: 0 4px 12px rgba(126, 188, 0, 0.35);
}

.step-label {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.step-line {
    background: rgba(212, 21, 25, 0.25);
    height: 2px;
}

/* ─── Paneles ───────────────────────────────────────────── */
.panel {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-panel);
    animation: panelReveal 0.55s var(--ease-out-expo) both;
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--susanita-red) 0%, var(--susanita-yellow) 100%);
    opacity: 0.55;
}

@keyframes panelReveal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.panel-header {
    border-bottom-color: rgba(212, 21, 25, 0.12);
    padding-left: calc(1.5rem + 4px);
}

.panel-header h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ─── Tablas ────────────────────────────────────────────── */
.data-table tbody tr {
    transition: background 0.2s var(--ease-smooth), box-shadow 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(248, 210, 9, 0.12);
    box-shadow: inset 3px 0 0 var(--susanita-red);
}

/* ─── Botones ───────────────────────────────────────────── */
.btn {
    font-family: var(--font-display);
    letter-spacing: 0.04em;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, background 0.2s, filter 0.2s;
}

.btn-primary {
    background: var(--susanita-red);
}

.btn-pay {
    background: var(--susanita-green);
    animation: payPulse 3s ease-in-out infinite;
}

@keyframes payPulse {
    0%, 100% { box-shadow: 0 8px 25px rgba(126, 188, 0, 0.35); }
    50%      { box-shadow: 0 12px 36px rgba(126, 188, 0, 0.5); }
}

/* ─── Resumen borrador / revisión ───────────────────────── */
.draft-review-summary {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.draft-summary-card {
    background: #fff;
    border: 1px solid rgba(248, 210, 9, 0.45);
    box-shadow: 0 2px 12px rgba(26, 26, 26, 0.05);
}

.draft-stat-card {
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.draft-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.08);
}

.draft-payable-bar {
    background: #fff;
}

.draft-payable-amount,
.draft-summary-total {
    font-family: var(--font-display) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
}

.draft-review-hint {
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--susanita-red);
    line-height: 1.5;
}

/* ─── Tarjetas de documentos (aprobador) ────────────────── */
.draft-invoice-item {
    animation: cardStagger 0.45s var(--ease-out-expo) both;
    box-shadow: 0 2px 8px rgba(26, 26, 26, 0.04);
}

.draft-invoice-item:nth-child(1) { animation-delay: 0.05s; }
.draft-invoice-item:nth-child(2) { animation-delay: 0.1s; }
.draft-invoice-item:nth-child(3) { animation-delay: 0.15s; }
.draft-invoice-item:nth-child(4) { animation-delay: 0.2s; }
.draft-invoice-item:nth-child(5) { animation-delay: 0.25s; }
.draft-invoice-item:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes cardStagger {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.draft-invoice-item.active {
    box-shadow: 0 4px 20px rgba(212, 21, 25, 0.15);
    transform: translateX(2px);
}

.draft-inv-header strong {
    font-family: var(--font-display);
    font-weight: 700;
}

.inv-action-btn {
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, background 0.2s;
}

.inv-action-approve:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
}

.inv-action-reject:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}

.draft-rejected-section {
    animation: panelReveal 0.5s var(--ease-out-expo) 0.15s both;
}

.draft-pdf-viewer {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    animation: panelReveal 0.6s var(--ease-out-expo) 0.2s both;
}

/* ─── Login ─────────────────────────────────────────────── */
.login-bg {
    background:
        rgba(255, 251, 235, 0.82),
        url('assets/images/fondo-susanita.png') center center / cover no-repeat;
}

.login-card {
    animation: loginReveal 0.75s var(--ease-out-expo) both;
    border: 1px solid rgba(212, 21, 25, 0.1);
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-brand-bar);
}

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

.login-title {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.login-logo-wrap {
    animation: none;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.login-btn-submit {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.login-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 21, 25, 0.35);
}

/* ─── Tarjetas de pagos guardados ───────────────────────── */
.draft-card {
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
    animation: cardStagger 0.45s var(--ease-out-expo) both;
}

.draft-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-float);
}

/* ─── Toasts ────────────────────────────────────────────── */
.toast {
    animation: toastIn 0.4s var(--ease-spring) both;
    backdrop-filter: blur(8px);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(24px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ─── Footer ──────────────────────────────────────────── */
.app-footer-inner {
    animation: panelReveal 0.6s var(--ease-out-expo) 0.3s both;
}

/* ─── Modales ───────────────────────────────────────────── */
.modal {
    animation: modalIn 0.4s var(--ease-out-expo) both;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ─── Accesibilidad: reducir movimiento ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
