/* public/css/theme.css */

/* ===== Theme tokens (global) ===== */
:root{
    --wine: #6a0f1f;
    --wine-2:#8b1530;

    --bg: #f5f6f8;
    --card:#ffffff;
    --text:#0f172a;
    --muted:#64748b;

    --border: rgba(15, 23, 42, .10);
    --shadow: 0 12px 30px rgba(2,6,23,.08);

    --chip-bg: rgba(106,15,31,.10);
    --chip-text: #5a0d1a;

    --nav: #0b0b0f;

    --radius: 18px;
    --toast-duration: 1800ms;

    /* I keep a consistent focus ring token. */
    --ring: color-mix(in srgb, var(--wine) 22%, transparent);
}

/* Dark theme overrides */
html[data-theme="dark"]{
    --bg:#0b0b0f;
    --card:#111218;
    --text:#f1f5f9;
    --muted:#a3adc2;

    --border: rgba(255,255,255,.10);
    --shadow: 0 16px 36px rgba(0,0,0,.35);

    --chip-bg: rgba(139,21,48,.22);
    --chip-text: #ffd6de;

    --nav:#000;
}

/* ===== Base ===== */
html, body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body{
    background: var(--bg) !important;
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    line-height: 1.35;
    min-height: 100vh;
}

.subtle{ color: var(--muted); }

/* I keep links consistent across pages. */
a {
    color: var(--wine);
}

a:hover {
    color: var(--wine-2);
}

a:active {
    opacity: .9;
}

/* I improve mobile tap feel. */
* {
    -webkit-tap-highlight-color: transparent;
}

/* I add a consistent focus ring across the app. */
:where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: none;
    box-shadow: 0 0 0 .25rem var(--ring);
    border-color: color-mix(in srgb, var(--wine) 55%, var(--border));
}

/* ===== Navbar ===== */
.app-navbar{
    background: linear-gradient(90deg, var(--nav), #151521) !important;
    border-bottom: 1px solid var(--border);
}

.brand-dot{
    width:10px; height:10px; border-radius:999px;
    background: var(--wine);
    display:inline-block;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--wine) 18%, transparent);
}

