/* ============================================================
   VARIABLES GLOBALES (thème complet)
   ============================================================ */
:root {
    /* --- Couleurs principales --- */
    --color-bg: #001824;
    --color-text: #b8cad3;
    --color-primary: #9f3ca1;   /* Violet */
    --color-secondary: #d5ad40;   /* Or */
    --color-tertiary: #d15eb5;  /* Rose */
    --color-quaternary: #33c8ca;  /* Bleu turquoise */
    --color-white: #ffffff;    

    /* --- Couleurs dérivées --- */
    --color-card-bg: rgba(255, 255, 255, 0.03);
    --color-card-border: rgba(255,255,255,0.1);

    /* --- Polices --- */
    --font-main: 'Outfit', sans-serif;

    /* --- Radius / arrondis --- */
    --radius-card: 1rem;
    --radius-pill: 9999px;

    /* --- Effets & décorations --- */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;

    /* --- Pour sablier --- */
    --hue: 295;
    --bg: hsl(var(--hue), 84%, 70%);
    --fg: hsl(var(--hue), 84%, 10%);
    --primary: hsl(var(--hue), 84%, 50%);
    --trans-dur: 0.3s;

}


/* ============================================================
   STYLES GLOBAUX
   ============================================================ */
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    scrollbar-width: thin;
    scrollbar-color: var(--color-secondary) var(--color-bg);
}

/* Scrollbars globales */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
    background-color: var(--color-secondary);
    border-radius: 4px;
}


/* ============================================================
   ANIMATIONS PERSONNALISÉES
   ============================================================ */

/* Définition du mouvement de haut en bas */
@keyframes levitation {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px); /* Le génie monte de 20 pixels */
    }
    100% {
        transform: translateY(0px); /* Il redescend */
    }
}

/* La classe à utiliser dans le HTML */
.animate-float {
    animation: levitation 6s ease-in-out infinite;
    /* 
       6s = durée d'un cycle complet (montée + descente)
       ease-in-out = accélère au milieu, ralentit aux extrémités (effet fluide)
       infinite = boucle pour toujours
    */
    will-change: transform; /* Optimisation pour la fluidité */
}


/* ============================================================
   CARDS & GLASS EFFECT
   ============================================================ */
.glass {
    background: var(--color-card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-card-border);
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; /* transition fluide */
}

.rounded-card {
    border-radius: var(--radius-card);
    border-bottom-right-radius: 0;
    cursor: pointer; /* optionnel, montre que c'est interactif */    
    position: relative;
    overflow: hidden;
}

.rounded-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.03); /* état normal */
    transition: background 0.3s ease;
    border-radius: var(--radius-card);
    border-bottom-right-radius: 0;
    z-index: 0;
}

.rounded-card:hover::before {
    background: rgba(255,255,255,0.10); /* état survol */
}

/* Contenu au-dessus de l'overlay */
.rounded-card > * {
    position: relative;
    z-index: 1;
}

/* Carte idée */

.idee-card {
    border-radius: var(--radius-card);    
    border-bottom-right-radius: 0;
}

.idee-nb {
    border-radius: var(--radius-card);    
    border-bottom-left-radius: 0;
    border-top-right-radius: 0;  
    display: inline-block;  
}

.idee-card .btn-ghost {
    color: var(--color-primary);
}

/* ============================================================
   INPUTS & SELECTS — Style commun
   ============================================================ */

.form-intro .rounded-card:hover, .form-intro .rounded-card:hover::before {
    background: var(--color-card-bg);
}

.input-magic {
    border: none;
    border-bottom: 2px solid var(--color-primary);
    background: var(--color-bg);
    color: white;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;

    transition: border-color var(--transition-fast),
                color var(--transition-fast),
                background-color var(--transition-fast);

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    position: relative;
    z-index: 1;
}

/* Hover & focus */
.input-magic:hover,
.input-magic:focus {
    border-color: var(--color-secondary);
    outline: none;
    background-color: var(--color-bg);
}

.input-magic option {
    color: var(--color-text);
    background-color: var(--color-bg);
}

.input-magic option:checked {
    background-color: var(--color-primary);
    color: var(--color-white);
}


/* ============================================================
   INPUT TEXTE — Pas de flèche
   ============================================================ */
