/* CalcoloForfettario.it - Styles v3.0 */
/* Navy/orange palette. Professional, clean, trustworthy. */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8e;
    --accent: #e8913a;
    --accent-hover: #d47e2a;
    --green: #2a9d6e;
    --red: #d94f4f;
    --text: #1a1a2e;
    --text-light: #5a6275;
    --text-muted: #8892a4;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f0f3f7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-lg: 16px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
    --transition: all 0.2s ease;
    /* Legacy variable aliases for pages that still reference old names */
    --primary-color: var(--red);
    --secondary-color: var(--primary);
    --accent-color: var(--accent);
    --dark-bg: var(--text);
    --light-bg: var(--bg);
    --font-heading-legacy: var(--font-heading);
    --box-shadow: var(--shadow);
    --border-radius: var(--radius);
    --pop-green: var(--green);
    --pop-purple: #7c3aed;
    --success: var(--green);
    --error: var(--red);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }
strong { font-weight: 600; }
small { font-size: 0.875rem; color: var(--text-light); display: block; margin-top: 4px; }

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; color: var(--text); line-height: 1.3; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-bottom: 16px; }
h3 { font-size: 1.15rem; margin-bottom: 10px; }
h4 { font-size: 1rem; color: var(--text-light); font-weight: 600; }

/* LAYOUT */
.page-wrapper { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container, .calculator-container { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 24px; padding: 24px; }

/* HEADER */
header { padding: 16px 0; margin-bottom: 24px; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.logo { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.logo a { color: inherit; text-decoration: none; display: flex; align-items: baseline; gap: 2px; }
.logo a::after { content: ".it"; font-size: 0.75rem; color: var(--accent); font-weight: 700; }
.main-nav ul { display: flex; list-style: none; gap: 8px; flex-wrap: wrap; }
.main-nav a { color: var(--text-light); font-weight: 500; font-size: 0.9rem; padding: 6px 14px; border-radius: 6px; transition: var(--transition); }
.main-nav a:hover, .main-nav a.active { color: var(--primary); background: rgba(30,58,95,0.06); }

.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }

/* HERO */
.hero-title { text-align: center; padding: 40px 20px 24px; }
.hero-title h1 { color: var(--primary); }

.seo-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white; padding: 48px 24px; text-align: center;
    border-radius: var(--radius-lg); margin-bottom: 24px;
    position: relative; overflow: hidden;
}
.seo-hero::before { content: ''; position: absolute; top: -50%; right: -20%; width: 400px; height: 400px; background: rgba(255,255,255,0.04); border-radius: 50%; }
.seo-hero h1 { color: white; margin-bottom: 12px; }
.hero-description { font-size: 1.1rem; opacity: 0.9; max-width: 640px; margin: 0 auto 24px; line-height: 1.6; }
.hero-benefits { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.benefit { background: rgba(255,255,255,0.12); padding: 6px 16px; border-radius: 20px; font-size: 0.875rem; font-weight: 500; }
.benefit i { color: var(--accent); margin-right: 4px; }

/* BUTTONS */
button, .accent-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font); font-weight: 600; font-size: 0.95rem;
    border: none; border-radius: 8px; cursor: pointer; transition: var(--transition); line-height: 1;
}
button { background: var(--primary); color: white; padding: 14px 28px; box-shadow: 0 2px 8px rgba(30,58,95,0.2); }
button:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,58,95,0.25); }
button:disabled { background: var(--text-muted); cursor: not-allowed; transform: none; box-shadow: none; }
.accent-button { background: var(--accent); color: white; padding: 14px 28px; border-radius: 8px; text-decoration: none; box-shadow: 0 2px 8px rgba(232,145,58,0.25); }
.accent-button:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,145,58,0.35); }

