/* public/css/app.css */

/* ─── Variabili ───────────────────────────────────────────── */
:root {
    --sidebar-bg:      #1C1C2E;
    --sidebar-width:   240px;
    --bordeaux:        #85213a;
    --bordeaux-light:  #FDF0F3;
    --bordeaux-dark:   #6B1A2E;
}

/* ─── Reset base ──────────────────────────────────────────── */
body {
    background-color: #f4f6f9;
    font-size: 0.95rem;
    margin: 0;
    overflow-x: hidden; /* Evita scroll orizzontale su mobile */
}

/* ─── Layout sidebar + main ──────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    display: block;
}

.sidebar-brand-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(123,28,46,0.25);
    color: #fff;
    border-left-color: var(--bordeaux);
}

.sidebar-nav form {
    margin: 0;
}

.sidebar-nav a.logout,
.sidebar-nav button.logout {
    color: rgba(240,128,128,0.7);
}

.sidebar-nav button.logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    width: 100%;
    font-size: 13px;
    text-align: left;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}

.sidebar-nav a.logout:hover,
.sidebar-nav button.logout:hover {
    color: #f08080;
    background: rgba(240,128,128,0.08);
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 8px 0;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-label {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer-name {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-loghi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    object-fit: contain;
    border-radius: 6px;

    padding: 3px;
}

.sidebar-logo-fipe {
    width: 44px;
    height: 44px;
}

.sidebar-logo-confcommercio {
    width: 88px;
    height: 44px;
}

/* ─── Main content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px 32px;
    min-height: 100vh;
}

/* ─── Topbar mobile ───────────────────────────────────────── */
.topbar-mobile {
    display: none;
    background: var(--sidebar-bg);
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 150;
}

.topbar-mobile-brand {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.topbar-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    /* Area di tocco minima 44x44px — standard Apple/Google per mobile */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Overlay mobile ──────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199; /* Sotto la sidebar (200) ma sopra il contenuto */
}

/* ─── Flash alerts ────────────────────────────────────────── */
.flash-container {
    margin-bottom: 20px;
}

/* ─── Card hover ──────────────────────────────────────────── */
.card-hover {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.08) !important;
}

/* ─── Stat card ───────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    border: 1px solid #eee;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-label {
    color: #999;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #1a1a2e;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    margin: 4px 0;
}

.stat-link {
    color: var(--bordeaux);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.stat-link:hover {
    text-decoration: underline;
}

/* ─── Tabelle Bootstrap ───────────────────────────────────── */
.table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

