/* FASE 8: Fix Critici Design - Layout Tool Grid + Hero Buttons + Design Polish */

/* ========================================
   FIX 1: TOOL GRID - Griglia 4 colonne responsive (iLovePDF-style)
   ======================================== */

/* Override artistic-theme.min.css grid che usa minmax(300px, 1fr) */
.tools-grid,
.grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4 {
    display: grid !important;
    gap: 16px !important;
    max-width: 1400px;
    margin: 0 auto;
    /* Desktop (>1280px): 4 colonne */
    grid-template-columns: repeat(4, 1fr) !important;
}

/* Tablet large (1024px - 1280px): 3 colonne */
@media (max-width: 1280px) {
    .tools-grid,
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Tablet (768px - 1024px): 2 colonne */
@media (max-width: 1024px) {
    .tools-grid,
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile (<768px): 2 colonne (più leggibile di 1 colonna) */
@media (max-width: 768px) {
    .tools-grid,
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* Mobile piccolo (<480px): 1 colonna */
@media (max-width: 480px) {
    .tools-grid,
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   FIX 1b: TOOL CARD - Compatte stile iLovePDF
   ======================================== */

.tool-card {
    /* Override artistic-theme padding 2.5rem */
    padding: 20px !important;

    /* Altezza massima compatta */
    min-height: 180px;
    max-height: 200px;

    /* Sfondo bianco pulito con bordo sottile */
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;

    /* Ombra sottile */
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;

    /* Transitions smooth */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Layout interno */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    /* Lift effect */
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.12) !important;
    border-color: #cbd5e1 !important;
}

/* Dark mode tool cards */
.dark .tool-card {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

.dark .tool-card:hover {
    border-color: #4b5563 !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3) !important;
}

/* Icona tool - più piccola e compatta */
.tool-card .w-16.h-16,
.tool-card .tool-icon {
    width: 48px !important;
    height: 48px !important;
    margin-bottom: 12px !important;
    flex-shrink: 0;
}

/* Titolo tool - più piccolo */
.tool-card h3 {
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin-bottom: 6px !important;
    text-align: center;
    color: #1f2937;
}

.dark .tool-card h3 {
    color: #f3f4f6;
}

/* Descrizione tool - 2 righe max, testo piccolo */
.tool-card p {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #6b7280 !important;
    text-align: center;
    margin: 0 !important;

    /* Truncate a 2 righe */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .tool-card p {
    color: #9ca3af !important;
}

/* ========================================
   FIX 2: HERO BUTTONS - Bottoni veri, non link
   ======================================== */

/* Container bottoni hero - affiancati su desktop, impilati su mobile */
.hero-buttons,
.hero .flex.flex-col.sm\:flex-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    justify-content: center !important;
    align-items: center !important;
}

@media (max-width: 480px) {
    .hero-buttons,
    .hero .flex.flex-col.sm\:flex-row {
        flex-direction: column !important;
        align-items: center !important;
    }
}

/* Bottone primario "Inizia Subito" */
.hero-cta-primary,
a.hero-cta-primary {
    /* Bottone bianco su gradient */
    background: white !important;
    color: #2563eb !important;

    /* Padding generoso */
    padding: 14px 32px !important;

    /* Border radius medio */
    border-radius: 8px !important;

    /* Font semibold */
    font-size: 16px !important;
    font-weight: 600 !important;

    /* NO underline */
    text-decoration: none !important;

    /* Inline-flex per icon */
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    /* Shadow */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;

    /* Transition */
    transition: all 0.2s ease !important;
}

.hero-cta-primary:hover,
a.hero-cta-primary:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2) !important;
    color: #1d4ed8 !important;
    text-decoration: none !important;
}

/* Bottone secondario "Scopri di Più" */
.hero-cta-secondary,
a.hero-cta-secondary {
    /* Trasparente con bordo bianco */
    background: transparent !important;
    color: white !important;
    border: 2px solid white !important;

    /* Padding generoso */
    padding: 12px 32px !important; /* 12px perché border 2px */

    /* Border radius medio */
    border-radius: 8px !important;

    /* Font semibold */
    font-size: 16px !important;
    font-weight: 600 !important;

    /* NO underline */
    text-decoration: none !important;

    /* Inline-flex per icon */
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    /* Transition */
    transition: all 0.2s ease !important;
}

.hero-cta-secondary:hover,
a.hero-cta-secondary:hover {
    background: rgba(255,255,255,0.15) !important;
    transform: translateY(-2px) scale(1.02) !important;
    color: white !important;
    text-decoration: none !important;
}

/* ========================================
   FIX 3: TRUST BADGES - Hero section
   ======================================== */

.hero .flex.flex-wrap.justify-center.gap-6 {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
    margin-top: 48px !important;
}

.hero .flex.items-center.space-x-2 {
    /* Sfondo semi-trasparente */
    background: rgba(255,255,255,0.15) !important;
    backdrop-filter: blur(10px) !important;

    /* Padding pill */
    padding: 8px 16px !important;

    /* Border radius pill */
    border-radius: 20px !important;

    /* Border sottile */
    border: 1px solid rgba(255,255,255,0.2) !important;

    /* Display inline-flex */
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    /* Font size piccolo */
    font-size: 14px !important;
    font-weight: 500 !important;
    color: white !important;
}

/* ========================================
   FIX 4: SECTION TITLES - Più spazio tra sezioni
   ======================================== */

/* Titoli categoria con più margin-top */
.category-header {
    display: inline-block;
    position: relative;
    margin-top: 64px; /* Aumentato da default */
}

/* Prima categoria non ha margin-top extra */
.mb-16:first-of-type .category-header {
    margin-top: 0;
}

/* ========================================
   FIX 5: DESCRIZIONE SOTTO TITOLO PRINCIPALE
   ======================================== */

#tools .text-center.text-gray-600.dark\:text-gray-400.mb-16.max-w-2xl.mx-auto.text-lg {
    font-size: 16px !important; /* Ridotto da 18px (text-lg) */
    color: #6b7280 !important; /* Grigio medio */
    line-height: 1.6 !important;
}

.dark #tools .text-center.text-gray-600.dark\:text-gray-400.mb-16.max-w-2xl.mx-auto.text-lg {
    color: #9ca3af !important;
}

