/* ==========================================================================
   Account Dashboard — account.css
   Richiede style.css (variabili colore, font, header, footer) già incluso.
   Layout: sidebar fissa sinistra (desktop) + topbar (mobile < 768px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout principale
   -------------------------------------------------------------------------- */

.account-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 60px);
    background-color: var(--background-50);
}

.account-sidebar {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--navbar-bg);
    border-right: 1px solid var(--background-200);
    display: flex;
    flex-direction: column;
    padding: 24px 0 24px 0;
    z-index: 10;
}

.account-main {
    min-width: 0;
    padding: 40px 48px;
}

/* --------------------------------------------------------------------------
   Sidebar — Profilo utente
   -------------------------------------------------------------------------- */

.sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 20px 24px 20px;
    border-bottom: 1px solid var(--background-200);
    margin-bottom: 8px;
    text-align: center;
}

.sidebar-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-500);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    font-family: var(--font-heading);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sidebar-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-950);
    line-height: 1.3;
}

.sidebar-plan {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background-color: var(--primary-500);
    color: #fff;
    letter-spacing: 0.03em;
}

.sidebar-plan.plan-free {
    background-color: var(--background-200);
    color: var(--text-700);
}

.sidebar-plan.plan-ultra {
    background: linear-gradient(135deg, var(--accent-500), var(--secondary-500));
    color: #fff;
}

/* --------------------------------------------------------------------------
   Sidebar Slider — Transizione animata tra Account e Impostazioni
   -------------------------------------------------------------------------- */

.sidebar-nav-slider {
    position: relative;
    width: 240px;
    overflow: hidden;
    flex: 1;
    display: flex;
}

.sidebar-nav-track {
    display: flex;
    width: 200%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.sidebar-nav-panel {
    width: 240px;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-slider.slide-options .sidebar-nav-track {
    transform: translateX(-240px);
}

/* --------------------------------------------------------------------------
   Sidebar — Voci di navigazione
   -------------------------------------------------------------------------- */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    flex: 1;
}

.sidebar-options-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    flex: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}

.sidebar-nav-item:hover {
    background-color: var(--background-100);
    color: var(--text-950);
}

.sidebar-nav-item.active {
    background-color: var(--primary-50);
    color: var(--primary-500);
    font-weight: 600;
}

.sidebar-nav-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.sidebar-options-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-500);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    margin-bottom: 6px;
}

.sidebar-options-back:hover {
    color: var(--text-950);
    background-color: var(--background-100);
}

/* --------------------------------------------------------------------------
   Sidebar — Footer (logout)
   -------------------------------------------------------------------------- */

.sidebar-footer {
    padding: 16px 12px 0 12px;
    border-top: 1px solid var(--background-200);
    margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Topbar mobile (< 768px)
   -------------------------------------------------------------------------- */

.account-topbar {
    display: none;
    position: sticky;
    top: 60px;
    z-index: 20;
    background-color: var(--navbar-bg);
    border-bottom: 1px solid var(--background-200);
    padding: 0 16px;
}

.account-topbar-tabs {
    display: flex;
}

.topbar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-500);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.topbar-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.topbar-tab.active {
    color: var(--primary-500);
    border-bottom-color: var(--primary-500);
}

/* --------------------------------------------------------------------------
   Login / Signup — layout centrato a schermo intero
   -------------------------------------------------------------------------- */

.account-auth-wrapper {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background-color: var(--background-50);
}

.account-auth-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--navbar-bg);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 16px 40px -8px rgba(0,0,0,0.1), 0 4px 12px -2px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.auth-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-950);
    line-height: 1.2;
}

.auth-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--text-500);
    line-height: 1.5;
}

.auth-benefits {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    width: 100%;
}

.auth-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-700);
}

.auth-benefits li svg {
    flex-shrink: 0;
    color: var(--primary-500);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--background-200);
    background-color: var(--navbar-bg);
    color: var(--text-950);
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.btn-google:hover {
    background-color: var(--background-50);
    border-color: var(--background-200);
}

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

