/* ==========================================================================
   CupidIA ❤️ — Feuille de style premium
   Palette : rose pastel, blanc, rouge clair, violet doux
   Effets : glassmorphism, dégradés, animations douces, mode sombre
   ========================================================================== */

/* ---------- Variables de thème ---------- */
:root {
    --rose:        #ffb6c9;
    --rose-pastel: #ffe3ec;
    --rouge:       #ff5d73;
    --violet:      #b794f6;
    --violet-doux: #e9d8fd;
    --blanc:       #ffffff;

    --bg-1: #fff0f5;
    --bg-2: #ffe3ec;
    --bg-3: #f3e8ff;

    --text:        #4a2c3a;
    --text-soft:   #8a6b78;
    --card-bg:     rgba(255, 255, 255, 0.55);
    --card-border: rgba(255, 255, 255, 0.7);
    --shadow:      0 8px 32px rgba(255, 93, 115, 0.18);
    --shadow-soft: 0 4px 18px rgba(183, 148, 246, 0.15);
    --radius:      22px;
    --radius-sm:   14px;

    --grad-primary: linear-gradient(135deg, var(--rouge), var(--violet));
    --grad-soft:    linear-gradient(135deg, var(--rose-pastel), var(--violet-doux));

    --font: 'Poppins', system-ui, -apple-system, sans-serif;
    --font-fancy: 'Pacifico', cursive;
}

[data-theme="dark"] {
    --rose-pastel: #2a1f33;
    --bg-1: #1a1226;
    --bg-2: #221831;
    --bg-3: #2a1d3d;
    --text:      #f6e7ef;
    --text-soft: #c3a9be;
    --card-bg:     rgba(45, 30, 60, 0.55);
    --card-border: rgba(183, 148, 246, 0.25);
    --shadow:      0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.35);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    background-attachment: fixed;
    transition: background 0.5s ease, color 0.4s ease;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Glassmorphism ---------- */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
}

/* ---------- Barre supérieure ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 1rem;
    padding: 0.7rem 1.4rem;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.brand-logo { font-size: 1.7rem; animation: heartbeat 1.6s infinite; }
.brand-name { font-family: var(--font-fancy); font-size: 1.5rem;
    background: var(--grad-primary); -webkit-background-clip: text;
    background-clip: text; color: transparent; }

.main-nav { display: flex; gap: 0.4rem; margin-left: auto; flex-wrap: wrap; }
.main-nav a {
    padding: 0.5rem 0.95rem; border-radius: 999px; font-weight: 500;
    font-size: 0.95rem; transition: all 0.25s ease; white-space: nowrap;
}
.main-nav a:hover { background: var(--violet-doux); transform: translateY(-2px); }
.main-nav a.active { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow); }

.topbar-actions { display: flex; align-items: center; gap: 0.4rem; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem;
    display: grid; place-items: center; transition: all 0.25s ease;
    background: var(--card-bg); border: 1px solid var(--card-border);
}
.icon-btn:hover { transform: scale(1.12) rotate(8deg); box-shadow: var(--shadow); }
.icon-btn.active { background: var(--grad-primary); }
.user-chip {
    padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.85rem;
    font-weight: 600; background: var(--violet-doux);
}
.logout-link { font-size: 1.2rem; transition: transform 0.2s; }
.logout-link:hover { transform: translateX(3px); }
.burger { display: none; }

/* ---------- Conteneur ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem 4rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 2rem; }
.hero-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; }
.wave { display: inline-block; animation: wave 2s infinite; }
.hero-quote, .hero-subtitle { color: var(--text-soft); margin-top: 0.4rem; font-size: 1.05rem; }

.section-title { font-size: 1.5rem; font-weight: 600; margin: 1.5rem 0 1rem; }
.muted { color: var(--text-soft); }
.page-head { margin-bottom: 1rem; }

/* ---------- Alertes ---------- */
.alert {
    padding: 0.9rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.2rem;
    font-weight: 500;
}
.alert-new { background: var(--grad-soft); border: 1px solid var(--violet); }
.alert-error { background: rgba(255, 93, 115, 0.15); color: var(--rouge);
    border: 1px solid var(--rouge); text-align: center; }