/* ─── Form focus ──────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--bordeaux);
    box-shadow: 0 0 0 0.2rem rgba(123,28,46,.12);
}

/* ─── Badge stato piatto ──────────────────────────────────── */
.piatto-badge-attivo {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #A5D6A7;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.piatto-badge-inattivo {
    background: #f5f5f5;
    color: #888;
    border: 1px solid #ddd;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ─── Sezioni form gestionale ─────────────────────────────── */
.gs-section {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    overflow: hidden;
}

.gs-section-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.gs-section-header.gs-blue   { background: #EDF1FB; }
.gs-section-header.gs-yellow { background: #FEF9EC; }
.gs-section-header.gs-green  { background: #E8F5E9; }
.gs-section-header.gs-gray   { background: #f5f5f5; }

.gs-section-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.gs-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.gs-section-sub {
    font-size: 11px;
    color: #aaa;
    margin-top: 1px;
}

.gs-section-body {
    padding: 16px;
}

.gs-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

/* ─── Allergeni checkbox stilizzati ──────────────────────── */
.gs-allerg-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid #eee;
    background: #fafafa;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    transition: all 0.1s;
    user-select: none;
    width: 100%;
}

.gs-allerg-item:hover {
    border-color: #F0CC6A;
    background: #fffdf0;
}

.gs-allerg-item.checked {
    background: #FEF9EC;
    border-color: #F0CC6A;
    color: #8a6500;
    font-weight: 600;
}

.gs-allerg-check {
    accent-color: #7B1C2E;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ─── Tag pill stilizzati ─────────────────────────────────── */
.gs-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #eee;
    background: #fafafa;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    transition: all 0.1s;
    user-select: none;
}

.gs-tag-item input {
    display: none;
}

.gs-tag-item:hover {
    border-color: #A5D6A7;
    background: #f0faf0;
}

.gs-tag-item.checked {
    background: #E8F5E9;
    border-color: #A5D6A7;
    color: #2E7D32;
}

/* ─── Card lista piatti ───────────────────────────────────── */
.piatto-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s;
}

.piatto-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.piatto-card-info {
    flex: 1;
    min-width: 0;
}

.piatto-card-nome {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.piatto-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.piatto-card-portata {
    font-size: 11px;
    color: #999;
}

.piatto-card-prezzo {
    font-size: 14px;
    font-weight: 600;
    color: #7B1C2E;
    min-width: 70px;
    text-align: right;
}

.piatto-card-azioni {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Bottoni azioni ──────────────────────────────────────── */
.btn-piatto-edit {
    background: #EDF1FB;
    color: #1C1C2E;
    border: none;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-piatto-edit:hover {
    background: #d8e0f5;
    color: #1C1C2E;
}

.btn-piatto-del {
    background: #FFEBEE;
    color: #C62828;
    border: none;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-piatto-del:hover {
    background: #ffcdd2;
}
/* ─── Gruppi menu nella lista portate ─────────────────────── */
.portate-menu-gruppo {
    border-bottom: 1px solid #f0f0f0;
}

.portate-menu-gruppo:last-child {
    border-bottom: none;
}

.portate-menu-gruppo-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fafafa;
    border-bottom: 0.5px solid #f0f0f0;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.portate-menu-gruppo-count {
    margin-left: auto;
    font-size: 11px;
    color: #fff;
    background: #7B1C2E;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}

/* ─── Lista portate drag & drop ───────────────────────────── */
.portata-drag-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 0.5px solid #f0f0f0;
    background: #fff;
    transition: background 0.15s;
    cursor: default;
}

.portata-drag-row:last-child {
    border-bottom: none;
}

.portata-drag-row:hover {
    background: #fafafa;
}

/* Stato ghost durante il drag */
.portata-drag-ghost {
    opacity: 0.4;
    background: #f5e8eb !important;
}

/* ─── Pagina login ────────────────────────────────────────── */
.login-page {
    background-color: var(--bordeaux-light);
}

.login-page .card {
    border-top: 4px solid var(--bordeaux) !important;
}

.login-icon {
    color: var(--bordeaux);
}

.btn-bordeaux {
    background-color: var(--bordeaux);
    border-color: var(--bordeaux);
    color: #fff;
}

.btn-bordeaux:hover,
.btn-bordeaux:focus {
    background-color: var(--bordeaux-dark);
    border-color: var(--bordeaux-dark);
    color: #fff;
}

.btn-outline-bordeaux {
    border-color: #dee2e6;
    color: #6c757d;
}

.btn-outline-bordeaux:hover {
    background-color: var(--bordeaux-light);
    border-color: var(--bordeaux);
    color: var(--bordeaux);
}

.login-loghi {
    display: flex;
    align-items: center;
    justify-content: center;
  
}

.login-logo {
    object-fit: contain;
}

.login-logo-fipe {
    width: 70px;
    height: 70px;
}

.login-logo-confcommercio {
    width: 140px;
    height: 70px;
}

.login-page .form-control:focus {
    border-color: var(--bordeaux);
    box-shadow: 0 0 0 0.2rem rgba(133,33,58,.12);
}

/* Handle — solo l'icona è "draggable" visivamente */
.portata-drag-handle {
    color: #ccc;
    cursor: grab;
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
    padding: 2px 0;
    transition: color 0.15s;
}

.portata-drag-handle:hover {
    color: #7B1C2E;
}

.portata-drag-handle:active {
    cursor: grabbing;
}

/* Info nomi */
.portata-drag-info {
    flex: 1;
    min-width: 0;
}

.portata-drag-nome {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portata-drag-traduz {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 3px;
    font-size: 11px;
    color: #aaa;
}

/* Azioni */
.portata-drag-azioni {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Form menu ───────────────────────────────────────────── */
.menu-gruppo-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.menu-contatore-badge {
    background: #1a1a2e;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.menu-riepilogo-box {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #555;
    text-align: center;
}

.menu-riepilogo-box span {
    font-size: 22px;
    font-weight: 700;
    color: #7B1C2E;
    display: block;
    line-height: 1.2;
}

/* ─── Impostazioni ────────────────────────────────────────── */
.impo-campo {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.impo-label {
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    min-width: 110px;
    flex-shrink: 0;
}

.impo-valore {
    font-size: 13px;
    color: #1a1a2e;
}
/* ─── Mobile ──────────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px;
        width: 100%;
        overflow-x: hidden;
    }

    .topbar-mobile {
        display: flex;
    }

    /* Card piatti su mobile: azioni sotto il nome */
    .piatto-card {
        flex-wrap: wrap;
    }

    .piatto-card-info {
        flex: 1;
        min-width: 0;
    }

    .piatto-card-prezzo {
        min-width: auto;
    }

    .piatto-card-azioni {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid #f5f5f5;
        margin-top: 4px;
    }

    .btn-piatto-edit,
    .btn-piatto-del {
        flex: 1;
        justify-content: center;
    }
}

/* ─── Stampa ───────────────────────────────────────────────── */
@media print {
    html, body { background: #fff !important; }
    /* Nasconde sidebar, topbar e overlay — non devono comparire in stampa */
    .sidebar,
    .topbar-mobile,
    .sidebar-overlay,
    .flash-container { display: none !important; }

    /* Rimuove il margine lasciato dalla sidebar */
    .main-content { margin-left: 0 !important; }

    /* Evita pagine vuote causate da elementi con min-height:100vh */
    .layout-wrapper,
    .main-content { min-height: 0 !important; height: auto !important; }

    /* Evita interruzioni di pagina indesiderate dentro le card */
    .card, .stat-card { page-break-inside: avoid; break-inside: avoid; }

    @page { margin: 1cm; }

}