/*
 * ICOM – Off-canvas account navigation (mobile)
 * Attivo solo sotto 768px
 * File: assets/public/css/mobile-nav.css
 */

@media (max-width: 767px) {

  /* ── Nascondi la nav originale ───────────────────────────── */
  .woocommerce-MyAccount-navigation {
    display: none !important;
  }

  /* ── Bottone hamburger ───────────────────────────────────── */
  .icom-nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #003366;        /* colore primario ICOM – adatta se necessario */
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
    justify-content: flex-start;
    letter-spacing: 0.02em;
  }

  .icom-nav-toggle .icom-hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 14px;
    flex-shrink: 0;
  }

  .icom-nav-toggle .icom-hamburger-icon span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.25s ease;
  }

  /* Animazione hamburger → X quando aperto */
  .icom-nav-toggle.is-open .icom-hamburger-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .icom-nav-toggle.is-open .icom-hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  .icom-nav-toggle.is-open .icom-hamburger-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* ── Overlay scuro dietro il pannello ───────────────────── */
  .icom-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    animation: icomFadeIn 0.25s ease;
  }

  .icom-nav-overlay.is-visible {
    display: block;
  }

  /* ── Pannello off-canvas ─────────────────────────────────── */
  .icom-nav-offcanvas {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 80%;
    max-width: 300px;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 0 40px;
  }

  .icom-nav-offcanvas.is-open {
    transform: translateX(0);
  }

  /* Intestazione pannello */
  .icom-nav-offcanvas__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #003366;
    color: #fff;
  }

  .icom-nav-offcanvas__title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
  }

  /* Bottone chiudi (×) */
  .icom-nav-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.85;
    transition: opacity 0.15s;
  }

  .icom-nav-close:hover,
  .icom-nav-close:focus {
    opacity: 1;
  }

  /* Lista dei link dentro il pannello */
  .icom-nav-offcanvas ul {
    list-style: none;
    margin: 0;
    padding: 8px 0;
  }

  .icom-nav-offcanvas ul li {
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .icom-nav-offcanvas ul li:last-child {
    border-bottom: none;
  }

  .icom-nav-offcanvas ul li a {
    display: flex;
    align-items: center;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
  }

  .icom-nav-offcanvas ul li a:hover,
  .icom-nav-offcanvas ul li a:focus {
    background: #f5f8fc;
    color: #003366;
  }

  /* Voce attiva */
  .icom-nav-offcanvas ul li.is-active > a,
  .icom-nav-offcanvas ul li a[aria-current="page"] {
    background: #e8eef5;
    color: #003366;
    font-weight: 700;
    border-left: 3px solid #003366;
    padding-left: 17px;
  }

  /* Voce "Esci" in rosso */
  .icom-nav-offcanvas .woocommerce-MyAccount-navigation-link--customer-logout a {
    color: #c0392b;
  }

  .icom-nav-offcanvas .woocommerce-MyAccount-navigation-link--customer-logout a:hover {
    background: #fdf0ee;
    color: #922b21;
  }
}

/* ── Animazione overlay ──────────────────────────────────────── */
@keyframes icomFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
