/* --- RESET E LAYOUT GENERALE --- */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    color: #eee;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
}

/* --- TOP BAR (HEADER) - CORRETTA PER 2 RIGHE --- */
.header {
    display: flex;
    flex-direction: column;
    /* Forza la disposizione verticale (2 righe) */
    background-color: #000;
    border-bottom: 2px solid #7c8496;
    flex-shrink: 0;
    width: 100%;
}

/* Wrapper principale dell'header (prima inline) */
.header-main {
    background: #111;
    padding: 10px;
    border-bottom: 2px solid #333;
}

/* Stile comune per le righe dell'header */
.header-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #000;
    padding: 10px 20px;
    border-bottom: 3px solid #333;
    margin-bottom: 15px;
}

.header-left {
    width: 280px;
}

.header-last-update {
    font-size: 10px;
    color: #666;
    margin-top: 3px;
}

.header-totals {
    display: flex;
    gap: 20px;
}

.header-selected-id {
    text-align: right;
    width: 280px;
}

.header-selected-id-label {
    color: #555;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.header-selected-id-value {
    color: #fff;
    font-size: 18px;
    font-family: monospace;
}

.header-filters-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 5px;
}

.header-filters-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.totale-grid {
    font-size: 13px;
    color: #f1c40f;
    font-weight: bold;
}

.totale-selezione {
    font-size: 13px;
    color: #00d4ff;
    font-weight: bold;
    margin-left: 20px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 5px;
}

.btn-link {
    color: #00d4ff;
    text-decoration: none;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid #00d4ff;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-link:hover {
    background: #00d4ff;
    color: #000;
}

.btn-aruba {
    color: #f39c12;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid #f39c12;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-aruba:hover {
    background: #f39c12;
    color: #000;
}

.btn-upload-wrapper {
    position: relative;
    display: inline-block;
}

.btn-upload-input {
    display: none;
}

.btn-upload {
    color: #2ecc71;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid #2ecc71;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-upload:hover {
    background: #2ecc71;
    color: #000;
}

/* --- FILTRI HEADER --- */
.filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.filter-group-wide {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 13px;
    color: #aaa;
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

.filter-label-strong {
    font-size: 13px;
    color: #aaa;
    font-weight: bold;
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

.filter-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-input-text {
    height: 30px;
    border-radius: 4px;
    border: 1px solid #555;
    padding: 0 8px;
    font-size: 14px;
}

.filter-input-light {
    width: 180px;
    background: #fff;
    border: 1px solid #ccc;
    color: #000;
}

.filter-input-doc,
.filter-input-ingrediente {
    background: #333;
    color: #fff;
}

.filter-input-doc {
    width: 100px;
}

.filter-input-ingrediente {
    width: 160px;
}

.filter-select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    height: 30px;
    font-size: 13px;
    padding: 0 4px;
}

.filter-select-small {
    @extend .filter-select;
    width: 80px;
}

.filter-select-month {
    @extend .filter-select;
    width: 110px;
}

.filter-date {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    height: 30px;
    font-size: 13px;
    padding: 0 4px;
}

.filter-select-bank {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    height: 30px;
    font-size: 13px;
    padding: 0 4px;
}

.btn-filter-reset {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 0 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    height: 30px;
    font-size: 14px;
}

.btn-filter-reset-ingrediente {
    display: none;
    background: #e67e22;
    color: #fff;
    border: none;
    padding: 0 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    height: 30px;
    text-transform: uppercase;
}

.data-ora {
    font-size: 24px;
    color: #f1c40f;
    font-weight: bold;
}

.totale-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #111;
    padding: 5px 25px;
    border-radius: 6px;
    border: 2px solid #333;
    min-width: 180px;
}

.label-totale {
    font-size: 11px;
    color: #888;
    font-weight: bold;
    text-transform: uppercase;
}

.valore-giallo {
    font-size: 28px;
    color: #f1c40f;
    font-weight: bold;
}

.valore-verde {
    font-size: 28px;
    color: #00ff00;
    font-weight: bold;
}

/* --- GRIGLIE E TABELLE --- */
.grid-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #333;
    gap: 2px;
}

.grid-left {
    flex: 2.5;
    background: #111;
    overflow-y: auto;
}

.grid-right {
    flex: 1.5;
    background: #111;
    overflow-y: auto;
    border-left: 2px solid #333;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    color: #ddd;
}