/* ---------- Statistiques (dashboard) ---------- */
.stats-grid {
    display: grid; gap: 1rem; margin-bottom: 1.6rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-card {
    padding: 1.3rem 1rem; border-radius: var(--radius); text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.stat-icon { font-size: 1.8rem; display: block; }
.stat-value { font-size: 2rem; font-weight: 700; display: block; line-height: 1.2;
    background: var(--grad-primary); -webkit-background-clip: text;
    background-clip: text; color: transparent; }
.stat-value.stat-small { font-size: 1.2rem; }
.stat-label { font-size: 0.85rem; color: var(--text-soft); }

/* ---------- Bonheur du couple ---------- */
.happiness { padding: 1.4rem; border-radius: var(--radius); margin-bottom: 1.6rem; }
.happiness-head { display: flex; justify-content: space-between; align-items: center; }
.happiness-head h2 { font-size: 1.2rem; }
.happiness-pct { font-weight: 700; font-size: 1.3rem; color: var(--rouge); }
.happiness-bar { height: 18px; border-radius: 999px; background: var(--violet-doux);
    overflow: hidden; margin: 0.8rem 0 0.5rem; }
.happiness-fill { height: 100%; border-radius: 999px; background: var(--grad-primary);
    transition: width 1.2s cubic-bezier(.16,1,.3,1);
    background-size: 200% 100%; animation: shimmer 3s linear infinite; }
.happiness-hint { font-size: 0.85rem; color: var(--text-soft); }

.last-used { padding: 1.2rem 1.4rem; border-radius: var(--radius); margin-bottom: 1.6rem; }
.last-used h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }

/* ---------- Bouton CupidIA choisit ---------- */
.cupid-pick { text-align: center; margin: 2rem 0; }
#cupidPickResult { margin-top: 1.2rem; }
.featured { margin-bottom: 1rem; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.75rem 1.5rem; border-radius: 999px; font-weight: 600;
    transition: all 0.25s ease;
}
.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 12px 30px rgba(255,93,115,.35); }
.btn-primary:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-large { font-size: 1.1rem; padding: 1rem 2rem; }

