/* MurphFin — responsive.css */


/* ── Layout responsive (header, sidebar, content) ── */

@media (max-width: 768px) {
  .news-ticker { margin: 0 10px; }
  .news-ticker-item { font-size: 0.72rem; }
}

@media (max-width: 768px) {
  .bo-nav a { padding: 6px 10px; font-size: 0.75rem; }
  .bo-nav-group { display: none; }
}


/* ── Wizard responsive ── */

@media print {
  .no-copy { display: none !important; }
  body::after { content: 'Stampa non autorizzata — murphfin.com'; font-size: 3rem; color: rgba(0,0,0,0.1); position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-30deg); }
}


/* ── Main responsive (section 20) ── */

/* ═══════ 20. RESPONSIVE ═══════ */

@media (max-width: 991.98px) {
  .sidebar-toggle { display: block; }
  .sidebar-collapse-btn { display: none; }
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.12); }
  .sidebar-overlay.open { display: block; }
  .app-auth .app-content { margin-left: 0; }
  .app-auth.sidebar-collapsed .app-content { margin-left: 0; }
  .app-auth.sidebar-collapsed .footer-auth { left: 0; }
  .footer-auth { left: 0; }
  .app-auth .bp-ai-coach { left: 24px; }

  /* Public header nav */
  .app-header-nav { display: none; }
  .app-header-nav.open { display: flex; flex-direction: column; position: absolute; top: var(--header-h); right: 0; background: var(--brand-navy-dark); padding: 12px; border-radius: 0; box-shadow: none; border-bottom: 2px solid var(--brand-navy); min-width: 200px; z-index: 1050; }
  .header-mobile-toggle { display: block; }
}

@media (max-width: 768px) {
  .app-main { padding: 1.5rem 1rem; }
  .bp-card { padding: 20px; }
  .bp-wizard-header h2 { font-size: 1.3rem; }
  .pw-pbar-label { font-size: 0.58rem; }
  .pw-pbar { padding: 10px 12px; }
  .bp-download-box { flex-direction: column; align-items: stretch; text-align: center; }
  .bp-download-box__content { flex-direction: column; }
  .bp-download-box__actions { justify-content: center; }
  .bp-download-box__price { text-align: center; }
  .bp-download-box__form { flex-direction: column; }
  .bp-download-box__coupon { width: 100%; }

  /* Wizard wrapper full-width on tablet */
  .bp-wizard-wrapper { max-width: 100%; padding: 0 12px; }
}