th {
    background: #2a2a2a;
    color: #7c8496;
    position: sticky;
    top: 0;
    border: 1px solid #444;
    padding: 8px 4px;
    z-index: 10;
    text-align: left;
}

td {
    border: 1px solid #222;
    padding: 4px 3px;
    height: 24px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.inline-editable-cell {
    cursor: pointer;
}

td.inline-editable-cell:hover {
    background: rgba(0, 212, 255, 0.12);
}

td.inline-editable-cell select {
    width: 100%;
    height: 22px;
    background: #1f2937;
    color: #fff;
    border: 1px solid #4b5563;
    font-size: 11px;
}

.testo-destra {
    text-align: right;
}

.testo-centro {
    text-align: center;
}

/* --- OVERLAY PANELS --- */
.overlay-panel {
    display: none;
    position: fixed;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    background: #1a1a1a;
    border: 3px solid #7c8496;
    z-index: 2000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.close-panel {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #ff4444;
    color: white;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    border: 2px solid #7c8496;
}

/* --- CONTEXT MENU --- */
#customContextMenu {
    display: none;
    position: absolute;
    z-index: 3000;
    background: #1a1a1a;
    border: 1px solid #7c8496;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    min-width: 180px;
}

#customContextMenu ul {
    list-style: none;
    margin: 0;
    padding: 5px;
    color: #eee;
    font-size: 13px;
    cursor: pointer;
}

#customContextMenu ul li {
    padding: 8px 12px;
    border-bottom: 1px solid #333;
}

#customContextMenu ul li:hover {
    background-color: #7c8496;
    color: #000;
}

/* Stile per il menu a comparsa */
.context-menu {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 180px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 5px 0;
}

.context-menu-item {
    padding: 10px 15px;
    color: #eee;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background-color: #00d4ff;
    color: #000;
}

/* Stile per i bottoni delle Tab */
.tab-btn {
    background: #1a1a1a;
    color: #888;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.3s;
    border-right: 1px solid #333;
}

.tab-btn:hover {
    background: #333;
    color: #fff;
}

.tab-btn.active {
    background: #333;
    color: #f1c40f;
    /* Giallo coordinato */
    border-bottom: 2px solid #f1c40f;
}

.tab-content {
    height: calc(100% - 40px);
    overflow-y: auto;
}

/* Checkbox Colonna P - Design Personalizzato */
#corpoIngredienti input[type="checkbox"],
#corpoStorico input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background-color: #1a1a1a;
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: all 0.2s ease;
}

/* Stato: Selezionato (Privato = SI) */
#corpoIngredienti input[type="checkbox"]:checked,
#corpoStorico input[type="checkbox"]:checked {
    background-color: #f1c40f;
    /* Giallo intenso per risaltare sul nero */
    border-color: #fff;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
}

/* Segno di spunta */
#corpoIngredienti input[type="checkbox"]:checked::after,
#corpoStorico input[type="checkbox"]:checked::after {
    content: 'P';
    /* Visualizza una 'P' invece del check per chiarezza */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 14px;
    font-weight: bold;
}

/* Hover */
#corpoIngredienti input[type="checkbox"]:hover {
    border-color: #f1c40f;
}

/* Stile per le righe selezionate (Selezione Multipla) */
.selected-multi {
    background-color: #2980b9 !important;
    /* Blu scuro */
    border-left: 5px solid #3498db !important;
    color: white !important;
}

/* Mantieni il colore verde per la riga "attiva" (quella di cui vedi i dettagli) */
.active-row {
    background-color: #2c3e50 !important;
    border-left: 5px solid #00ff00 !important;
}

/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 4px;
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #aaa;
    border-radius: 1px;
    transition: all 0.3s;
}

.hamburger-btn:hover span {
    background: #f1c40f;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
}

.sidebar-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100%;
    background: #111;
    border-left: 2px solid #333;
    z-index: 10002;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 15px 0;
}

.sidebar-menu.open {
    right: 0;
}

.sidebar-close {
    text-align: right;
    padding: 5px 15px 10px;
}

.sidebar-close button {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
}

.sidebar-close button:hover {
    color: #fff;
}

.sidebar-section {
    padding: 8px 20px;
    border-bottom: 1px solid #222;
}

.sidebar-section-title {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sidebar-link {
    display: block;
    padding: 7px 10px;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-link:hover {
    background: #222;
    color: #f1c40f;
}

.sidebar-link.active {
    background: #1a2a1a;
    color: #00ff00;
    font-weight: bold;
}