/* ===== Cards ===== */
.card-soft{
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

/* ===== Hero ===== */
.hero{
    background:
            radial-gradient(1200px 600px at 10% 0%, rgba(106,15,31,.20), transparent 55%),
            radial-gradient(900px 500px at 90% 10%, rgba(106,15,31,.10), transparent 60%);
    border-radius: calc(var(--radius) + 4px);
    padding: 22px;
    border: 1px solid var(--border);
}

/* ===== Buttons ===== */
.btn-wine{
    background: var(--wine);
    border-color: var(--wine);
    color:#fff;
}
.btn-wine:hover{
    background: var(--wine-2);
    border-color: var(--wine-2);
    color:#fff;
}

/* ===== Chips ===== */
.chip{
    display:inline-flex;
    align-items:center;
    gap:.5rem;
    padding:.45rem .7rem;
    border-radius:999px;
    background: var(--chip-bg);
    color: var(--chip-text);
    border: 1px solid var(--border);
    font-weight:600;
    font-size:.9rem;
    margin:.3rem .35rem 0 0;
    white-space:nowrap;
}

/* ===== Theme toggle button ===== */
/* I keep it readable anywhere (not only on navbar). */
.theme-btn{
    border:1px solid var(--border);
    background: transparent;
    color: var(--text);
    padding:.35rem .6rem;
    border-radius: 12px;
}

/* I force white only inside navbar. */
.app-navbar .theme-btn {
    color: #fff;
}

/* Sticky CTA helper (optional) */
.footer-cta{
    position: sticky;
    bottom: 14px;
    z-index: 5;
}
@media (min-width: 992px){
    .footer-cta{ position: static; }
}

/* =========================
   Toast Host (unificado: toast-stack + bootstrap containers)
   ========================= */
.toast-stack,
#toastHost,
.toast-host,
.toast-container,
.toast-container.position-fixed,
.toast-container.p-3{
    position: fixed;
    top: 16px;
    right: 16px;
    display: grid;
    gap: 10px;
    z-index: 9999;
}

@media (max-width:576px){
    .toast-stack,
    #toastHost,
    .toast-host,
    .toast-container,
    .toast-container.position-fixed,
    .toast-container.p-3{
        left: 12px;
        right: 12px;
        top: auto;
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* =========================
   Toast
   ========================= */
.toast.app-toast{
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--card) 82%, transparent);
    color: var(--text);
    box-shadow: 0 14px 40px rgba(2,6,23,.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;

    /* ✅ FIX: no min-width en móvil */
    min-width: 0;
    max-width: 420px;
}

@media (max-width:576px){
    .toast.app-toast{
        width: 100%;
        max-width: none;
        border-radius: 18px;
    }
}

.app-toast-inner{
    display:flex;
    align-items:flex-start;
    gap: 12px;
    padding: 12px 12px 10px 12px;
}

.app-toast-icon{
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size: 18px;
    background: color-mix(in srgb, var(--chip-bg) 70%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    flex: 0 0 auto;
}

.app-toast-content{ flex: 1 1 auto; min-width: 0; }
.app-toast-title{ font-weight: 750; letter-spacing: -.01em; line-height: 1.1; margin-top: 2px; }
.app-toast-body{
    margin-top: 4px;
    color: var(--muted);
    font-size: .93rem;
    line-height: 1.25;
    word-break: break-word;
}

@media (max-width:576px){
    .app-toast-body{ font-size: .95rem; }
}

.app-toast-close{ opacity: .75; margin-top: 2px; }
.app-toast-close:hover{ opacity: 1; }

/* Progress bar */
.app-toast-progress{
    height: 3px;
    width: 100%;
    background: color-mix(in srgb, var(--border) 70%, transparent);
    position: relative;
}
.app-toast-progress::before{
    content:"";
    position:absolute;
    inset:0;
    width: 100%;
    transform-origin: left;
    transform: scaleX(0);
    background: color-mix(in srgb, var(--wine) 80%, white);
    animation: toastProgress var(--toast-duration, 1800ms) linear forwards;
    border-radius: 999px;
}

@keyframes toastProgress{ to { transform: scaleX(1); } }

/* Variants via data-variant */
.toast.app-toast[data-variant="dark"] .app-toast-icon{ background: color-mix(in srgb, var(--chip-bg) 70%, transparent); }
.toast.app-toast[data-variant="dark"] .app-toast-progress::before{ background: color-mix(in srgb, var(--wine) 80%, white); }

.toast.app-toast[data-variant="success"] .app-toast-icon{ background: rgba(16,216,143,.14); }
.toast.app-toast[data-variant="success"] .app-toast-progress::before{ background: rgba(16,216,143,.95); }

.toast.app-toast[data-variant="warning"] .app-toast-icon{ background: rgba(241,220,33,.16); }
.toast.app-toast[data-variant="warning"] .app-toast-progress::before{ background: rgba(241,220,33,.95); }

.toast.app-toast[data-variant="danger"] .app-toast-icon{ background: rgba(252,127,139,.16); }
.toast.app-toast[data-variant="danger"] .app-toast-progress::before{ background: rgba(252,127,139,.95); }

.toast.app-toast[data-variant="info"] .app-toast-icon{ background: rgba(84,156,255,.14); }
.toast.app-toast[data-variant="info"] .app-toast-progress::before{ background: rgba(84,156,255,.95); }

/* ===== Bootstrap toast compatibility (si usas .toast-body y .btn-close) ===== */
.toast .toast-body{
    padding: 12px 14px;
    font-weight: 650;
}
.toast .btn-close{
    filter: none;
    opacity: .7;
}
.toast .btn-close:hover{ opacity: 1; }

/* I respect reduced motion preferences (animations/transitions). */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}