.input-magic[type="text"] {
    padding-right: 0.5rem;
}


/* ============================================================
   INPUT CHECKBOX - Animation
   ============================================================ */
/* === CHECKBOX CUSTOM === */

.gk-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* On cache l’input système mais il reste accessible */
.gk-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* La case graphique */
.gk-checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-secondary);
    border-radius: 6px;
    display: inline-block;
    position: relative;
    transition: all 0.25s ease;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}

/* Le check (invisible par défaut) */
.gk-checkbox-box::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 10px;
    border-right: 3px solid white;
    border-bottom: 3px solid white;
    top: 1px;
    left: 6px;
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: all 0.25s ease;
}

/* === ÉTAT COCHÉ === */
.gk-checkbox-input:checked + .gk-checkbox-box {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    box-shadow: 0 0 12px 3px rgba(255, 255, 255, 0.35);

    /* Effet "pop" magique */
    animation: gkPop 0.25s ease forwards;
}

.gk-checkbox-input:checked + .gk-checkbox-box::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

/* Animation pop */
@keyframes gkPop {
    0%   { transform: scale(0.7); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}


/* ============================================================
   SELECT — Ajout flèche dorée
   ============================================================ */
.input-magic:not([type="text"]), .input-magic:not([type="email"]) {
    padding-right: 2rem;

    background-image: url("data:image/svg+xml,%3Csvg fill='%23d5ad40' height='16' viewBox='0 0 24 24' width='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}
.input-magic[type="email"], .input-magic[type="text"]  {
    background-image: none;
}

/* Options & optgroup */
.input-magic option {
    color: var(--color-bg);
    background-color: white;
}
.input-magic optgroup {
    font-weight: bold;
    color: var(--color-secondary);
    background-color: var(--color-bg);
    padding-bottom: 5px;
}
.input-magic option:hover {
    background-color: var(--color-secondary);
    color: var(--color-bg);
}

/* Scrollbar interne (Chrome/Safari) */
.input-magic::-webkit-scrollbar {
    width: 8px;
}
.input-magic::-webkit-scrollbar-track {
    background: var(--color-bg);
}
.input-magic::-webkit-scrollbar-thumb {
    background-color: var(--color-secondary);
    border-radius: 4px;
}


/* ============================================================
   SLIDER — Style premium
   ============================================================ */
.slide-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    outline: none;
    cursor: pointer;
}

/* Thumb WebKit */
.slide-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--color-primary);
    border: 2px solid var(--color-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}
.slide-thumb::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background-color: var(--color-secondary);
}

/* Thumb Firefox */
.slide-thumb::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--color-primary);
    border: 2px solid var(--color-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}
.slide-thumb::-moz-range-thumb:hover {
    transform: scale(1.2);
    background-color: var(--color-secondary);
}

/* Valeur slider */
.slider-value {
    display: inline-block;
    font-weight: bold;
    margin-left: 0.5rem;
    color: white;
}


/* ============================================================
   BOUTONS — Premium
   ============================================================ */

/* Bouton principal */
.btn-magic {
    background: linear-gradient(0deg, var(--color-primary), var(--color-tertiary));
    background-size: 200% 100%;
    background-position: left;

    display: inline-block;

    color: white;
    font-weight: 700;
    padding: 1rem 2rem;

    border-radius: var(--radius-pill);
    text-align: center;
    text-transform: uppercase;
    border: none;

    cursor: pointer;
    transition:
        transform var(--transition-fast),
        filter var(--transition-fast),
        background-position var(--transition-medium);
}

.btn-magic:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
    background-position: right;
}

.btn-magic:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
    background-position: left;
}

/* Bouton "ghost" */
.btn-ghost {
    position: relative;
    z-index: 1;
    overflow: hidden;

    color: var(--color-white);
    border: 2px solid var(--color-primary); /* bordure toujours visible */
    border-radius: var(--radius-pill);
    display: inline-block;
    padding: 1rem 2rem;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;

    transition: transform var(--transition-fast), color var(--transition-fast);
}

.btn-ghost::before {
    content: "";
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px; /* laisser la bordure visible */
    background: linear-gradient(0deg, var(--color-primary), var(--color-tertiary));
    opacity: 0;
    z-index: -1;
    border-radius: calc(var(--radius-pill) - 2px);
    transition: opacity var(--transition-medium);
}

