body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
    font-family: Inter, Arial, sans-serif;
}

.app {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    min-width: 220px;
    max-width: 280px;
    width: fit-content;
    background: #f7f7f7;
    border-right: 2px solid #ddd;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
}

.sidebar h2 {
    margin-top: 20px;
    font-size: 18px;
    color: #444;
}

.sidebar button,
.sidebar select {
    width: 100%;
    padding: 8px;
    margin-top: 6px;
    font-size: 14px;
    box-sizing: border-box;
    border-radius: 10px;
}

/* Odstraněno - nahrazeno specifickými ID selektory */

/* Ikony v tlačítkách */
.sidebar button .icon {
    font-size: 14px;
    margin-right: 4px;
}

.sidebar button .label {
    font-size: 10px;
}

#back-to-index {
    margin-bottom: 16px;
}

.back-home-btn {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.back-home-btn:hover {
    border-color: #7dbf2d;
    background: #f8f8f8;
}

.sidebar label.inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
}

.sidebar button.active {
    background: #7dbf2d;
    color: white;
    font-weight: bold;
    border-radius: 10px;
}

.stage {
    flex: 1;
    position: relative;
    background: #ffffff;
}

/* Canvas kontejner musí mít pevnou CSS velikost podle kontejneru */
#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#floorCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: white;
    cursor: none;
    touch-action: none;
}

#zoom-panel {
    position: absolute;
    right: 20px;
    bottom: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#zoom-panel button {
    width: 40px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
}

#zoom-panel button:hover {
    background: #e0e0e0;
}

/* =========================================================
   CAD UI PATCH – IKONY + MOBIL (BEZ ZÁSAHU DO LAYOUTU)
   ========================================================= */

/* tlačítka v sidebaru – ikona + text */
.sidebar button {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   FRED'S SOLUTION: Stabilní 2×2 grid pro tlačítka
   ========================================================= */

/* Nástroje - 2×2 grid */
#toolButtons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 220px;
    margin-top: 8px;
}

#toolButtons button {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Správa dispozic - 2×2 grid */
#managementButtons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 220px;
    margin-top: 8px;
}

#managementButtons button {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}

/* Otvory - 2×2 grid s plnou šířkou pro niku */
#openingButtons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 220px;
    margin-top: 8px;
}

#openingButtons button {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#openingButtons button.full-width {
    grid-column: 1 / -1;
}

/* Barvy a úpravy - 2×2 grid */
#editButtons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 220px;
    margin-top: 8px;
}

#editButtons button {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}

/* Vlož (v režimu kreslení) - 2×2 grid */
#insertButtons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 220px;
    margin-top: 8px;
}

#insertButtons button {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#insertButtons button.full-width {
    grid-column: 1 / -1;
}

/* ikony */
.sidebar button .icon {
    font-size: 18px;
    line-height: 1;
}

/* obdélník – vizuálně větší */
.sidebar button .rect-icon {
    font-size: 22px;
}

/* ---------------------------------------------------------
   MOBIL / TABLET – kompaktní zobrazení
--------------------------------------------------------- */
@media (max-width: 700px) {
    .sidebar {
        min-width: 180px;
        max-width: 200px;
        padding: 10px;
    }

    .sidebar button {
        justify-content: center;
        padding: 8px 4px;
        font-size: 10px;
    }

    .sidebar button .label {
        display: none;
    }

    .sidebar button .icon {
        font-size: 16px;
        margin-right: 0;
    }

    .sidebar button .rect-icon {
        font-size: 18px;
    }
    
    /* Kompaktní grid na mobilu */
    .sidebar [style*="grid"] {
        gap: 3px !important;
    }
    
    .sidebar [style*="grid"] button {
        padding: 4px 2px !important;
        font-size: 9px !important;
    }
}

.back-brandmark-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
    object-fit: contain;
}