@media (max-width: 576px) {
  /* ── Layout ── */
  .app-main { padding: 1rem 0.75rem; }

  /* ── Sidebar: ridotta su schermi stretti ── */
  .app-sidebar { width: 85vw; max-width: 280px; }

  /* ── Header logout: solo icona ── */
  .header-logout span { display: none; }

  /* ── Footer auth: colonna ── */
  .footer-auth-inner { gap: 4px; }

  /* ── Tabelle: widths fluidi ── */
  .adm-table th, .adm-table td,
  .table th, .table td { font-size: 0.78rem; padding: 6px 8px; }
  .col-w-120 { width: auto; min-width: 80px; }
  .col-w-100 { width: auto; min-width: 70px; }
  .col-w-55 { width: auto; min-width: 40px; }
  .col-w-desc { min-width: 100px; }

  /* ── KPI cards: 2 colonne ── */
  .row.g-3 > [class*="col-md-3"] { flex: 0 0 50%; max-width: 50%; }

  /* ── AI Coach: full width ── */
  .bp-ai-coach { left: 12px !important; right: 12px; }
  .bp-ai-coach__toggle { width: 44px; height: 44px; font-size: 1.1rem; }
  .bp-ai-coach__panel {
    width: calc(100vw - 24px);
    max-width: 100%;
    left: 0;
    right: 0;
  }
  .bp-ai-coach__messages { max-height: 220px; }

  /* ── Wizard ── */
  .bp-wizard-wrapper { max-width: 100%; }
  .bp-step-container { padding-left: 0; padding-right: 0; }

  /* ── Select e input con width fisso ── */
  select[style*="width:320px"],
  select[style*="width:300px"] { width: 100% !important; }

  /* ── Timeline scadenze ── */
  .timeline-mandato { max-width: 100px; font-size: 0.65rem; }
  .timeline-data { gap: 6px; font-size: 0.78rem; }

  /* ── Chat AI ── */
  .chat-suggestions { gap: 4px; }
  .chat-suggestion { font-size: 0.72rem; padding: 4px 10px; }
  .chat-messages { max-height: calc(100vh - var(--header-h) - var(--footer-auth-h) - 240px); }
  .chat-msg { max-width: 92%; padding: 10px 12px; font-size: 0.84rem; }

  /* ── Share box ── */
  .bp-share-box { flex-direction: column; }
  .bp-share-url { max-width: 100%; }

  /* ── Cards e padding ── */
  .card-fisit.p-4 { padding: 1rem !important; }
  .card-fisit.p-5 { padding: 1.5rem !important; }

  /* ── Normativa tabs ── */
  .normativa-tab-btn { font-size: 0.75rem; padding: 5px 10px; }

  /* ── Knowledge AI cards ── */
  .kai-card { min-height: 100px; }
  .kai-brand { font-size: 1.2rem; }

  /* Tables mf-*: override nel blocco dark-theme-responsive sotto (dopo 768px) */

  /* Hardcoded widths: force 100% on mobile */
  select[style*="max-width"], select[style*="width"] { max-width: 100% !important; width: 100% !important; }
  input[style*="width:"] { max-width: 100% !important; }

  /* Chat messages: more space on small screens */
  .chat-messages { max-height: calc(100vh - var(--header-h) - var(--footer-auth-h) - 200px); }
  .chat-msg { max-width: 95%; font-size: 11px; }

  /* KPI strip: compact font on phones */
  .mf-kpi-value { font-size: 1.1rem; }
  .mf-kpi-label { font-size: 0.6rem; }
  .mf-kai-number { font-size: 1.1rem; }

  /* AI Coach widget: full width on phone */
  .bp-ai-coach__panel { width: calc(100vw - 24px); max-width: 340px; }
  .bp-ai-coach { left: 12px; }

  /* 4-column grid: 2 columns on mobile */
  .mf-grid-2[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Lavori in corso e header: override nel blocco dark-theme-responsive sotto */
  .news-ticker { display: none; }
  .header-logout { min-width: 44px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; }
}


/* ── Pages responsive ── */

@media (max-width: 991.98px) {
  .mdt-header { flex-direction: column; gap: 12px; }
  .mdt-sidebar { position: static; }
  .mdt-scad-tipo { display: none; }
}

@media (max-width: 576px) {
  .mdt-doc-row, .mdt-scad-row { padding: 6px 14px; font-size: 0.8rem; }
  .mdt-card-head { padding: 12px 14px; }
  .mdt-card-footer { padding: 10px 14px; }
}

@media (max-width: 768px) {
  .page-hero { padding: 32px 16px; }
  .page-hero h1 { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* news-ticker: animazione rAF gestita da JS, non sovrascrive prefers-reduced-motion */
}

@media (max-width: 768px) {
  .bo-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .bo-nav .dropdown-toggle { padding: 6px 10px; font-size: 0.75rem; }
}

@media (max-width: 576px) {
  .bo-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bo-kpi-val { font-size: 1.1rem; }
}

@media (max-width: 768px) {
  .dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .dash-header-actions { width: 100%; }
  .dash-header-actions .btn { flex: 1; text-align: center; }
  .dash-kpi-bar { flex-wrap: wrap; }
  .dash-kpi-item { flex: 1 1 45%; }
  .dash-demo-banner { flex-direction: column; text-align: center; }
  .dash-demo-banner .btn { width: 100%; }
  .demo-banner-inner { margin-left: 0 !important; flex-direction: column; gap: 4px; font-size: 0.78rem; }
  .dash-filters { flex-direction: column; }
  .dash-filter-search { width: 100%; }
  .dash-filter-select { max-width: none; width: 100%; }
  .dash-mandato-main { flex-wrap: wrap; }
  .dash-mandato-cliente { max-width: 140px; }
  .dash-mandato-pbar { width: 40px; }
}

@media (max-width: 576px) {
  .dash-kpi-item { flex: 1 1 100%; padding: 10px 14px; }
  .dash-kpi-val { font-size: 1.1rem; }
  .dash-section-header { padding: 14px 16px 0; }
  .dash-filters { padding: 12px 16px; }
  .dash-table thead th,
  .dash-table tbody td { padding: 10px 12px; font-size: 0.82rem; }
  .dash-mandato-card { padding: 10px 14px; }
  .dash-onboard-header { padding: 20px; }
  .dash-onboard-body { padding: 20px; }
}

@media (max-width: 768px) {
  body.public-area .lp-features-grid { grid-template-columns: 1fr; }
  body.public-area .lp-come-cta .btn { display: block; margin: 8px auto; width: 100%; max-width: 320px; }
  body.public-area .lp-come-cta .ms-3 { margin-left: 0 !important; }
}

@media (max-width: 768px) {
  .feat-grid { grid-template-columns: 1fr; }
  .feat-hero h1 { font-size: 1.6rem; }
}


/* ── Dark theme responsive + mf-* responsive ── */

@media (max-width: 768px) {
  .mf-kpi-strip--4, .mf-kpi-strip--5 { grid-template-columns: repeat(2, 1fr); }
  .mf-grid-2, .mf-grid-3 { grid-template-columns: 1fr; }
  .mf-page-header { flex-direction: column; gap: 10px; }
  .mf-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mf-table { min-width: 600px; }
  .mf-page-subtitle { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 576px) {
  /* Tabella BP: min-width ridotto per phone (override del 600px sopra) */
  .mf-table { min-width: 480px; font-size: 0.75rem; }
  .mf-table th, .mf-table td { padding: 6px 8px; }

  /* Filtri tabella: stack verticale */
  .mf-table-filter-bar { flex-direction: column; gap: 6px; }
  .mf-table-search, .mf-table-filter { width: 100%; }

  /* Lavori in corso (mf-doc-row): stack verticale */
  .mf-doc-row { flex-wrap: wrap; padding: 10px 12px; gap: 6px; }
  .mf-mandato-info { flex-wrap: wrap; width: 100%; gap: 4px; }
  .mf-mandato-name { width: 100%; }
  .mf-flex-row-wide { width: 100%; flex-shrink: 1; }
  .mf-flex-row-tight { flex-shrink: 1; }
  .mf-doc-row .mf-progress { width: 50px; min-width: 0; }
  .mf-doc-row .mf-bando-badge,
  .mf-doc-row .mf-state-badge { font-size: 10px; padding: 2px 6px; }
}

@media (max-width: 480px) {
  /* Body font scaling */
  body.app-auth { font-size: 13px; }

  /* KPI strip: single column */
  .mf-kpi-strip, .mf-kpi-strip--4, .mf-kpi-strip--5 { grid-template-columns: 1fr; gap: 4px; }
  .mf-kpi-cell { padding: 10px 12px; flex-direction: row; align-items: center; gap: 10px; }

  /* Page header: stack fully */
  .mf-page-title { font-size: 20px; }
  .mf-greeting-name { font-size: 22px; }

  /* Card padding: reduce */
  .mf-card { padding: 12px; }

  /* Normativa tabs: smaller */
  .normativa-tab-btn { font-size: 0.65rem; padding: 4px 8px; }
}

@media (max-width: 768px) {
  body.app-auth .app-sidebar { left: calc(-1 * var(--sidebar-w)); }
  body.app-auth .app-sidebar.open { left: 0; }
  body.app-auth .app-content { margin-left: 0; }
  body.app-auth .footer-auth { left: 0; }
  body.app-auth .app-main { padding: 14px 12px 60px; }
}

/* ── Footer responsive ── */
@media (max-width: 576px) {
  .footer-cta { padding: 28px 0; }
  .footer-cta-title { font-size: 1.15rem; }
  .footer-cta-btn { width: 100%; text-align: center; }
  .footer-trust-inner { gap: 14px; }
  .footer-trust-sep { display: none; }
}
