/* ============================================================
 * GDR Toolbox — Stili Principali
 * ============================================================
 * Organizzazione:
 *   1. CSS Custom Properties (variabili)
 *   2. Reset & Base
 *   3. Tipografia
 *   4. Layout & Container
 *   5. Header & Navigazione
 *   6. Hero Section
 *   7. Filtri & Chips
 *   8. Griglia & Card Tool
 *   9. Modal Embedded
 *  10. Pagina Tool Dedicata
 *  11. Pagina 404
 *  12. Footer
 *  13. Utilità & Animazioni
 *  14. Scrollbar Custom
 *  15. Responsive
 * ============================================================ */

/* ============================================================
 * 1. CSS CUSTOM PROPERTIES
 * ============================================================ */
:root {
    /* --- Dark Mode (default) --- */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --border: #2a2a4a;
    --border-hover: #4a4a7a;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a80;
    --overlay: rgba(0, 0, 0, 0.7);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.6);
    --input-bg: #12121a;

    /* --- Accent & Funzionali --- */
    --accent: #7c3aed;
    --accent-light: #8b5cf6;
    --accent-glow: rgba(124, 58, 237, 0.3);
    --gold: #f59e0b;
    --green: #10b981;
    --red: #ef4444;
    --blue: #3b82f6;
    --pink: #ec4899;
    --cyan: #06b6d4;

    /* --- Target Colors --- */
    --target-master: #ef4444;
    --target-player: #3b82f6;
    --target-both: #10b981;

    /* --- Spacing --- */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* --- Border Radius --- */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 50px;

    /* --- Transitions --- */
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* --- Fonts --- */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* --- Z-index scale --- */
    --z-header: 100;
    --z-dropdown: 200;
    --z-modal: 1000;
    --z-toast: 2000;
}

/* ============================================================
 * LIGHT MODE OVERRIDES
 * ============================================================ */
body.light-mode {
    --bg-primary: #f5f0e8;
    --bg-secondary: #ede7d9;
    --bg-card: #ffffff;
    --bg-card-hover: #faf7f2;
    --border: #d4c9b8;
    --border-hover: #b8a99a;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a60;
    --text-muted: #8a8a9a;
    --overlay: rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.15);
    --input-bg: #ffffff;
    --accent-glow: rgba(124, 58, 237, 0.2);
}

/* ============================================================
 * 2. RESET & BASE
 * ============================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

input {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* --- Focus Visible --- */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================================
 * 3. TIPOGRAFIA
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-light), var(--gold), var(--accent-light));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ============================================================
 * 4. LAYOUT & CONTAINER
 * ============================================================ */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section {
    padding: var(--space-2xl) 0;
}

/* ============================================================
 * 5. HEADER & NAVIGAZIONE
 * ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color var(--transition-slow), border-color var(--transition-slow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo-emoji {
    font-size: 1.8rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-tagline {
    display: none;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Desktop Nav */
.nav-desktop {
    display: none;
    align-items: center;
    gap: var(--space-sm);
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition);
    background: transparent;
}

.theme-toggle:hover {
    background: var(--bg-card);
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    gap: 5px;
    transition: background var(--transition);
}

.hamburger:hover {
    background: var(--bg-card);
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav */
.nav-mobile {
    display: none;
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.nav-mobile.open {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-mobile .nav-link {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

/* ============================================================
 * 6. HERO SECTION
 * ============================================================ */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-xl);
}

.hero h1 {
    margin-bottom: var(--space-md);
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
}

/* Search Bar */
.search-container {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-xl) var(--space-md) 48px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-card);
    transition: all var(--transition);
}

.search-clear.visible {
    display: flex;
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--border);
}

/* ============================================================
 * 7. FILTRI & CHIPS
 * ============================================================ */
.filters-section {
    padding: 0 0 var(--space-lg);
}

.filter-group {
    margin-bottom: var(--space-md);
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    display: block;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.chip {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
}

.chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.chip.tag-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent-light);
    color: var(--accent-light);
}

body.light-mode .chip.tag-chip.active {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* Results Bar */
.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border);
}

.results-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.results-count strong {
    color: var(--text-primary);
    font-weight: 600;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sort-select {
    padding: 6px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-reset {
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--red);
    color: #ffffff;
    transition: all var(--transition);
    display: none;
}

.btn-reset.visible {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.btn-reset:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================================
 * 8. GRIGLIA & CARD TOOL
 * ============================================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-slow);
    display: flex;
    flex-direction: column;
    position: relative;
    animation: cardFadeIn 0.4s ease both;
}

.tool-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
}

.tool-card.featured {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
}

.tool-card.featured::before {
    content: '★';
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 1rem;
    color: var(--gold);
    z-index: 2;
}

/* Card Preview Image */
.card-preview {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

/* Card Icon Header (quando non c'è preview) */
.card-icon-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-md) var(--space-md);
    font-size: 3rem;
    line-height: 1;
}