/* ---------- Filtres (chips) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }
.chip {
    padding: 0.45rem 1rem; border-radius: 999px; font-size: 0.88rem; font-weight: 500;
    background: var(--card-bg); border: 1px solid var(--card-border); transition: all 0.2s;
}
.chip:hover { transform: translateY(-2px); }
.chip.active { background: var(--grad-primary); color: #fff; }

/* ---------- Grille de cartes ---------- */
.cards-grid {
    display: grid; gap: 1.3rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ---------- Carte coupon ---------- */
.coupon-card {
    position: relative; padding: 1.4rem; border-radius: var(--radius);
    display: flex; flex-direction: column; overflow: hidden;
    transition: transform 0.35s cubic-bezier(.16,1,.3,1), box-shadow 0.35s ease;
    border-top: 4px solid var(--rose);
}
.coupon-card:hover { transform: translateY(-8px) rotate(-0.4deg); box-shadow: var(--shadow); }
.coupon-card.hide { display: none; }

.card-glow {
    position: absolute; inset: -40% -40% auto auto; width: 180px; height: 180px;
    background: radial-gradient(circle, var(--rose) 0%, transparent 70%);
    opacity: 0.25; pointer-events: none; transition: opacity 0.4s;
}
.coupon-card:hover .card-glow { opacity: 0.5; }

/* Bordures par rareté */
.r-commun     { border-top-color: #cbd5e1; }
.r-peucommun  { border-top-color: #4ade80; }
.r-rare       { border-top-color: #38bdf8; }
.r-epique     { border-top-color: var(--violet); }
.r-legendaire { border-top-color: #fb923c; }

.card-special {
    border-top-width: 5px;
    box-shadow: 0 0 0 1px var(--violet), var(--shadow);
    animation: glowPulse 2.4s ease-in-out infinite;
}

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.card-icon { font-size: 2rem; }
.rarete-badge {
    font-size: 0.78rem; font-weight: 600; padding: 0.25rem 0.7rem;
    border-radius: 999px; background: rgba(255,255,255,0.5); white-space: nowrap;
}
[data-theme="dark"] .rarete-badge { background: rgba(0,0,0,0.25); }

.pour-badge {
    display: inline-block; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.5rem;
    padding: 0.2rem 0.65rem; border-radius: 999px;
    background: var(--grad-soft); border: 1px solid var(--card-border);
}
.card-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.45rem; }
.card-desc { font-size: 0.92rem; color: var(--text-soft); margin-bottom: 0.9rem; flex: 1; }

.card-meta { list-style: none; display: grid; gap: 0.3rem; font-size: 0.82rem; margin-bottom: 1rem; }
.card-meta li { display: flex; justify-content: space-between; gap: 0.5rem; }
.meta-k { color: var(--text-soft); }
.meta-v { font-weight: 500; text-align: right; }

.card-actions { display: flex; gap: 0.4rem; align-items: center; }
.act-btn {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; font-size: 1.05rem;
    display: grid; place-items: center; background: var(--card-bg);
    border: 1px solid var(--card-border); transition: all 0.22s;
}
.act-btn:hover { transform: scale(1.15); box-shadow: var(--shadow-soft); }
.fav-btn.is-fav { animation: pop 0.4s ease; }
.btn-use {
    flex: 1; width: auto; border-radius: 999px; font-weight: 600;
    background: var(--grad-primary); color: #fff;
}
.btn-use:hover { transform: translateY(-2px); }

/* ---------- Historique / timeline ---------- */
.timeline { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.history-card { padding: 1.3rem; border-radius: var(--radius); border-left: 4px solid var(--rose); }
.history-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }

/* ---------- Succès ---------- */
.achievement-grid {
    display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.achievement {
    padding: 1.1rem; border-radius: var(--radius); text-align: center;
    background: var(--card-bg); border: 1px solid var(--card-border);
    transition: transform 0.3s;
}
.achievement:hover { transform: translateY(-4px); }
.achievement.locked { opacity: 0.5; filter: grayscale(0.6); }
.achievement.unlocked { box-shadow: var(--shadow-soft); }
.ach-icon { font-size: 2rem; display: block; }
.ach-title { font-weight: 600; display: block; margin: 0.3rem 0; }
.ach-desc { font-size: 0.78rem; color: var(--text-soft); display: block; }
.ach-state { font-size: 0.72rem; display: block; margin-top: 0.4rem; font-weight: 600; }

/* ---------- Statistiques détaillées ---------- */
.detailed-stats { margin-top: 1.5rem; }
.stats-columns { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-block { padding: 1.3rem; border-radius: var(--radius); }
.stat-block h3 { font-size: 1.05rem; margin-bottom: 0.9rem; }
.bar-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; font-size: 0.88rem; }
.bar-label { flex: 0 0 42%; }
.bar-track { flex: 1; height: 10px; border-radius: 999px; background: var(--violet-doux); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--grad-primary); transition: width 1s ease; }
.bar-fill.r-commun { background: #cbd5e1; }
.bar-fill.r-peucommun { background: #4ade80; }
.bar-fill.r-rare { background: #38bdf8; }
.bar-fill.r-epique { background: var(--violet); }
.bar-fill.r-legendaire { background: #fb923c; }
.bar-val { flex: 0 0 auto; font-weight: 600; min-width: 24px; text-align: right; }

/* ---------- Calendrier ---------- */
.calendar-section { margin-top: 1.5rem; }
.calendar { padding: 1.2rem; border-radius: var(--radius); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-dayname { text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }
.cal-cell {
    position: relative; aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center;
    background: rgba(255,255,255,0.35); font-size: 0.85rem; transition: transform 0.2s;
}
[data-theme="dark"] .cal-cell { background: rgba(0,0,0,0.2); }
.cal-cell.empty { background: transparent; }
.cal-cell.has-coupon { background: var(--grad-soft); font-weight: 600; }
.cal-cell.has-coupon:hover { transform: scale(1.08); }
.cal-cell.today { box-shadow: 0 0 0 2px var(--rouge); }
.cal-num { position: absolute; top: 4px; left: 6px; font-size: 0.72rem; color: var(--text-soft); }
.cal-dot { font-size: 0.95rem; }

/* ---------- État vide ---------- */
.empty-state { text-align: center; padding: 3rem 1.5rem; border-radius: var(--radius); }
.empty-icon { font-size: 3rem; display: block; margin-bottom: 0.8rem; }

/* ---------- Page de connexion ---------- */
.login-body { display: grid; place-items: center; padding: 1.5rem; }
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 2.5rem 2rem; border-radius: 28px; text-align: center; }
.login-logo { font-size: 3.5rem; animation: heartbeat 1.6s infinite; }
.login-title { font-family: var(--font-fancy); font-size: 2.6rem;
    background: var(--grad-primary); -webkit-background-clip: text;
    background-clip: text; color: transparent; }
.login-subtitle { color: var(--text-soft); margin-bottom: 1.6rem; }
.login-form { display: grid; gap: 1rem; }
.input-romantic {
    width: 100%; padding: 0.9rem 1.2rem; border-radius: 999px; font-size: 1rem;
    text-align: center; background: var(--card-bg); color: var(--text);
    border: 1.5px solid var(--card-border); transition: all 0.25s; font-family: inherit;
}
.input-romantic:focus { outline: none; border-color: var(--rouge);
    box-shadow: 0 0 0 4px rgba(255,93,115,0.15); }
.login-hint { margin-top: 1.4rem; font-size: 0.85rem; color: var(--text-soft); }

/* ---------- Pied de page ---------- */
.site-footer { text-align: center; padding: 2rem 1rem; color: var(--text-soft); font-size: 0.9rem; }
.footer-quote { font-style: italic; margin-top: 0.3rem; }

/* ---------- Cœurs flottants ---------- */
.floating-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.floating-hearts .fh {
    position: absolute; bottom: -40px; font-size: 1.4rem; opacity: 0;
    animation: floatUp linear infinite;
}

/* ---------- Confettis ---------- */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    z-index: 1000; display: grid; gap: 0.5rem; }
.toast {
    padding: 0.9rem 1.4rem; border-radius: 999px; font-weight: 600; color: #fff;
    background: var(--grad-primary); box-shadow: var(--shadow);
    animation: toastIn 0.4s ease, toastOut 0.4s ease 2.6s forwards;
}

/* ---------- Modale de confirmation ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center;
    background: rgba(40, 20, 40, 0.45); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
    width: min(90vw, 420px); padding: 2rem; border-radius: var(--radius); text-align: center;
    transform: scale(0.85); transition: transform 0.3s cubic-bezier(.16,1,.3,1);
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-icon { font-size: 3rem; }
.modal h3 { margin: 0.6rem 0; font-size: 1.3rem; }
.modal p { color: var(--text-soft); margin-bottom: 1.4rem; }
.modal-actions { display: flex; gap: 0.8rem; justify-content: center; }
.btn-ghost { background: var(--card-bg); border: 1px solid var(--card-border); }
.btn-ghost:hover { background: var(--violet-doux); }

/* ---------- Animations ---------- */
.fade-in { animation: fadeIn 0.7s ease both; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
.shake { animation: shake 0.5s; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 14% { transform: scale(1.25); } 28% { transform: scale(1); } 42% { transform: scale(1.2); } 70% { transform: scale(1); } }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 30% { transform: rotate(14deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@keyframes floatUp { 0% { transform: translateY(0) scale(0.8) rotate(0); opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.7; } 100% { transform: translateY(-110vh) scale(1.2) rotate(40deg); opacity: 0; } }
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@keyframes glowPulse { 0%,100% { box-shadow: 0 0 0 1px var(--violet), var(--shadow); } 50% { box-shadow: 0 0 22px 2px var(--violet), var(--shadow); } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(20px); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .main-nav {
        position: fixed; top: 64px; right: 0; flex-direction: column; align-items: stretch;
        width: 220px; padding: 1rem; gap: 0.4rem; border-radius: 0 0 0 var(--radius);
        background: var(--card-bg); backdrop-filter: blur(16px);
        border: 1px solid var(--card-border); transform: translateX(120%);
        transition: transform 0.3s ease; z-index: 49;
    }
    .main-nav.open { transform: translateX(0); }
    .burger { display: grid; }
    .user-chip { display: none; }
}
