/* ============================================
   CREWBITZ — MOBILE OVERRIDES
   File caricato SOLO su schermi <= 768px
   tramite <link media="(max-width: 768px)">
   NON TOCCA IL DESKTOP.
   ============================================ */

/* ------------------------------------------------
   0. ANTI-OVERFLOW
   ------------------------------------------------ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

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

img, video, svg, iframe, canvas {
    max-width: 100% !important;
    height: auto;
}

/* ------------------------------------------------
   1. NAVBAR — hide desktop links, show hamburger
   ------------------------------------------------ */
header nav {
    padding: 10px 16px !important;
}

.nav-links {
    display: none !important;
}

.nav-left {
    gap: 12px !important;
}

.nav-logo span {
    font-size: 1.15rem !important;
}

.nav-logo svg {
    width: 20px !important;
    height: 20px !important;
}

/* Hide desktop buttons except primary CTA */
.nav-actions .btn-secondary {
    display: none !important;
}

/* Hide language switcher on nav (it's in mobile menu) */
.nav-actions > a[style*="font-size"] {
    display: none !important;
}

.nav-actions .btn-primary {
    font-size: 0.78rem !important;
    padding: 7px 12px !important;
}

/* === HAMBURGER BUTTON (injected by mobile-menu.js) === */
#mobile-hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-900, #111827);
    margin-left: 8px;
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] #mobile-hamburger {
    color: #FAFAFA;
}

/* === MOBILE MENU PANEL (injected by mobile-menu.js) === */
#mobile-nav-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg, #FAFBFC);
    z-index: 9999;
    padding: 0;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobile-nav-panel.open {
    display: flex;
}

[data-theme="dark"] #mobile-nav-panel {
    background: #000000;
}

#mobile-nav-panel .mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, #E5E7EB);
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-header {
    border-bottom-color: #262626;
}

#mobile-nav-panel .mobile-nav-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-900, #111827);
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-close {
    color: #FAFAFA;
}

#mobile-nav-panel .mobile-nav-links {
    padding: 16px 0;
    flex: 1;
}

#mobile-nav-panel .mobile-nav-links a {
    display: block;
    padding: 16px 24px;
    color: var(--gray-700, #374151);
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border, #E5E7EB);
    transition: background 0.15s;
}

#mobile-nav-panel .mobile-nav-links a:last-child {
    border-bottom: none;
}

#mobile-nav-panel .mobile-nav-links a:hover,
#mobile-nav-panel .mobile-nav-links a:active {
    background: var(--gray-50, #F9FAFB);
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-links a {
    color: #FAFAFA;
    border-bottom-color: #262626;
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-links a:hover,
[data-theme="dark"] #mobile-nav-panel .mobile-nav-links a:active {
    background: #171717;
}

#mobile-nav-panel .mobile-nav-cta {
    padding: 16px 24px 32px;
    border-top: 1px solid var(--border, #E5E7EB);
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-cta {
    border-top-color: #262626;
}

#mobile-nav-panel .mobile-nav-cta a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--gray-900, #111827);
    color: white;
}

[data-theme="dark"] #mobile-nav-panel .mobile-nav-cta a {
    background: #FAFAFA;
    color: #000000;
}

/* Legal page nav */
.legal-nav {
    padding: 10px 16px !important;
}

.legal-nav span {
    font-size: 1.15rem !important;
}

/* ------------------------------------------------
   2. HERO SECTION
   ------------------------------------------------ */
.hero {
    padding: 70px 16px 32px !important;
    min-height: auto !important;
}

.hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
    letter-spacing: -0.5px !important;
}

.hero p {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
}

.hero-buttons {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    align-items: center !important;
}

.hero-buttons a,
.hero-buttons .btn {
    width: 100% !important;
    max-width: 320px !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 14px 20px !important;
    display: flex !important;
}

.hero-badge {
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
}

/* ------------------------------------------------
   3. STATS BAR
   ------------------------------------------------ */
.stats-bar {
    padding: 0 16px 40px !important;
}

.stats-inner {
    grid-template-columns: repeat(2, 1fr) !important;
}

.stat {
    padding: 18px 14px !important;
    border-bottom: 1px solid var(--border) !important;
}

.stat:nth-child(2) { border-right: none !important; }
.stat:nth-child(3) { border-bottom: none !important; }
.stat:nth-child(4) { border-right: none !important; border-bottom: none !important; }

.stat-value { font-size: 1.5rem !important; }
.stat-label { font-size: 0.75rem !important; }