/* Card Body */
.card-body {
    padding: 0 var(--space-md) var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Card Badges */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.badge {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-target {
    color: #ffffff;
}

.badge-target.master { background: var(--target-master); }
.badge-target.player { background: var(--target-player); }
.badge-target.both   { background: var(--target-both); }

.badge-gdr {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Card Title */
.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    line-height: 1.3;
}

/* Card Description */
.card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

/* Card Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--space-md);
}

.tag-pill {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.65rem;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Card Footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.card-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.tool-card:hover .card-arrow {
    color: var(--accent-light);
    transform: translateX(3px);
}

/* Card Fade In Animation */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
    display: none;
}

.empty-state.visible {
    display: block;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
}

.empty-state h3 {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================
 * 9. MODAL EMBEDDED
 * ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: modalOverlayIn 0.2s ease;
}

.modal-overlay.open {
    display: flex;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1100px;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-elevated);
    animation: modalContentIn 0.3s ease;
}

@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: var(--space-md);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
    flex: 1;
}

.modal-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-badge {
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.modal-btn {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.modal-btn-external {
    background: var(--accent);
    color: #ffffff;
}

.modal-btn-external:hover {
    background: var(--accent-light);
}

.modal-btn-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.modal-btn-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow: hidden;
}

.modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

.modal-embed-fallback {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-2xl);
    text-align: center;
}

.modal-embed-fallback.visible {
    display: flex;
}

.modal-embed-fallback .fallback-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.modal-embed-fallback p {
    margin-bottom: var(--space-lg);
}

.btn-primary {
    padding: var(--space-md) var(--space-xl);
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--accent-light);
    color: #ffffff;
    transform: translateY(-1px);
}

/* ============================================================
 * 10. PAGINA TOOL DEDICATA
 * ============================================================ */
.tool-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--accent-light);
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.tool-info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

.tool-info-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.tool-info-content {
    flex: 1;
    min-width: 0;
}

.tool-info-content h1 {
    margin-bottom: var(--space-sm);
    font-size: 1.6rem;
}

.tool-info-content p {
    margin-bottom: var(--space-md);
}

.tool-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.tool-info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tool-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.btn-secondary {
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.tool-embed-container {
    flex: 1;
    min-height: 70vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

.tool-embed-container iframe {
    width: 100%;
    height: 100%;
    min-height: 70vh;
    border: none;
}

.tool-error {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
}

.tool-error-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.tool-error h1 {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.tool-error p {
    margin-bottom: var(--space-xl);
}

/* ============================================================
 * 11. PAGINA 404
 * ============================================================ */
.page-404 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xl);
}

.page-404-content {
    max-width: 500px;
}

.page-404-icon {
    font-size: 5rem;
    margin-bottom: var(--space-lg);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.page-404 h1 {
    font-size: 6rem;
    line-height: 1;
    margin-bottom: var(--space-md);
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.page-404 h2 {
    margin-bottom: var(--space-md);
}

.page-404 p {
    margin-bottom: var(--space-xl);
    font-size: 1rem;
}

.page-404-flavor {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.85rem !important;
    margin-bottom: var(--space-sm) !important;
    border-left: 3px solid var(--accent);
    padding-left: var(--space-md);
    text-align: left;
}

/* ============================================================
 * 12. FOOTER
 * ============================================================ */
.site-footer {
    border-top: 1px solid var(--border);
    padding: var(--space-xl) 0;
    text-align: center;
    margin-top: auto;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-text a {
    color: var(--text-secondary);
}

.footer-text a:hover {
    color: var(--accent-light);
}

/* ============================================================
 * 13. UTILITÀ & ANIMAZIONI
 * ============================================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
 * 14. SCROLLBAR CUSTOM
 * ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-primary);
}

/* ============================================================
 * 15. RESPONSIVE
 * ============================================================ */

/* >= 480px */
@media (min-width: 480px) {
    .logo-tagline {
        display: block;
    }
}

/* >= 768px */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-lg);
    }

    .hamburger {
        display: none;
    }

    .nav-desktop {
        display: flex;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* >= 1024px */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-xl);
    }

    .hero {
        padding: var(--space-3xl) 0 var(--space-2xl);
    }
}

/* <= 480px */
@media (max-width: 479px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        height: 95vh;
        max-height: 95vh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: var(--space-sm) var(--space-md);
    }

    .modal-title {
        font-size: 0.9rem;
    }

    .modal-btn-external span {
        display: none;
    }

    .tool-info-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .tool-info-badges,
    .tool-info-tags {
        justify-content: center;
    }

    .tool-actions {
        flex-direction: column;
    }

    .tool-actions .btn-primary,
    .tool-actions .btn-secondary {
        justify-content: center;
    }
}

/* <= 768px */
@media (max-width: 767px) {
    .modal-container {
        height: 92vh;
        max-height: 92vh;
    }

    .results-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