.btn-ghost:hover::before {
    opacity: 1;
}

.btn-ghost:hover {
    color: var(--color-white);
    transform: scale(1.05);
}



/* --- Tailles pour les boutons --- */
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem; /* 14px approximativement */
}

.btn-medium {
    padding: 0.75rem 1.5rem;
    font-size: 1rem; /* 16px */
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem; /* 18px */
}


/* ============================================================
   UTILITAIRES
   ============================================================ */
.emoji-lg {
    font-size: 64px;
    line-height: 1;
}


/* ============================================================
   RESULTATS
   ============================================================ */   

section[x-cloak] { display: none !important; }


/* ========== HOURGLASS PURE CSS VERSION ========== */

.hourglass {
    --dur: 2s;
    display: block;
    margin: auto;
    width: 10em;
    height: auto;
}

/* animations appliquées à tous les éléments de l’animation */
.hourglass__glare-top,
.hourglass__glare-bottom,
.hourglass__model,
.hourglass__motion-thick,
.hourglass__motion-medium,
.hourglass__motion-thin,
.hourglass__sand-drop,
.hourglass__sand-fill,
.hourglass__sand-grain-left,
.hourglass__sand-grain-right,
.hourglass__sand-line-left,
.hourglass__sand-line-right,
.hourglass__sand-mound-top,
.hourglass__sand-mound-bottom {
    animation-duration: var(--dur);
    animation-iteration-count: infinite;
    animation-timing-function: cubic-bezier(0.83,0,0.17,1);
}

/* Liaisons animations → classes */
.hourglass__glare-top { animation-name: glare-top; }
.hourglass__glare-bottom { animation-name: glare-bottom; }

.hourglass__model {
    animation-name: hourglass-flip;
    transform-origin: 12.25px 16.75px;
}

.hourglass__motion-thick,
.hourglass__motion-medium,
.hourglass__motion-thin {
    transform-origin: 26px 26px;
}

.hourglass__motion-thick { animation-name: motion-thick; }
.hourglass__motion-medium { animation-name: motion-medium; }
.hourglass__motion-thin { animation-name: motion-thin; }

.hourglass__sand-drop { animation-name: sand-drop; }
.hourglass__sand-fill { animation-name: sand-fill; }

.hourglass__sand-grain-left { animation-name: sand-grain-left; }
.hourglass__sand-grain-right { animation-name: sand-grain-right; }

.hourglass__sand-line-left { animation-name: sand-line-left; }
.hourglass__sand-line-right { animation-name: sand-line-right; }

.hourglass__sand-mound-top { animation-name: sand-mound-top; }

.hourglass__sand-mound-bottom {
    animation-name: sand-mound-bottom;
    transform-origin: 12.25px 31.5px;
}

/* ========== KEYFRAMES (fidèles à l'original SCSS) ========== */

@keyframes hourglass-flip {
    from { transform: translate(13.75px,9.25px) rotate(-180deg); }
    24%, to { transform: translate(13.75px,9.25px) rotate(0); }
}

@keyframes glare-top {
    from { stroke: rgba(255,255,255,0); }
    24%, to { stroke: white; }
}

@keyframes glare-bottom {
    from { stroke: white; }
    24%, to { stroke: rgba(255,255,255,0); }
}

@keyframes motion-thick {
    from {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(.67turn);
    }
    20% {
        stroke: white;
        stroke-dashoffset: 141.11;
        transform: rotate(1turn);
    }
    40%, to {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(1.33turn);
    }
}

@keyframes motion-medium {
    from, 8% {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(.5turn);
    }
    20% {
        stroke: white;
        stroke-dashoffset: 147.53;
        transform: rotate(.83turn);
    }
    32%, to {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(1.17turn);
    }
}

@keyframes motion-thin {
    from, 4% {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(.33turn);
    }
    24% {
        stroke: white;
        stroke-dashoffset: 134.7;
        transform: rotate(.67turn);
    }
    44%, to {
        stroke: rgba(255,255,255,0);
        stroke-dashoffset: 153.94;
        transform: rotate(1turn);
    }
}