.btn-google img {
    width: 20px;
    height: 20px;
}

.auth-switch {
    font-size: 13px;
    color: var(--text-500);
}

.auth-switch a {
    color: var(--primary-500);
    font-weight: 500;
    text-decoration: underline;
}

.auth-legal {
    font-size: 11px;
    color: var(--text-400);
    line-height: 1.5;
}

.auth-legal a {
    color: var(--text-500);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Dashboard — Header di pagina
   -------------------------------------------------------------------------- */

.page-header {
    margin-bottom: 32px;
}

.page-greeting {
    margin: 0 0 4px 0;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-950);
    line-height: 1.2;
}

.page-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--text-500);
}

/* --------------------------------------------------------------------------
   Dashboard — Card statistiche utilizzo
   -------------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--navbar-bg);
    border-radius: 16px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-value {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-950);
    line-height: 1;
}

.stat-card-value span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-500);
}

.stat-progress {
    height: 4px;
    border-radius: 9999px;
    background-color: var(--background-200);
    overflow: hidden;
}

.stat-progress-bar {
    height: 100%;
    border-radius: 9999px;
    background-color: var(--primary-500);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-progress-bar.warning { background-color: #f59e0b; }
.stat-progress-bar.danger  { background-color: #ef4444; }

.stat-expiry {
    font-size: 11px;
    color: var(--text-400);
    margin-top: -4px;
}

/* --------------------------------------------------------------------------
   Dashboard — Card azioni rapide
   -------------------------------------------------------------------------- */

.section-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-950);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.action-card {
    background-color: var(--navbar-bg);
    border-radius: 16px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: var(--text-950);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.action-card:hover {
    background-color: var(--background-100);
}

.action-card:active { transform: translateY(0); }

.action-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: var(--primary-50);
    color: var(--primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-card-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.action-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-950);
    margin: 0;
}

.action-card-desc {
    font-size: 12px;
    color: var(--text-500);
    margin: 0;
}

/* --------------------------------------------------------------------------
   Dashboard / History — Banner upgrade (Free plan)
   -------------------------------------------------------------------------- */

.upgrade-banner {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--accent-50) 100%);
    border: 1px solid var(--primary-200);
    border-radius: 16px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.upgrade-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--primary-500);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upgrade-banner-text {
    flex: 1;
    min-width: 0;
}

.upgrade-banner-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-950);
}

.upgrade-banner-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-700);
    line-height: 1.4;
}

.upgrade-banner-btn {
    flex-shrink: 0;
    padding: 9px 18px;
    border-radius: 9999px;
    background-color: var(--primary-500);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.upgrade-banner-btn:hover { background-color: var(--primary-600); }

/* --------------------------------------------------------------------------
   Dashboard / History — Switch Testi / Immagini
   -------------------------------------------------------------------------- */

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-switcher {
    display: inline-flex;
    align-items: center;
    background-color: var(--background-100);
    border: 1px solid var(--background-200);
    border-radius: 9999px;
    padding: 4px;
    gap: 2px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--text-500);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn.active {
    background-color: var(--navbar-bg);
    color: var(--text-950);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Casella di ricerca (History testi) */
.history-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--navbar-bg);
    border: 1px solid var(--background-200);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 220px;
    max-width: 320px;
    transition: all 0.15s ease;
}

.history-search::-webkit-search-decoration,
.history-search::-webkit-search-cancel-button,
.history-search::-webkit-search-results-button,
.history-search::-webkit-search-results-decoration {
  display: none;
}


.history-search:focus-within {
    border-color: var(--background-400);
}

.history-search svg {
    flex-shrink: 0;
    color: var(--text-400);
}

.history-search input {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-950);
    width: 100%;
}

.history-search input::placeholder { color: var(--text-400); }