/* ------------------------------------------------
   4. CARD GRIDS
   ------------------------------------------------ */
.roles-grid {
    grid-template-columns: 1fr !important;
}

.role-card {
    padding: 22px 18px !important;
}

.role-card h3 { font-size: 1.1rem !important; }
.role-tag { font-size: 0.7rem !important; }

/* Role detail pages */
.role-detail {
    padding: 50px 16px !important;
}

.role-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
}

.role-detail-grid.reverse .role-detail-text { order: 1 !important; }
.role-detail-grid.reverse .role-detail-highlight { order: 2 !important; }

.role-detail-text h2 { font-size: 1.35rem !important; }
.role-detail-tag { font-size: 0.7rem !important; }
.role-detail-list li { font-size: 0.88rem !important; }
.role-highlight-card { padding: 18px !important; }

/* ------------------------------------------------
   5. TIMELINE / STEPS
   ------------------------------------------------ */
.steps-grid {
    grid-template-columns: 1fr !important;
}

.step {
    padding: 24px 18px !important;
}

.step-num { font-size: 0.75rem !important; }
.step h3 { font-size: 1.05rem !important; }

.timeline-step { padding: 24px 16px !important; }
.timeline-card { padding: 24px 16px !important; }
.timeline-num { font-size: 1.5rem !important; }
.timeline-indicator { display: none !important; }
.timeline-line { display: none !important; }
.time-badge { font-size: 0.75rem !important; padding: 4px 10px !important; }

/* ------------------------------------------------
   6. AUTONOMY LEVELS
   ------------------------------------------------ */
.autonomy-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.autonomy-card { padding: 18px 16px !important; }
.autonomy-card h4 { font-size: 1rem !important; }
.autonomy-num { font-size: 0.75rem !important; }
.autonomy-stack { gap: 16px !important; }
.autonomy-full { padding: 24px 16px !important; }
.autonomy-level { width: 44px !important; height: 44px !important; font-size: 0.75rem !important; }
.autonomy-example { font-size: 0.85rem !important; }

/* ------------------------------------------------
   7. SECURITY GRID
   ------------------------------------------------ */
.security-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
}

.security-card { padding: 20px 16px !important; }
.security-card h3 { font-size: 1rem !important; }

/* ------------------------------------------------
   8. PRICING
   ------------------------------------------------ */
.pricing-grid {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
    gap: 20px !important;
}

.price-card { padding: 24px 18px !important; }
.price-amount { font-size: 2.2rem !important; }
.pricing-toggle { flex-wrap: wrap !important; justify-content: center !important; gap: 8px !important; }
.price-card li { font-size: 0.88rem !important; }
.plan-badge { font-size: 0.65rem !important; padding: 3px 10px !important; }

.comparison-table { display: block !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
.comparison-table th, .comparison-table td { padding: 8px 10px !important; font-size: 0.78rem !important; white-space: nowrap !important; }

.roi-box { padding: 24px 16px !important; }
.roi-box h3 { font-size: 1.1rem !important; }
.roi-compare { flex-direction: column !important; gap: 16px !important; }
.roi-card { padding: 20px 16px !important; }
.roi-card-price { font-size: 2rem !important; }
.roi-saving { font-size: 1.1rem !important; padding: 16px !important; }

.faq-item { padding: 14px 0 !important; }
.faq-question { font-size: 0.95rem !important; }
.faq-answer { font-size: 0.88rem !important; }

.cta-buttons { flex-direction: column !important; gap: 10px !important; }
.cta-buttons .btn { width: 100% !important; justify-content: center !important; }

/* ------------------------------------------------
   9. EU + CTA SECTIONS
   ------------------------------------------------ */
.eu-box { padding: 28px 16px !important; }
.eu-flags { font-size: 1.2rem !important; letter-spacing: 3px !important; }

.cta-section { padding: 40px 16px !important; }
.cta-section h2 { font-size: 1.3rem !important; }
.cta-section .btn { width: 100% !important; max-width: 320px !important; justify-content: center !important; }

/* ------------------------------------------------
   10. SECTION TITLES (global)
   ------------------------------------------------ */
.section-title { font-size: 1.4rem !important; line-height: 1.3 !important; }
.section-desc { font-size: 0.93rem !important; }
.section-label { font-size: 0.7rem !important; }
.section { padding: 50px 16px !important; }
.section-border { padding: 50px 16px !important; }

/* ------------------------------------------------
   11. FORMS
   ------------------------------------------------ */
input, select, textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
}