/* INFO BOX */
.info-box { background: #f0f4ff; border-left: 4px solid var(--primary); padding: 20px; border-radius: var(--radius); margin: 16px 0; }
.info-box h2, .info-box h3 { color: var(--primary); margin-bottom: 8px; }
.info-box p { color: var(--text-light); }
.info-box .disclaimer { font-size: 0.85rem; margin-top: 10px; color: var(--text-muted); }
.button-container { text-align: center; margin-top: 20px; }

/* FORMS */
.form-container { padding: 20px; }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.form-group { flex: 1; min-width: 240px; max-width: calc(50% - 8px); }
label { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 6px; }
input, select, textarea {
    width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px;
    font-family: var(--font); font-size: 0.95rem; color: var(--text);
    background: var(--bg-card); transition: var(--transition);
}
select {
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235a6275'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,0.1); outline: none; }
.required { color: var(--red); }

/* MULTI-STEP FORM */
.multi-step-form { position: relative; }
.form-step { display: none; }
.form-step.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.steps-indicator { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: var(--transition); }
.step-dot.active { background: var(--primary); transform: scale(1.2); }
.step-dot.completed { background: var(--green); }

.step-navigation { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.step-navigation button { flex: 1; max-width: 220px; }
.step-navigation button.prev-step { background: var(--text-light); }
.step-navigation button.prev-step:hover { background: var(--text); }
.dynamic-fields { animation: fadeIn 0.3s ease; }

/* RESULTS */
.results-section { background: var(--bg-card); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); margin: 16px 0; }
.results-section h3 { color: var(--primary); margin-bottom: 16px; }
.results-section h4 { color: var(--primary); margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.03em; }
.result-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.result-item:last-child { border-bottom: none; }
.result-label { color: var(--text-light); font-size: 0.9rem; }
.result-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.result-highlight { background: var(--bg); padding: 14px 16px; border-radius: 8px; margin: 8px 0; }
.result-highlight .result-value { color: var(--primary); font-size: 1.05rem; }
.formula-text { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin: 2px 0 4px; }

/* EMAIL SECTION */
.email-section { background: linear-gradient(135deg, #f0f4ff 0%, #fef5eb 100%); padding: 24px; border-radius: var(--radius); margin: 16px 0; text-align: center; border: 1px solid var(--border); }
.email-section h3 { color: var(--primary); margin-bottom: 8px; }
.email-section p { color: var(--text-light); margin-bottom: 16px; }
.email-form { max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.pdf-button { background: var(--primary); color: white; padding: 14px 24px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: var(--transition); font-family: var(--font); font-size: 0.95rem; }
.pdf-button:hover { background: var(--primary-light); }
.pdf-button:disabled { background: var(--text-muted); cursor: not-allowed; }

/* MESSAGES */
.success-message, .error-message { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 8px; margin: 12px 0; font-size: 0.9rem; font-weight: 500; animation: fadeIn 0.3s ease; }
.success-message { background: rgba(42,157,110,0.08); border: 1px solid var(--green); color: var(--green); }
.error-message { background: rgba(217,79,79,0.08); border: 1px solid var(--red); color: var(--red); }
.success-message i, .error-message i { font-size: 1.1rem; flex-shrink: 0; }

/* FEATURE CARDS */
.feature-group { padding: 0; }
.feature-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: var(--transition); height: 100%; }
.feature-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.feature-item h3 { color: var(--primary); font-size: 1rem; margin-bottom: 8px; }
.feature-item h3 i { color: var(--accent); margin-right: 6px; }
.feature-item p { font-size: 0.9rem; color: var(--text-light); }

/* TESTIMONIALS */
.testimonials-container { display: block; }
.result.testimonials-container { display: block; background: transparent; box-shadow: none; padding: 0; }
.testimonials-section { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.testimonial-card { background: var(--bg-card); padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); position: relative; }
.testimonial-card::before { content: '\201C'; position: absolute; top: 12px; left: 16px; font-size: 40px; color: var(--accent); opacity: 0.2; font-family: Georgia, serif; line-height: 1; }
.testimonial-card p { position: relative; z-index: 1; font-size: 0.9rem; color: var(--text-light); font-style: italic; padding-left: 8px; }
.testimonial-author { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-light); }
.testimonial-author-name { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.testimonial-author-title { font-size: 0.8rem; color: var(--text-muted); }

/* BLOG POSTS */
.posts-grid, .blog-articles-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin: 20px 0; }
.post-card { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: var(--transition); display: flex; flex-direction: column; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.post-card-image { height: 180px; overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .post-card-image img { transform: scale(1.03); }
.post-card-content { padding: 16px; display: flex; flex-direction: column; flex-grow: 1; }
.post-date { display: inline-block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.post-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--primary); }
.post-card p { font-size: 0.875rem; color: var(--text-light); flex-grow: 1; margin-bottom: 12px; }
.post-meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-light); }
.post-category { font-size: 0.8rem; color: var(--accent); font-weight: 500; }
.read-more { color: var(--primary); font-weight: 600; font-size: 0.85rem; }
.read-more:hover { color: var(--accent); }

/* CALCULATOR PREVIEW */
.calculator-preview { display: flex; flex-direction: column; gap: 20px; margin: 20px 0; }
.calculator-preview-image img { border-radius: var(--radius); box-shadow: var(--shadow); }
.calculator-preview-text ul { list-style: none; padding: 0; }
.calculator-preview-text li { padding: 8px 0 8px 24px; position: relative; font-size: 0.95rem; }
.calculator-preview-text li::before { content: '\2713'; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.article-content { padding: 8px; }
.article-content h2 { color: var(--primary); margin-bottom: 16px; }

/* CTA BOXES */
.cta-studio { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: white; padding: 28px 24px; border-radius: var(--radius-lg); margin: 24px 0; text-align: center; }
.cta-studio h3 { color: white; font-size: 1.2rem; margin-bottom: 8px; }
.cta-studio p { opacity: 0.9; margin-bottom: 16px; }
.cta-studio .accent-button { background: var(--accent); }
.cta-invoicebuddy { background: #fef5eb; border: 1px solid #f5dbb8; border-radius: var(--radius); padding: 20px 24px; margin: 16px 0; display: flex; align-items: center; gap: 16px; }
.cta-invoicebuddy-icon { font-size: 2rem; flex-shrink: 0; }
.cta-invoicebuddy-text { flex: 1; }
.cta-invoicebuddy-text h4 { color: var(--accent-hover); margin-bottom: 4px; }
.cta-invoicebuddy-text p { font-size: 0.875rem; color: var(--text-light); margin-bottom: 8px; }
.cta-invoicebuddy-text a { color: var(--accent); font-weight: 600; font-size: 0.875rem; }

/* DISCLAIMER */
.disclaimer-box { background: #fffbeb; border: 1px solid #f5e6b8; border-radius: var(--radius); padding: 16px 20px; margin: 24px 0 16px; font-size: 0.85rem; color: var(--text-light); }
.disclaimer-box strong { color: var(--text); }

/* NEWSLETTER */
.newsletter-section { background: var(--primary); color: white; padding: 40px 24px; border-radius: var(--radius-lg); text-align: center; margin: 32px 0; }
.newsletter-section h2 { color: white; margin-bottom: 8px; }
.newsletter-section p { opacity: 0.85; margin-bottom: 20px; }
.newsletter-form { display: flex; max-width: 440px; margin: 0 auto 12px; gap: 0; }
.newsletter-form input { flex: 1; border: none; border-radius: 8px 0 0 8px; padding: 14px 16px; }
.newsletter-form button { border-radius: 0 8px 8px 0; background: var(--accent); padding: 14px 20px; white-space: nowrap; box-shadow: none; }
.newsletter-form button:hover { background: var(--accent-hover); transform: none; }
.form-disclaimer { font-size: 0.8rem; opacity: 0.6; }

/* EMOJI (toned down) */
.emoji { display: inline; margin-left: 4px; font-size: 1em; }

/* FOOTER */
footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 0.875rem; color: var(--text-light); }
.footer-content { display: flex; flex-direction: column; gap: 24px; margin-bottom: 20px; }
.footer-column h3 { font-size: 0.95rem; color: var(--text); margin-bottom: 12px; }
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 6px; }
.footer-column a { color: var(--text-light); font-size: 0.85rem; }
.footer-column a:hover { color: var(--primary); }
.footer-bottom { padding-top: 16px; padding-bottom: 16px; border-top: 1px solid var(--border-light); text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-light); }
th { background: var(--primary); color: white; font-weight: 600; font-size: 0.85rem; }
tr:hover { background: var(--bg); }
.highlight-row { background: rgba(30,58,95,0.04) !important; font-weight: 600; }

/* RESPONSIVE - TABLET */
@media (min-width: 640px) {
    .form-row { flex-direction: row; }
    .testimonials-section { grid-template-columns: repeat(2, 1fr); }
    .posts-grid, .blog-articles-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-content { flex-direction: row; flex-wrap: wrap; }
    .footer-column { flex: 1; min-width: 180px; }
}

/* RESPONSIVE - DESKTOP */
@media (min-width: 960px) {
    .page-wrapper { padding: 0 32px; }
    .container, .calculator-container { padding: 32px; }
    .logo { font-size: 1.6rem; }
    .testimonials-section { grid-template-columns: repeat(3, 1fr); }
    .posts-grid, .blog-articles-grid { grid-template-columns: repeat(3, 1fr); }
    .calculator-preview { flex-direction: row; }
    .step-navigation button { max-width: 200px; flex: 0; }
    button { width: auto; }
}

/* RESPONSIVE - MOBILE */
@media (max-width: 639px) {
    .site-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .main-nav ul { gap: 4px; }
    .main-nav a { padding: 4px 10px; font-size: 0.85rem; }
    button, .accent-button { width: 100%; justify-content: center; }
    .form-group { max-width: 100%; }
    .step-navigation { flex-direction: column; }
    .step-navigation button { max-width: 100%; }
    .cta-invoicebuddy { flex-direction: column; text-align: center; }
    .newsletter-form { flex-direction: column; }
    .newsletter-form input { border-radius: 8px; }
    .newsletter-form button { border-radius: 8px; }
    .email-form { flex-direction: column; }
}

/* Step header with inline anno select */
.step-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.step-header-row h3 {
    margin: 0;
}

.anno-select-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.anno-select-inline label {
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0;
    white-space: nowrap;
    font-size: 0.95rem;
}

.anno-select-inline select {
    padding: 6px 12px;
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    font-weight: 700;
    color: var(--secondary-color);
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 120px;
}

.anno-select-inline select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 107, 254, 0.15);
}

/* Credito d'imposta */
.credit-highlight {
    background: rgba(76, 217, 100, 0.1);
    border: 1px solid var(--success);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.credit-highlight .result-value {
    color: var(--success);
    font-size: 1.1rem;
}

/* AdSense Sidebar Layout - fixed positioning, non impatta il contenuto */
.page-with-ads {
    position: relative;
}

.ad-sidebar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 10;
}

.ad-sidebar-left {
    left: calc((100vw - 1120px) / 2 - 180px);
}

.ad-sidebar-right {
    right: calc((100vw - 1120px) / 2 - 180px);
}

.ad-sidebar ins {
    display: block;
    min-height: 600px;
}

.page-main-content {
    width: 100%;
}

/* Nascondi sidebar se lo schermo non ha spazio sufficiente (< 1500px) */
@media (max-width: 1500px) {
    .ad-sidebar {
        display: none;
    }
}