/* --------------------------------------------------------------------------
   History — Card testi
   -------------------------------------------------------------------------- */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card {
    background-color: var(--navbar-bg);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.history-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.history-card:hover { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }

.history-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-color: var(--background-100);
    color: var(--text-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-card-body {
    flex: 1;
    min-width: 0;
}

.history-card-title {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-950);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-400);
}

.history-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--background-200);
    background-color: var(--navbar-bg);
    color: var(--text-500);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-icon-sm:hover {
    background-color: var(--background-100);
    color: var(--text-950);
}

.btn-icon-sm.danger:hover {
    background-color: rgba(239,68,68,0.08);
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}

/* --------------------------------------------------------------------------
   History — Griglia immagini
   -------------------------------------------------------------------------- */

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.image-card {
    background-color: var(--navbar-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.image-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.image-card-thumb {
    aspect-ratio: 4 / 3;
    background-color: var(--background-100);
    background-image: repeating-conic-gradient(#80808014 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    overflow: hidden;
}

.image-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-info {
    padding: 10px 12px;
}

.image-card-name {
    margin: 0 0 3px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-950);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card-date {
    font-size: 11px;
    color: var(--text-400);
}

/* --------------------------------------------------------------------------
   Options — Sezioni
   -------------------------------------------------------------------------- */

.options-section {
    background-color: var(--navbar-bg);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
}

.options-section-header {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid var(--background-100);
    display: flex;
    align-items: center;
    gap: 12px;
}

.options-section-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-color: var(--primary-50);
    color: var(--primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.options-section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-950);
    font-family: var(--font-heading);
}

.options-section-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.options-label { display: flex; flex-direction: column; gap: 3px; }
.options-label-title { font-size: 14px; font-weight: 500; color: var(--text-950); }
.options-label-sub   { font-size: 12px; color: var(--text-400); }

/* Bottoni generici account */
.btn-account {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid var(--background-200);
    background-color: var(--navbar-bg);
    color: var(--text-950);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn-account:hover { background-color: var(--background-100); border-color: var(--background-300); }

.btn-account.btn-primary {
    background-color: var(--primary-500);
    color: #fff;
    border-color: transparent;
}

.btn-account.btn-primary:hover { background-color: var(--primary-600); }

.btn-account.btn-danger {
    background-color: transparent;
    color: #ef4444;
    border-color: rgba(239,68,68,0.35);
}

.btn-account.btn-danger:hover {
    background-color: rgba(239,68,68,0.07);
}

/* Abbonamento */
.plan-badge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.plan-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 700;
    background-color: var(--primary-500);
    color: #fff;
}

.plan-badge-large.plan-free { background-color: var(--background-200); color: var(--text-700); }
.plan-badge-large.plan-ultra { background: linear-gradient(135deg, var(--accent-500), var(--secondary-500)); color: #fff; }

.plan-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-700);
}

.plan-features-list li svg { flex-shrink: 0; color: #10b981; }

.plan-change-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.plan-change-card {
    border: 1px solid var(--background-200);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: var(--background-50);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-change-card:hover {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(4,119,251,0.08);
}

.plan-change-card.current { border-color: var(--primary-500); background-color: var(--primary-50); }
.plan-change-name { font-size: 13px; font-weight: 600; color: var(--text-950); }
.plan-change-price { font-size: 12px; color: var(--text-500); }

/* Cronologia pagamenti */
.payments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.payments-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-400);
    font-weight: 500;
    border-bottom: 1px solid var(--background-200);
}

.payments-table td {
    padding: 10px 12px;
    color: var(--text-700);
    border-bottom: 1px solid var(--background-100);
}

.payments-table tr:last-child td { border-bottom: none; }

.payment-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
}

.payment-status-badge.success { background-color: rgba(16,185,129,0.1); color: #10b981; }
.payment-status-badge.pending { background-color: rgba(245,158,11,0.1); color: #f59e0b; }

/* --------------------------------------------------------------------------
   Modal & Overlay — Sistema generale e personalizzabile
   -------------------------------------------------------------------------- */

@keyframes modalBackdropFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalBackdropFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalSlideDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(18px) scale(0.97); }
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.modal-open .account-topbar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 20;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.58);
    z-index: 99981;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    box-sizing: border-box;
}

