/* ==============================================
   AgeGate — Frontend Popup (Glassmorphism)
   Alta specificità con !important per resistere
   a temi e builder (Elementor, Divi, etc.)
   ============================================== */

/* ---- Overlay ---- */
#agegate-overlay,
#agegate-overlay.agegate-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2147483647 !important; /* max z-index */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: var(--agegate-font, system-ui, -apple-system, sans-serif) !important;
    -webkit-font-smoothing: antialiased !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-sizing: border-box !important;
    transform: none !important;
    float: none !important;
}

/* ---- Backdrop ---- */
#agegate-overlay .agegate-backdrop {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(var(--agegate-overlay-color, 0,0,0), var(--agegate-overlay-opacity, 0.75)) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    transform: none !important;
}

/* ---- Card (Glassmorphism) ---- */
#agegate-overlay .agegate-card {
    position: relative !important;
    width: 90% !important;
    max-width: var(--agegate-max-width, 480px) !important;
    padding: 48px 40px 36px !important;
    text-align: center !important;
    background: rgba(var(--agegate-card-bg, 26,26,26), 0.85) !important;
    backdrop-filter: blur(24px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.2) !important;
    border-radius: var(--agegate-radius, 16px) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05) !important;
    box-sizing: border-box !important;
    float: none !important;
    transform: none !important;
    margin: 0 auto !important;
    display: block !important;
    overflow: visible !important;
}

/* ---- Logo ---- */
#agegate-overlay .agegate-card__logo {
    display: block !important;
    max-width: 160px !important;
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto 24px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    object-fit: contain !important;
    background: transparent !important;
    float: none !important;
}

/* ---- Title ---- */
#agegate-overlay .agegate-card__title {
    margin: 0 0 12px !important;
    padding: 0 !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: var(--agegate-title-color, #ffffff) !important;
    letter-spacing: -0.02em !important;
    text-align: center !important;
    text-transform: none !important;
    text-shadow: none !important;
    background: transparent !important;
    border: none !important;
    font-family: var(--agegate-font, inherit) !important;
}

/* ---- Description ---- */
#agegate-overlay .agegate-card__description,
#agegate-overlay .agegate-card__description p {
    margin: 0 0 28px !important;
    padding: 0 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: var(--agegate-text-color, #cccccc) !important;
    text-align: center !important;
    background: transparent !important;
    border: none !important;
    font-family: var(--agegate-font, inherit) !important;
}

/* ---- Actions ---- */
#agegate-overlay .agegate-card__actions {
    margin-bottom: 8px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* ---- YES button ---- */
#agegate-overlay .agegate-btn--yes,
#agegate-overlay #agegate-yes,
#agegate-overlay #agegate-dob-submit {
    display: block !important;
    width: 100% !important;
    padding: 16px 32px !important;
    margin: 0 !important;
    background: var(--agegate-primary, #d4a574) !important;
    background-image: none !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: calc(var(--agegate-radius, 16px) * 0.5) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: var(--agegate-font, inherit) !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    cursor: pointer !important;
    transition: filter 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease !important;
    text-align: center !important;
    line-height: normal !important;
    box-sizing: border-box !important;
    float: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

#agegate-overlay .agegate-btn--yes:hover,
#agegate-overlay #agegate-yes:hover,
#agegate-overlay #agegate-dob-submit:hover {
    filter: brightness(1.15) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.3) !important;
    color: #ffffff !important;
}

/* ---- NO button ---- */
#agegate-overlay .agegate-btn--no,
#agegate-overlay #agegate-no {
    display: block !important;
    width: auto !important;
    margin: 14px auto 0 !important;
    padding: 8px !important;
    background: transparent !important;
    background-image: none !important;
    color: var(--agegate-text-color, #cccccc) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    font-family: var(--agegate-font, inherit) !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    cursor: pointer !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s, color 0.2s !important;
    text-align: center !important;
    float: none !important;
}

#agegate-overlay .agegate-btn--no:hover,
#agegate-overlay #agegate-no:hover {
    opacity: 1 !important;
    color: var(--agegate-primary, #d4a574) !important;
    background: transparent !important;
    text-decoration: none !important;
}

/* ---- Date of Birth mode ---- */
#agegate-overlay .agegate-dob {
    text-align: center !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

