/* ==========================================================================
   Tool Page Common Styles (tool-page-common.css)
   Stili condivisi tra le landing page dei tool di elaborazione testo
   (/tool/ai-watermark-remover-texts, /tool/claude-ai-watermark-remove, ecc.)
   Richiede style.css (palette, font, header, footer).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Bottoni Condivisi
   -------------------------------------------------------------------------- */
main .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-sizing: border-box;
}

main .btn:active {
    transform: scale(0.98);
}

main .btn-primary {
    background-color: var(--text-950);
    color: var(--background-50);
}

main .btn-primary:hover {
    background-color: var(--text-800);
}

main .btn-primary:disabled,
main .btn-primary.is-loading {
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Wrapper unificato Hero + Editor con sfondo dinamico via theme-bg-loader.js
   -------------------------------------------------------------------------- */
main .editor-top-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
    background-color: var(--navbar-bg);
}

main .editor-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

main .editor-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    will-change: opacity;
}

/* 1. Default (Tema Chiaro / Light Mode) */
main .editor-bg-white.loaded {
    opacity: 1;
}
main .editor-bg-dark.loaded {
    opacity: 0;
}

/* 2. Tema Scuro via prefers-color-scheme (sistema operativo) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light) main .editor-bg-white.loaded {
        opacity: 0;
    }
    :root:not([data-theme="light"]):not(.light) main .editor-bg-dark.loaded {
        opacity: 1;
    }
}

/* 3. Tema Scuro forzato via data-theme="dark" o classe .dark */
:root[data-theme="dark"] main .editor-bg-white.loaded,
body[data-theme="dark"] main .editor-bg-white.loaded,
html.dark main .editor-bg-white.loaded,
body.dark main .editor-bg-white.loaded {
    opacity: 0 !important;
}

:root[data-theme="dark"] main .editor-bg-dark.loaded,
body[data-theme="dark"] main .editor-bg-dark.loaded,
html.dark main .editor-bg-dark.loaded,
body.dark main .editor-bg-dark.loaded {
    opacity: 1 !important;
}

/* 4. Tema Chiaro forzato via data-theme="light" o classe .light */
:root[data-theme="light"] main .editor-bg-white.loaded,
body[data-theme="light"] main .editor-bg-white.loaded,
html.light main .editor-bg-white.loaded,
body.light main .editor-bg-white.loaded {
    opacity: 1 !important;
}

:root[data-theme="light"] main .editor-bg-dark.loaded,
body[data-theme="light"] main .editor-bg-dark.loaded,
html.light main .editor-bg-dark.loaded,
body.light main .editor-bg-dark.loaded {
    opacity: 0 !important;
}

/* --------------------------------------------------------------------------
   Hero Tipografia e Layout
   -------------------------------------------------------------------------- */
main .editor-hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 90px 20px 48px 20px;
    text-align: center;
    gap: 20px;
    background-color: transparent;
}

main .editor-hero .title h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 4.4vw, 3.4rem);
    font-weight: 500;
    line-height: 1.15;
    margin: 0;
    color: var(--text-950);
    max-width: 760px;
    letter-spacing: -0.015em;
}

main .editor-hero-subtitle {
    margin: 0;
    font-size: clamp(15px, 1.8vw, 18px);
    line-height: 1.6;
    color: var(--text-600);
    max-width: 620px;
}

/* --------------------------------------------------------------------------
   Editor Section & Container
   -------------------------------------------------------------------------- */
main .editor-section {
    position: relative;
    z-index: 1;
    padding: 24px 20px 100px 20px;
    background-color: transparent;
}

main .editor-container {
    max-width: 840px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --------------------------------------------------------------------------
   Sezione Funzionalità (Base Condivisa)
   -------------------------------------------------------------------------- */
main .features-section {
    padding: 100px 20px;
    background-color: var(--background-50);
}

main .features-container {
    max-width: 1120px;
    margin: 0 auto;
}

main .features-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 56px;
}

main .features-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3.4vw, 2.4rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-950);
}

main .features-header p {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-700);
    max-width: 640px;
}

main .feature-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 32px 28px;
    border-radius: 18px;
    background-color: var(--navbar-bg);
    border: 1px solid var(--text-200);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

main .feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--primary-50);
    color: var(--primary-600);
}

main .feature-card h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.18rem;
    font-weight: 500;
    color: var(--text-950);
}

main .feature-card p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-600);
}

/* --------------------------------------------------------------------------
   Sezione Domande Frequenti (FAQ Base Condivisa)
   -------------------------------------------------------------------------- */
main .faq-section {
    padding: 110px 20px 120px;
    background-color: var(--background-50);
    border-top: 1px solid var(--background-200);
}

main .faq-container {
    max-width: 900px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

main .faq-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

main .faq-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3.4vw, 2.4rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-950);
}

main .faq-header p {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-700);
    max-width: 680px;
}

main .faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

main .faq-item {
    background-color: var(--navbar-bg);
    border-radius: 18px;
    border: 1px solid var(--background-200);
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

main .faq-item:hover {
    border-color: var(--text-400);
}

main .faq-item[open] {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

main .faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    font-family: var(--font-heading);
    font-size: 1.12rem;
    font-weight: 500;
    color: var(--text-950);
    line-height: 1.35;
    transition: color 0.2s ease;
}

main .faq-question::-webkit-details-marker,
main .faq-question::marker {
    display: none;
}

main .faq-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--background-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--text-300);
    color: var(--text-700);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

main .faq-item[open] .faq-icon-wrapper {
    transform: rotate(180deg);
    background-color: var(--primary-500);
    color: #ffffff;
    border-color: var(--primary-500);
}

main .faq-answer {
    padding: 0 24px 24px 24px;
    font-size: 15px;
    color: var(--text-700);
    line-height: 1.65;
    animation: faqFadeIn 0.3s ease-out;
}

main .faq-answer p {
    margin: 0;
}

main .faq-answer p + p {
    margin-top: 14px;
}

@keyframes faqFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Responsive Condiviso
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    main .editor-hero {
        padding: 60px 16px 36px 16px;
        gap: 16px;
    }

    main .editor-hero .title h1 {
        font-size: 1.85rem;
    }

    main .editor-hero-subtitle {
        font-size: 14px;
    }

    main .editor-section {
        padding: 16px 16px 70px 16px;
    }

    main .features-section {
        padding: 70px 16px;
    }

    main .features-header h2 {
        font-size: 1.7rem;
    }

    main .features-header p {
        font-size: 14px;
    }

    main .faq-section {
        padding: 70px 16px;
    }

    main .faq-header h2 {
        font-size: 1.7rem;
    }

    main .faq-header p {
        font-size: 14px;
    }

    main .faq-container {
        gap: 32px;
    }

    main .faq-item {
        border-radius: 14px;
    }

    main .faq-question {
        padding: 18px 16px;
        font-size: 1rem;
        gap: 14px;
    }

    main .faq-icon-wrapper {
        width: 28px;
        height: 28px;
    }

    main .faq-answer {
        padding: 0 16px 18px 16px;
        font-size: 14px;
        line-height: 1.55;
    }
}