.modal-overlay.open {
    display: flex;
    animation: modalBackdropFadeIn 0.2s ease forwards;
}

.modal-overlay.closing {
    animation: modalBackdropFadeOut 0.18s ease forwards;
}

.modal-card {
    background-color: var(--navbar-bg);
    border-radius: 20px;
    padding: 28px;
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid var(--background-200);
}

.modal-overlay.closing .modal-card {
    animation: modalSlideDown 0.18s ease forwards;
}

/* Dimensioni personalizzate modali */
.modal-card-sm   { max-width: 420px; }
.modal-card-md   { max-width: 540px; }
.modal-card-lg   { max-width: 720px; }
.modal-card-wide { max-width: 840px; }

.modal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.modal-title-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-950);
    line-height: 1.3;
}

.modal-subtitle {
    margin: 4px 0 0 0;
    font-size: 13.5px;
    color: var(--text-500);
    line-height: 1.45;
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-400);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background-color: var(--background-100);
    color: var(--text-950);
}

.modal-desc {
    margin: 0;
    font-size: 14px;
    color: var(--text-500);
    line-height: 1.5;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Campi form modale */
.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-700);
}

.modal-input,
.modal-select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--background-200);
    background-color: var(--background-50);
    color: var(--text-950);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}

.modal-input:focus,
.modal-select:focus {
    background-color: var(--navbar-bg);
}

.modal-help-text {
    font-size: 12px;
    color: var(--text-400);
    margin: 2px 0 0 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--background-100);
}

.modal-table-scroll {
    overflow-x: auto;
    max-height: 55vh;
    border: 1px solid var(--background-100);
    border-radius: 12px;
}

/* Componenti per il popup di Cambio Abbonamento */
.modal-billing-switch {
    display: inline-flex;
    align-items: center;
    background-color: var(--background-100);
    padding: 4px;
    border-radius: 9999px;
    gap: 4px;
    margin: 0 auto;
}

.modal-billing-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-600);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-billing-btn.active {
    background-color: var(--navbar-bg);
    color: var(--text-950);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.modal-billing-discount {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
}

.modal-plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 8px;
}

.modal-plan-card {
    border: 2px solid var(--background-200);
    border-radius: 16px;
    padding: 18px 16px;
    background-color: var(--background-50);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    outline: none;
}

.modal-plan-card:hover {
    border-color: var(--primary-300);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.modal-plan-card.selected {
    border-color: var(--primary-500);
    background-color: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-plan-card.current {
    border-color: var(--primary-400);
}

.modal-plan-tag {
    position: absolute;
    top: -10px;
    right: 14px;
    background-color: var(--primary-600);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-plan-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-950);
    margin: 0;
}

.modal-plan-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-950);
    margin: 8px 0 2px 0;
}

.modal-plan-period {
    font-size: 12px;
    color: var(--text-400);
    font-weight: 400;
}

.modal-plan-features {
    list-style: none;
    padding: 0;
    margin: 14px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--background-200);
    padding-top: 12px;
}