#agegate-overlay .agegate-dob__label {
    display: block !important;
    margin-bottom: 12px !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: normal !important;
    color: var(--agegate-text-color, #cccccc) !important;
    background: transparent !important;
    border: none !important;
    text-align: center !important;
}

#agegate-overlay .agegate-dob__input {
    display: block !important;
    width: 100% !important;
    padding: 14px 16px !important;
    margin-bottom: 16px !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: calc(var(--agegate-radius, 16px) * 0.5) !important;
    background: rgba(255,255,255,0.08) !important;
    color: var(--agegate-text-color, #cccccc) !important;
    font-size: 16px !important;
    font-family: var(--agegate-font, inherit) !important;
    text-align: center !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
}

#agegate-overlay .agegate-dob__input:focus {
    outline: none !important;
    border-color: var(--agegate-primary, #d4a574) !important;
}

#agegate-overlay .agegate-dob__error {
    display: none;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    font-size: 13px !important;
    color: #ef4444 !important;
    font-weight: 500 !important;
    background: transparent !important;
    border: none !important;
    text-align: center !important;
}

/* ---- Cookie notice ---- */
#agegate-overlay .agegate-card__cookie-notice {
    margin: 20px 0 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    color: var(--agegate-text-color, #cccccc) !important;
    opacity: 0.5 !important;
    background: transparent !important;
    border: none !important;
    text-align: center !important;
}

/* ==============================================
   LIGHT THEME
   ============================================== */
#agegate-overlay.agegate-theme-light {
    --agegate-title-color: #1a1a1a;
    --agegate-text-color: #555555;
    --agegate-card-bg: 255,255,255;
}

#agegate-overlay.agegate-theme-light .agegate-card {
    border-color: rgba(0,0,0,0.08) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.8) !important;
}

#agegate-overlay.agegate-theme-light .agegate-dob__input {
    border-color: rgba(0,0,0,0.15) !important;
    background: rgba(0,0,0,0.04) !important;
    color: #333 !important;
}

/* ==============================================
   ANIMATIONS
   ============================================== */

@keyframes agegate-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes agegate-card-slide-up {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes agegate-scale-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes agegate-blur-in {
    from { opacity: 0; filter: blur(20px); transform: scale(1.05); }
    to   { opacity: 1; filter: blur(0);    transform: scale(1); }
}

@keyframes agegate-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Fade */
#agegate-overlay.agegate-animate-fade .agegate-backdrop { animation: agegate-fade-in 0.4s ease-out both; }
#agegate-overlay.agegate-animate-fade .agegate-card     { animation: agegate-fade-in 0.5s ease-out both; }

/* Slide Up */
#agegate-overlay.agegate-animate-slide-up .agegate-backdrop { animation: agegate-fade-in 0.4s ease-out both; }
#agegate-overlay.agegate-animate-slide-up .agegate-card     { animation: agegate-card-slide-up 0.6s cubic-bezier(0.16,1,0.3,1) both; }

/* Scale */
#agegate-overlay.agegate-animate-scale .agegate-backdrop { animation: agegate-fade-in 0.4s ease-out both; }
#agegate-overlay.agegate-animate-scale .agegate-card     { animation: agegate-scale-in 0.5s cubic-bezier(0.16,1,0.3,1) both; }

/* Blur In */
#agegate-overlay.agegate-animate-blur-in .agegate-backdrop { animation: agegate-fade-in 0.5s ease-out both; }
#agegate-overlay.agegate-animate-blur-in .agegate-card     { animation: agegate-blur-in 0.6s cubic-bezier(0.16,1,0.3,1) both; }

/* Close */
#agegate-overlay.agegate-closing { animation: agegate-fade-out 0.3s ease-in forwards !important; pointer-events: none !important; }

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 480px) {
    #agegate-overlay .agegate-card {
        padding: 36px 24px 28px !important;
    }
    #agegate-overlay .agegate-card__title {
        font-size: 22px !important;
    }
    #agegate-overlay .agegate-card__description,
    #agegate-overlay .agegate-card__description p {
        font-size: 14px !important;
    }
    #agegate-overlay .agegate-card__logo {
        max-width: 120px !important;
    }
}

@media (max-width: 360px) {
    #agegate-overlay .agegate-card {
        padding: 28px 18px 22px !important;
    }
    #agegate-overlay .agegate-card__title {
        font-size: 20px !important;
    }
}
