:root {
    --bg-color: #f4f4f4;
    --card-bg: #ffffff;
    --accent-color: #2c3e50;
    --highlight-color: #27ae60;
}

/* ZÁKLAD - Reset */
html, body { margin: 0; padding: 0; background-color: var(--bg-color); }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; user-select: none; -webkit-user-select: none; box-sizing: border-box; }

/* 1. KIOSK MÓD (Index) - FIXNÍ, ZAMČENÝ */
body.kiosk-mode { 
    height: 100vh;       /* Pevná výška okna */
    width: 100vw;
    overflow: hidden;    /* ZÁKAZ SCROLLU celé stránky */
    display: flex; 
    flex-direction: column; 
}
body.not-today { border: 10px solid #c0392b !important; }

/* 2. BĚŽNÉ STRÁNKY (Settings, Stock) - SCROLL POVOLEN */
body.scrollable {
    height: auto;        /* Výška podle obsahu */
    min-height: 100vh;   /* Minimálně na celou obrazovku */
    overflow-y: auto;    /* SCROLL POVOLEN */
}

/* Kontejnery */
.settings-container, .stock-container {
    max-width: 1200px; margin: 20px auto; background: white; padding: 30px;
    border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: auto; overflow: visible; 
}

header { background-color: var(--accent-color); color: white; padding: 5px 20px; display: flex; justify-content: space-between; align-items: center; height: 50px; flex-shrink: 0; }
.date-controls { display: flex; align-items: center; gap: 10px; font-weight: bold; }
.date-btn { background: rgba(255,255,255,0.2); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }
.btn-today { background: #f39c12; color: white; border: 2px solid white; padding: 5px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; margin-left: 10px; }

/* --- KIOSK KONTEJNER --- */
.kiosk-container { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    padding: 5px; 
    gap: 8px; /* Větší mezera mezi sekcemi */
    overflow: hidden; 
}

.grid-section { 
    background: rgba(255,255,255,0.5); 
    border-radius: 10px; 
    padding: 5px; 
    padding-bottom: 8px; /* Trochu místa dole pro jistotu */
    display: flex; 
    flex-direction: column;
    overflow: hidden; 
    
    /* OHRANIČENÍ ZESPOD */
    border-bottom: 4px solid rgba(0,0,0,0.15);
}

/* ROZLOŽENÍ VÝŠKY */
.section-large { flex: 2; } /* 40% */
.section-small { flex: 1; } /* 20% */

.section-header { font-size: 0.8rem; font-weight: bold; color: #7f8c8d; text-transform: uppercase; margin-bottom: 5px; margin-left: 5px; flex-shrink: 0; }

/* --- HLAVNÍ GRID --- */
.grid-container { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); /* 7 sloupců napevno */
    grid-auto-rows: 1fr; /* Řádky se roztahují */
    gap: 6px; 
    flex: 1; 
    height: auto;
    min-height: 0; 
}

/* KARTA */
.card { 
    background: white; 
    border-radius: 6px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    
    cursor: pointer; 
    position: relative; 
    width: 100%;
    height: 100%; 
    overflow: hidden; 
    padding: 4px; /* Trochu odstup od krajů */
}
.card:active { background: #eee; }

/* IKONY */
.card-icon { 
    flex: 1; 
    min-height: 0; 
    width: 100%; 
    object-fit: contain; 
    max-height: 55px; /* LIMIT VELIKOSTI */
    margin-bottom: 2px;
}

/* PLACEHOLDER */
.icon-placeholder { 
    flex: 0 0 auto;
    width: 65%;       
    aspect-ratio: 1/1; 
    max-width: 55px; 
    max-height: 70%; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.4rem; 
    font-weight: bold; 
    color: white; 
    margin-bottom: 3px; 
}
.ph-user { background-color: #3498db; } .ph-holka { background-color: #e84393; } .ph-alien { background-color: #95a5a6; } .ph-alko { background-color: #e74c3c; } .ph-nealko { background-color: #3498db; }

/* JMÉNO */
.card-name { 
    flex-shrink: 0; 
    font-weight: bold; 
    text-align: center; 
    font-size: 0.85rem; 
    line-height: 1.1;
    color: #333;
    width: 100%;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* SHOP GRID (V modálu) - 6 sloupců */
.shop-grid { 
    display: grid; 
    grid-template-columns: repeat(6, 1fr); /* Pevně 6 sloupců */
    gap: 8px; 
    padding: 5px; 
}

/* Ujistíme se, že karty v shopu vypadají dobře */
.shop-grid .card { 
    aspect-ratio: 1/1; 
    height: auto; 
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.shop-grid .card-name { font-size: 0.85rem; font-weight: bold; line-height: 1.2; } 
.shop-grid .card-icon { width: 55%; height: 55%; flex: initial; max-height: none; }
.shop-grid .icon-placeholder { width: 55%; height: auto; aspect-ratio: 1/1; max-width: none; max-height: none; flex: 0 0 auto; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; }
.modal-content { background: #ecf0f1; width: 95%; max-width: 1000px; height: 90%; border-radius: 10px; display: flex; flex-direction: column; padding: 15px; position: relative; box-sizing: border-box; }
.modal-login { background: white; width: 350px; max-width: 90%; height: auto; border-radius: 15px; padding: 30px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,0.5); text-align: center; }
.modal-header { display: flex; justify-content: space-between; border-bottom: 2px solid #bdc3c7; padding-bottom: 10px; margin-bottom: 10px; align-items: center; }
.close-btn { font-size: 2rem; color: #e74c3c; cursor: pointer; }
.items-section { flex: 1; overflow-y: auto; }
/* ZAROVNÁNÍ HLAVIČEK V MODÁLU */
.items-section table th { text-align: left; padding-left: 5px; }

.shop-footer { display: flex; gap: 10px; height: 60px; margin-top: 10px; flex-shrink: 0; }
.btn-footer { flex: 1; border: none; border-radius: 8px; font-weight: bold; color: white; cursor: pointer; font-size: 1.2rem; }
.btn-info { background: #3498db; } .btn-total { background: #f1c40f; color: #2c3e50; } .btn-pay { background: #e74c3c; }
.list-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.list-table th, .list-table td { border: 1px solid #ddd; padding: 8px; text-align: left; vertical-align: middle; }
.btn-save { background: #27ae60; color: white; padding: 10px 20px; border: none; cursor: pointer; width: 100%; margin-top: 10px; border-radius: 5px; }
.btn-del { background: #c0392b; color: white; text-decoration: none; padding: 5px 10px; border-radius: 3px; font-size: 0.8rem; cursor: pointer; border:none; }
.btn-edit { background: #f39c12; color: white; padding: 5px 10px; border-radius: 3px; font-size: 0.8rem; cursor: pointer; border: none; }
.arrow-btn { text-decoration: none; font-size: 1.2rem; margin: 0 2px; color: #2c3e50; }
.form-group { margin-bottom: 15px; }
label { display: block; font-weight: bold; margin-bottom: 5px; }
input, select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
.crop-container { max-width: 100%; height: 400px; background: #333; margin-bottom: 15px; }
.cropper-view-box, .cropper-face { border-radius: 50%; }
.tab-bar { display: flex; gap: 5px; margin-bottom: 10px; }
.tab-btn { padding: 10px 20px; background: #ddd; border: none; cursor: pointer; border-radius: 5px 5px 0 0; font-weight: bold; }
.tab-btn.active { background: #8e44ad; color: white; }
.pagination-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; background: #eee; padding: 10px; border-radius: 5px; }
.page-btn { padding: 5px 15px; background: #fff; border: 1px solid #ccc; cursor: pointer; border-radius: 3px; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.stock-loader { display: none; text-align: center; padding: 20px; font-weight: bold; color: #7f8c8d; }
.item-overlay-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; justify-content: center; align-items: center; }
.quantity-control-box { display: flex; flex-direction: column; align-items: center; }
.dimmed-icon-container { width: 220px; height: 220px; background: white; border-radius: 20px; display: flex; justify-content: center; align-items: center; filter: brightness(0.3); }
.dimmed-icon-container img { width: 80%; height: 80%; object-fit: contain; }
.overlay-placeholder { font-size: 5rem; color: white; font-weight: bold; }
.quantity-display { position: absolute; font-size: 8rem; color: white; font-weight: bold; pointer-events: none; }
.quantity-buttons { display: flex; gap: 40px; margin-top: 20px; }
.q-btn { width: 90px; height: 90px; border-radius: 50%; border: 2px solid white; font-size: 3rem; font-weight: bold; cursor: pointer; color: white; background: transparent; }
.q-btn-minus { background: rgba(231,76,60,0.8); } .q-btn-plus { background: rgba(39,174,96,0.8); }
.q-btn-ok { margin-top: 30px; width: 200px; height: 70px; background: #f1c40f; color: #2c3e50; font-size: 2rem; border: none; border-radius: 10px; font-weight: bold; }