/* ========================================
   FIX 6: HEADER - Language selector più visibile
   ======================================== */

#lang-toggle {
    /* Aggiungi gap per separazione */
    margin-right: 4px !important;

    /* Font size più grande */
    font-size: 18px !important;
}

/* Gap tra dark mode toggle e altri elementi */
button[onclick="toggleDarkMode()"] {
    margin-left: 8px !important;
    margin-right: 8px !important;
}

/* ========================================
   FIX 7: HERO BADGE "56 Strumenti"
   ======================================== */

.hero .inline-block.mb-4.px-4.py-2 {
    background: rgba(255,255,255,0.2) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 20px !important;
    padding: 8px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
}

/* ========================================
   FIX 8: RESPONSIVE MOBILE IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Tool cards più compatte su mobile */
    .tool-card {
        padding: 16px !important;
        min-height: 160px;
    }

    .tool-card h3 {
        font-size: 14px !important;
    }

    .tool-card p {
        font-size: 12px !important;
    }

    /* Hero buttons stack vertically */
    .hero-cta-primary,
    .hero-cta-secondary {
        width: 100%;
        max-width: 300px;
        justify-content: center !important;
    }

    /* Trust badges più piccoli */
    .hero .flex.items-center.space-x-2 {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
}

/* ========================================
   FIX 9: AI TOOLS CARD - Override gradient background
   ======================================== */

/* AI tools cards hanno uno stile speciale con gradient */
a.tool-card.bg-gradient-to-br.from-purple-50.to-indigo-50 {
    background: white !important;
    border: 2px solid #99f6e4 !important; /* Teal border per distinguerle */
}

.dark a.tool-card.bg-gradient-to-br.from-purple-50.to-indigo-50 {
    background: #1f2937 !important;
    border: 2px solid #115e59 !important;
}

a.tool-card.bg-gradient-to-br.from-purple-50.to-indigo-50:hover {
    border-color: #2dd4bf !important;
}

.dark a.tool-card.bg-gradient-to-br.from-purple-50.to-indigo-50:hover {
    border-color: #14b8a6 !important;
}

/* ========================================
   FINE FIX FASE 8
   ======================================== */
