/* =========================================================================
   Patentiamoci.it - Gamified, Responsive (Desktop/Mobile), Modern UX
   ========================================================================= */

/* --- Variabili di Design (Design System) --- */
:root {
    --primary-color: #00F2FE;
    /* Azzurro Elettrico Pieno di Energia */
    --secondary-color: #4FACFE;
    /* Gradiente */
    --accent-color: #FF0844;
    /* Rosso attenzione per errori/alert */
    --success-color: #00C9FF;
    /* Verde/Azzurro successo */
    --bg-dark: #0F172A;
    /* Sfondo scuro elegante (Dark Mode di default) */
    --surface-dark: #1E293B;
    /* Card Scuri */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border-radius-xl: 24px;
    --border-radius-md: 16px;
    --transition-fast: 0.2s ease;

    --max-content-width: 1000px;
    --max-app-width: 600px;

    /* Effetti Gamification */
    --glow-primary: 0 0 20px rgba(0, 242, 254, 0.4);
    --glow-accent: 0 0 20px rgba(255, 8, 68, 0.4);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Tipografia */
.outfit-font {
    font-family: 'Outfit', sans-serif;
}

h1,
h2,
h3 {
    color: #fff;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.text-center {
    text-align: center;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Responsive Layout & Navbar --- */

.main-header {
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.35rem;
    font-weight: 800;
    cursor: pointer;
}

.desktop-nav {
    display: none;
    gap: 2rem;
    align-items: center;
}

.desktop-n.brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

/* Back Button Globale */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color var(--transition-fast);
    padding: 0.5rem 0;
}

.btn-back:hover {
    color: var(--primary-color);
}

/* Contenitore App Mobile-First Centrato su Desktop */
.app-wrapper {
    max-width: var(--max-app-width);
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    background: var(--bg-dark);
    /* Opzionale: sfuma i bordi su desktop enormi */
}

/* Feed Container Principale */
.feed-container {
    width: 100%;
    align-items: center;
    gap: 0.5rem;
}

.desktop-nav a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.desktop-nav a:hover {
    color: var(--primary-color);
}

.premium-link {
    color: #FFD700 !important;
}

.auth-buttons-container {
    display: flex;
    gap: 0.5rem;
}

.app-layout {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Moduli Specifici (Mobile First App approach) --- */
.feed-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--max-app-width);
    margin: 0 auto;
    position: relative;
}

/* --- Componenti: Card --- */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
    border: var(--glass-border);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

/* --- Sezione Hero / Gamification --- */
.hero-section {
    padding: 2rem 0;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(0, 242, 254, 0.1);
    color: var(--primary-color);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* --- Bottoni --- */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.85rem 1.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--bg-dark);
}

.btn-primary:active {
    filter: brightness(0.9);
    transform: scale(0.97);
}

.btn-outline {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #fff;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.gamified-btn {
    width: 100%;
    font-size: 1.2rem;
    padding: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--glow-primary);
    position: relative;
    overflow: hidden;
}

/* Animazioni Gamification */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* --- Grid Features desktop --- */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.feature-card {
    text-align: left;
    padding: 2rem;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* --- Quiz Engine: La magia del layout carte Tinder --- */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    max-width: var(--max-app-width);
    margin: 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 480px;
    /* Altezza fissa per assicurare l'allineamento perfetto delle card */
    margin: 2rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    /* Profondità 3D per le carte dietro */
}

.swipe-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--surface-dark);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transform-origin: 50% 100%;
    will-change: transform;
    user-select: none;
    touch-action: none !important;
    /* Forza hammer.js a non far scrollare la pagina */
}

/* Istruzioni Testuali Swipe sulle Carte (Gamificati) */
.swipe-hint-left,
.swipe-hint-right {
    position: absolute;
    top: 30%;
    transform: translateY(-50%);
    font-weight: 900;
    font-size: 3rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    text-shadow: 0px 4px 15px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

.swipe-hint-left {
    left: 10px;
    color: var(--accent-color);
    border: 5px solid var(--accent-color);
    padding: 5px 15px;
    border-radius: 12px;
    transform: rotate(-15deg);
}

.swipe-hint-right {
    right: 10px;
    color: var(--success-color);
    border: 5px solid var(--success-color);
    padding: 5px 15px;
    border-radius: 12px;
    transform: rotate(15deg);
}

.question-category {
    background: rgba(0, 242, 254, 0.1);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.question-image {
    max-width: 100%;
    max-height: 180px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    object-fit: contain;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    max-width: var(--max-app-width);
    margin: 1rem auto;
}

.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: scale(0.9);
}

.btn-false {
    background: var(--surface-dark);
    color: var(--accent-color);
    border: 2px solid rgba(255, 8, 68, 0.3);
}

.btn-true {
    background: var(--surface-dark);
    color: var(--success-color);
    border: 2px solid rgba(0, 201, 255, 0.3);
}

/* --- Mobile Bottom Nav --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: var(--max-app-width);
    transform: translateX(-50%);
    left: 50%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
    padding: 0.5rem;
}

.nav-item .icon {
    font-size: 1.3rem;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.premium {
    color: #FFD700;
    font-weight: bold;
}


/* --- Animazioni Gamificate --- */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0, 242, 254, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
    }
}

.slide-up-animation {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- Media Queries (Il vero Responsive) --- */
@media (min-width: 768px) {

    /* Mostra menu desktop, nascondi nav mobile */
    .desktop-nav {
        display: flex;
    }

    .bottom-nav.mobile-only {
        display: none;
    }

    /* Layout a Colonne per la Home */
    .features-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-title {
        font-size: 4rem;
    }

    body {
        padding-bottom: 0;
    }

    .ad-container {
        border-radius: var(--border-radius-md);
    }
}