.modal-plan-features li {
    font-size: 12.5px;
    color: var(--text-600);
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-plan-features svg {
    color: #10b981;
    flex-shrink: 0;
}

.modal-plan-select-btn {
    margin-top: 16px;
    width: 100%;
    justify-content: center;
}

/* Barra di ritorno su mobile per la vista a pagina singola delle impostazioni */
.options-back-to-all {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-back-options {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--background-200);
    background-color: var(--navbar-bg);
    color: var(--text-700);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn-back-options:hover {
    background-color: var(--background-100);
    color: var(--text-950);
    border-color: var(--background-300);
}

/* --------------------------------------------------------------------------
   Animazione fade-in contenuto SPA
   -------------------------------------------------------------------------- */

@keyframes accountFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.account-main.spa-loading {
    opacity: 0.5;
    pointer-events: none;
}

.account-main > * {
    animation: accountFadeIn 0.25s ease forwards;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-400);
}

.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { margin: 0; font-size: 14px; }





body > footer {
    display: none!important;
}




/* --------------------------------------------------------------------------
   Desktop view (>= 768px):
   Mostra SOLO la categoria selezionata nel menu a sinistra
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
    .options-section {
        display: none;
    }

    .options-section.active-section {
        display: block;
        animation: accountFadeIn 0.25s ease forwards;
    }

    .mobile-payments-more {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   Responsive — Mobile (< 768px)
   Tutte le sezioni impostazioni visibili scorrendo, divise chiaramente
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .account-layout {
        grid-template-columns: 1fr;
    }

    .account-sidebar { display: none; }
    .account-topbar  { display: block; }

    .account-main { padding: 24px 16px; }

    .upgrade-banner {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .upgrade-banner-btn {
        width: 100%;
        justify-content: center;
    }

    .history-header { flex-direction: column; align-items: flex-start; }
    .history-search { max-width: 100%; width: 100%; }

    .images-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

    /* Sezioni opzioni visibili tutte in sequenza con separazione netta */
    .options-section {
        display: block;
        margin-bottom: 28px;
        border: 1px solid var(--background-200);
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }

    .options-section:last-of-type {
        margin-bottom: 16px;
    }

    .options-section-header { padding: 16px 16px 12px 16px; }
    .options-section-body   { padding: 14px 16px; }
    .options-row            { flex-direction: column; align-items: flex-start; }
    .btn-account            { align-self: flex-start; }
    .plan-change-grid       { grid-template-columns: 1fr; }

    .payments-table th,
    .payments-table td { padding: 8px 8px; }

    /* Mostra solo le prime 3 righe da mobile e il pulsante per aprire la cronologia completa */
    .payments-table tr.payment-row-extra {
        display: none;
    }

    .mobile-payments-more {
        display: block;
        margin-top: 14px;
        text-align: center;
    }

    .mobile-payments-more .btn-account {
        align-self: center;
        margin: 0 auto;
    }

    /* Modalità sezione singola da mobile: mostra solo la sezione selezionata a pagina intera (come da PC) */
    .account-main.options-single-mode .options-back-to-all {
        display: flex !important;
    }
    .account-main.options-single-mode .options-section {
        display: none !important;
        margin-bottom: 0;
        border: none;
        box-shadow: none;
    }
    .account-main.options-single-mode .options-section.active-section {
        display: block !important;
        animation: accountFadeIn 0.25s ease forwards;
    }
    .account-main.options-single-mode .payment-row-extra {
        display: table-row !important;
    }
    .account-main.options-single-mode .mobile-payments-more {
        display: none !important;
    }

    /* Modale responsive su schermi piccoli */
    .modal-card {
        padding: 22px 18px;
        border-radius: 18px;
    }
    .modal-plans-grid {
        grid-template-columns: 1fr;
    }
    .modal-actions {
        flex-direction: column-reverse;
        width: 100%;
    }
    .modal-actions .btn-account {
        width: 100%;
        justify-content: center;
    }

    .account-auth-card { padding: 28px 20px; }
    .page-greeting     { font-size: 1.4rem; }
    .stats-grid        { grid-template-columns: 1fr 1fr; }
    .actions-grid      { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Avvisi CSS Cronologia (Upgrade vs Vuoto) & Carica Altri
   -------------------------------------------------------------------------- */
.history-upgrade-notice {
    background: linear-gradient(135deg, rgba(4, 119, 251, 0.08) 0%, rgba(20, 184, 166, 0.08) 100%);
    border: 1px solid rgba(4, 119, 251, 0.25);
    border-radius: 16px;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 16px 0;
    box-shadow: 0 4px 14px rgba(4, 119, 251, 0.06);
}

.history-upgrade-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0477fb 0%, #0284c7 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(4, 119, 251, 0.3);
}

.history-upgrade-body {
    flex: 1;
    min-width: 0;
}

.history-upgrade-title {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-950);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-upgrade-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-600);
    line-height: 1.45;
}