.form-group { margin-bottom: 14px !important; }
.contact-form-wrapper { padding: 0 16px !important; max-width: 100% !important; }
.form-container { padding: 0 16px !important; max-width: 100% !important; }
.form-checkbox label { font-size: 0.85rem !important; }
.form-note { font-size: 0.8rem !important; }

button[type="submit"], .cta-button {
    width: 100% !important;
    padding: 14px !important;
    font-size: 1rem !important;
}

.form-buttons { flex-direction: column-reverse !important; gap: 8px !important; }
.form-buttons .btn { width: 100% !important; }
.form-step { padding: 0 16px !important; }
.progress-bar { gap: 0 !important; padding: 0 16px !important; overflow-x: auto !important; }
.progress-circle { width: 28px !important; height: 28px !important; font-size: 0.75rem !important; }
.role-cards { grid-template-columns: 1fr !important; gap: 10px !important; }
.summary, .trial-info { padding: 16px !important; }
.checkbox-group { font-size: 0.85rem !important; }

/* ------------------------------------------------
   12. LEGAL PAGES
   ------------------------------------------------ */
.container {
    max-width: 100% !important;
    padding: 20px 16px !important;
}

.legal-content { padding: 30px 0 50px !important; }
.legal-content h1 { font-size: 1.4rem !important; }
.legal-content h2 { font-size: 1.1rem !important; }
.legal-content h3 { font-size: 1rem !important; }
.legal-content p, .legal-content li { font-size: 0.88rem !important; line-height: 1.7 !important; }
.legal-content table, .container table { display: block !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; font-size: 0.75rem !important; }
.legal-content th, .legal-content td, .container th, .container td { padding: 8px 10px !important; white-space: nowrap !important; }
.info-block { padding: 14px !important; }
.highlight { padding: 12px 14px !important; }

/* ------------------------------------------------
   13. FOOTER
   ------------------------------------------------ */
footer {
    padding: 28px 16px !important;
}

footer > div {
    padding: 28px 16px 24px !important;
}

.footer-inner {
    padding: 28px 16px 24px !important;
}

.footer-top {
    flex-direction: column !important;
    gap: 18px !important;
    align-items: flex-start !important;
}

.footer-links {
    flex-direction: column !important;
    gap: 10px !important;
}

.footer-bottom {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
}

.footer-bottom > div {
    flex-direction: column !important;
    gap: 8px !important;
}

.footer-bottom-left {
    flex-direction: row !important;
    gap: 12px !important;
}

.footer-logo span {
    font-size: 1.15rem !important;
}

footer div[style*="gap:24px"] { flex-direction: column !important; gap: 10px !important; }
footer div[style*="gap:16px"] { flex-direction: column !important; gap: 8px !important; }
footer div[style*="justify-content:space-between"] { flex-direction: column !important; gap: 14px !important; align-items: flex-start !important; }
.ft-link { font-size: 0.8rem !important; }

/* ------------------------------------------------
   14. CHAT WIDGET
   ------------------------------------------------ */
.chat-widget {
    width: 44px !important;
    height: 44px !important;
    bottom: 14px !important;
    right: 14px !important;
}

.chat-widget svg {
    width: 20px !important;
    height: 20px !important;
}

/* ------------------------------------------------
   15. DOTTED SURFACE (lighter on mobile for perf)
   ------------------------------------------------ */
#dotted-surface canvas {
    opacity: 0.3 !important;
}

/* ------------------------------------------------
   16. HELPERS
   ------------------------------------------------ */
.desktop-only { display: none !important; }
.mobile-only { display: block !important; }

/* ------------------------------------------------
   17. EXTRA SMALL (< 480px)
   ------------------------------------------------ */
@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem !important; }
    .hero p { font-size: 0.88rem !important; }
    .stat-value { font-size: 1.25rem !important; }
    .section-title { font-size: 1.2rem !important; }
    .price-amount { font-size: 2rem !important; }
    .cta-section h2 { font-size: 1.1rem !important; }
    .nav-logo span { font-size: 1rem !important; }
    .nav-actions .btn-primary { font-size: 0.72rem !important; padding: 6px 10px !important; }
    .footer-logo span { font-size: 1rem !important; }
    .eu-flags { font-size: 1rem !important; letter-spacing: 2px !important; }
    .role-detail-text h2 { font-size: 1.2rem !important; }
    section, .section, .section-border { padding: 35px 12px !important; }
    .role-detail { padding: 35px 12px !important; }
}