@keyframes sand-drop {
    from, 10% { stroke-dashoffset: 1; }
    70%, to { stroke-dashoffset: -107; }
}

@keyframes sand-fill {
    from, 10% { stroke-dashoffset: 55; }
    70%, to { stroke-dashoffset: -54; }
}

@keyframes sand-grain-left {
    from, 10% { stroke-dashoffset: 29; }
    70%, to { stroke-dashoffset: -22; }
}

@keyframes sand-grain-right {
    from, 10% { stroke-dashoffset: 27; }
    70%, to { stroke-dashoffset: -24; }
}

@keyframes sand-line-left {
    from, 10% { stroke-dashoffset: 53; }
    70%, to { stroke-dashoffset: -55; }
}

@keyframes sand-line-right {
    from, 10% { stroke-dashoffset: 14; }
    70%, to { stroke-dashoffset: -24.5; }
}

@keyframes sand-mound-top {
    from, 10% { transform: translate(0,0); }
    15% { transform: translate(0,1.5px); }
    51%, to { transform: translate(0,13px); }
}

@keyframes sand-mound-bottom {
    from, 31% { transform: scale(1,0); }
    56%, to { transform: scale(1,1); }
}


/* =============================== */
/* Cartes d’idées cadeaux */
/* =============================== */
section[x-show="results"] .grid > div {
  background-color: #f1f5f9; /* bg-slate-100 */
  color: #111827;            /* text-gray-900 */
  padding: 1.5rem;           /* p-6 */
  border-radius: 1.5rem;     /* rounded-2xl */
  border-bottom-right-radius: 0;
  position: relative;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease-in-out;
}

section[x-show="results"] .grid > div:hover {
  transform: scale(1.05);
}

/* Badge numéro idée */
section[x-show="results"] .grid > div .absolute {
  background-color: var(--kado);
  color: black;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Emoji */
section[x-show="results"] .grid > div .text-5xl {
  font-size: 3rem;
  margin: 1rem 0;
  text-align: center;
}

/* Titre idée */
section[x-show="results"] .grid > div h3 {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-secondary);
  margin-bottom: 0.5rem;
}

/* Description idée */
section[x-show="results"] .grid > div p {
  font-size: 0.875rem;
  color: #374151; /* text-gray-700 */
  margin-bottom: 1rem;
}


/* =============================== */
/* Cadre conseil bonus */
/* =============================== */
section[x-show="results"] .border-dashed {
  border-style: dashed;
  border-width: 2px;
  border-color: var(--color-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

section[x-show="results"] .border-dashed p {
  margin: 0.5rem 0;
}

/* Signature conseil */
section[x-show="results"] .border-dashed .font-bold {
  margin-top: 1rem;
}

/* =============================== */
/* Responsive tweaks */
/* =============================== */
@media (max-width: 768px) {
  section[x-show="results"] .grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   RATE LIMITER - MODAL & TOAST
   ============================================================ */

/* Modal de blocage (limite atteinte) */
.rate-limit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.rate-limit-modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 1, 24, 0.671);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(159, 60, 161, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-tertiary) 100%);
    padding: 1.5rem 2rem;
    border-radius: 18px 18px 0 0;
    text-align: center;
}

.modal-header h2 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-message {
    color: var(--color-text);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
}

.modal-hint {
    background: rgba(213, 173, 64, 0.1);
    border-left: 4px solid var(--color-secondary);
    padding: 1rem;
    border-radius: 8px;
    color: var(--color-secondary);
    font-size: 0.95rem;
    text-align: left;
    margin: 0;
}

.modal-hint strong {
    color: var(--color-secondary);
}

.modal-footer {
    padding: 0 2rem 2rem 2rem;
    text-align: center;
}

.btn-modal-close {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-tertiary) 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(159, 60, 161, 0.4);
}

.btn-modal-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(159, 60, 161, 0.6);
}

.btn-modal-close:active {
    transform: translateY(0);
}

/* Toast de warning (70% ou 90%) */
.rate-limit-warning {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 90%;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(255, 152, 0, 0.3);
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rate-limit-warning.show {
    transform: translateX(0);
    opacity: 1;
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.warning-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.warning-content p {
    color: white;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        margin: 0 10px;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-message {
        font-size: 1rem;
    }
    
    .rate-limit-warning {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
}