.history-upgrade-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #0477fb 0%, #0369a1 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(4, 119, 251, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.history-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(4, 119, 251, 0.35);
}

.history-empty-notice {
    background-color: var(--navbar-bg);
    border: 1px dashed var(--background-300);
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.history-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--background-100);
    color: var(--text-400);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-empty-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-950);
}

.history-empty-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-500);
    max-width: 360px;
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 12px;
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border-radius: 9999px;
    border: 1px solid var(--background-300);
    background-color: var(--navbar-bg);
    color: var(--text-700);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-load-more:hover {
    background-color: var(--background-100);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .history-upgrade-notice {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 20px;
    }
    .history-upgrade-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   CHECKOUT PAGE STYLES
   ========================================================================== */

.account-checkout-wrapper {
    min-height: calc(100vh - 60px);
    background-color: var(--background-50);
    padding: 40px 24px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.checkout-container {
    width: 100%;
    max-width: 1060px;
}

.checkout-header {
    margin-bottom: 28px;
}

.checkout-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-500);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.15s ease;
}

.checkout-back-link:hover {
    color: var(--primary-500);
}

.checkout-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-900);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.checkout-subtitle {
    font-size: 15px;
    color: var(--text-500);
    margin: 0;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 28px;
    align-items: start;
}

.checkout-card {
    background-color: var(--navbar-bg);
    border: 1px solid var(--background-200);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.checkout-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--background-200);
}

.checkout-plan-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-tag-pro {
    background-color: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.plan-tag-ultra {
    background-color: rgba(168, 85, 247, 0.12);
    color: #9333ea;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.checkout-cycle-badge {
    font-size: 13px;
    color: var(--text-500);
    font-weight: 600;
}

.checkout-price-box {
    margin-bottom: 24px;
}

.checkout-price-val {
    font-size: 38px;
    font-weight: 800;
    color: var(--text-900);
    letter-spacing: -0.03em;
}

.checkout-price-interval {
    font-size: 15px;
    color: var(--text-500);
    font-weight: 500;
}

.checkout-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-features-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-700);
}

.checkout-features-list svg {
    flex-shrink: 0;
    color: #10b981;
}

.checkout-security-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background-color: var(--background-100);
    color: var(--text-500);
    font-size: 12px;
    line-height: 1.4;
}

.checkout-security-badge svg {
    flex-shrink: 0;
    color: #10b981;
}

/* Container Iframe Paddle */
#paddle-checkout-container {
    min-height: 480px;
    width: 100%;
}

/* Stato Attesa Polling */
.checkout-state-card {
    text-align: center;
    padding: 48px 32px;
}

.checkout-spinner-wrap {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.checkout-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--background-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: checkout-spin 0.9s linear infinite;
}

@keyframes checkout-spin {
    to { transform: rotate(360deg); }
}

.checkout-state-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-900);
    margin: 0 0 10px 0;
}

.checkout-state-desc {
    font-size: 14px;
    color: var(--text-500);
    max-width: 440px;
    margin: 0 auto 20px;
    line-height: 1.5;
}

.checkout-pulse-bar {
    width: 160px;
    height: 4px;
    border-radius: 9999px;
    background-color: var(--background-200);
    margin: 0 auto 24px;
    overflow: hidden;
    position: relative;
}

.checkout-pulse-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    background-color: var(--primary-500);
    border-radius: 9999px;
    animation: checkout-pulse 1.4s ease-in-out infinite;
}

@keyframes checkout-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* Stato Successo */
.checkout-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.12);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.checkout-success-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    background-color: var(--primary-500);
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.checkout-success-btn:hover {
    background-color: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

@media (max-width: 860px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-card {
        padding: 20px;
    }
    .account-checkout-wrapper {
        padding: 24px 16px 40px;
    }
}

