/* ============================================================================
   SHELL SERVICE CSS - Styly pro shell service komponenty (slide panely, hamburger)
   ============================================================================ */

/* SAFE ZONE SYSTÉM - CSS proměnné pro odsazení od okraje displeje */
:root {
    --info-panel-handle-height: 45px;
    --safe-zone-top: calc(env(safe-area-inset-top) + 0px);
    --safe-zone-bottom: calc(env(safe-area-inset-bottom) + 0px);
    --safe-zone-right: calc(env(safe-area-inset-right) + 0px);
    --safe-zone-left: calc(env(safe-area-inset-left) + 0px);
    -webkit-tap-highlight-color: transparent;
}

/* SAFE ZONE TŘÍDY pro různé kontejnery */
.main-container .safe-zone {
    margin-top: var(--safe-zone-top);
    margin-bottom: var(--safe-zone-bottom);
    margin-left: var(--safe-zone-left);
    margin-right: var(--safe-zone-right);
}

.menu-panel-container .safe-zone {
    margin-top: var(--safe-zone-top);
    margin-bottom: var(--safe-zone-bottom);
    margin-right: var(--safe-zone-right);
}

.info-panel-container .safe-zone {
    margin-bottom: var(--safe-zone-bottom);
    margin-left: var(--safe-zone-left);
    margin-right: var(--safe-zone-right);
}

/* INFO PANEL (Responzivní: Mobile slide-up + Desktop overlay modal) */
.info-panel {
    position: fixed;
    top: 100dvh;
    /* Panel pod okrajem obrazovky */
    left: var(--safe-zone-left);
    right: var(--safe-zone-right);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    height: 80dvh;
    overflow-y: visible;;
    transform: translateY(0);
    /* Výchozí = zasunutý (translateY 0 = skrytý) */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* MOBILE INFO PANEL - Slide-up panel (řízeno JavaScript device detection) */
.info-panel-mobile.panel-hidden {
    transform: translateY(0);
    /* Hidden = výchozí pozice (pod okrajem) */
}

.info-panel-mobile.panel-peek {
    transform: translateY(calc(-1 * var(--info-panel-handle-height) - var(--safe-zone-bottom)));
    /* Peek = mírně vystouplý */
}

.info-panel-mobile.panel-partial {
    transform: translateY(min(-100px));
    /* Partial = střední pozice */
}

.info-panel-mobile.panel-full {
    transform: translateY(-80dvh);
    /* Full = plně rozbalený */
}

.info-panel-handle {
    /* Průhledná dotyková oblast - větší pro lepší ovládání */
    position: absolute;
    top: -10px; /* Částečně překrývá container */
    left: 0;
    right: 0;
    height: 115px; /* Vyšší = pohodlnější drag */
    cursor: pointer;
    background: transparent;
    z-index: 9999; /* Nad grafickou lištou */
    /* Touch optimizations */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    /* Zakázat tap highlight a focus outline */
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* NOVÝ: Wrapper pro grafickou úchopnou lištu (sdílený mezi panely) */
.info-panel-graphic-handle {
    padding: 12px;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px 20px 0 0;
    position: relative;
    z-index: 1; /* Pod dotykovou oblastí */
    pointer-events: none; /* Jen vizuální, dotyk pouze na handle */
}

.info-panel-bar {
    width: 40px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    transition: background 0.3s ease;
}

/* Hover efekt přes dotykovou oblast */
.info-panel-handle:hover + .menu-panel-graphic-handle .info-panel-bar,
.info-panel-handle:hover + .menu-panel-graphic-handle .menu-panel-bar {
    background: #999;
}

.info-panel-container {
    padding: 0 20px 20px 20px;
    min-height: 200px;
}

.info-panel-container h3 {
    color: var(--primary-color, #333);
    margin-bottom: 10px;
}

/* DESKTOP INFO PANEL - Permanent Overlay (řízeno JavaScript device detection) */
.info-panel-desktop {
    /* Reset mobile styles */
    bottom: auto;
    left: auto;
    right: 13px;
    top: 60px;
    /* Odsazeno od zoom indikátoru */
    width: calc(max(33.33vw, 350px));
    /* Min 1/3 obrazovky, min 350px */
    max-width: 500px;
    max-height: calc(100vh - 120px);
    /* Odsazeno shora i zespoda */
    border-radius: 12px;
    transform: translateX(0);
    /* Vždy viditelný */
    transition: none;
    /* Bez animace, statický panel */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Desktop ignoruje všechny panel stavy - vždy viditelný */
.info-panel-desktop.panel-visible,
.info-panel-desktop.panel-hidden,
.info-panel-desktop.panel-peek,
.info-panel-desktop.panel-partial,
.info-panel-desktop.panel-full {
    transform: translateX(0);
}

/* Desktop handle - skrýt kompletně */
.info-panel-desktop .info-panel-handle,
.info-panel-desktop .info-panel-graphic-handle {
    display: none;
}

/* INFO BUBBLE pro desktop (poblíž markeru) */
.info-bubble {
    position: fixed;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 350px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.info-bubble.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.info-bubble-content {
    padding: 15px;
}

.info-bubble-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.98);
    transform: rotate(45deg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-right: none;
    z-index: 1;
}

/* Arrow default positioning - bude upravováno JavaScriptem */
.info-bubble-arrow {
    bottom: -7px;
    left: 50%;
    margin-left: -6px;
}

/* Skrýt bublinu na mobile */
body.mobile-mode .info-bubble {
    display: none;
}

/* MOBILE LANDSCAPE - Info panel jen přes levou polovinu */
@media (orientation: landscape) {
    .info-panel-mobile {
        left: var(--safe-zone-left);
        right: 50%;
        /* Jen levá polovina obrazovky */
    }
}

/* MENU PANEL (Sidebar Menu) */
.menu-panel {
    position: fixed;
    top: max(0px, var(--safe-zone-top));
    left: -80vw;
    width: min(80vw, 350px);
    height: calc(100dvh - max(0px, var(--safe-zone-top)) - max(0px, var(--safe-zone-bottom)));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: visible;
    /* NOVÝ: Flexbox layout */
    display: flex;
    /* flex-direction: column; */
    border-radius: 0 20px 20px 0; /* Zaoblené jen pravé rohy */
}

/* DESKTOP MENU PANEL */
.menu-panel-desktop {
    top: max(14px, var(--safe-zone-top));
    left: max(13px, var(--safe-zone-left));
    bottom: max(20px, var(--safe-zone-bottom));
    width: 320px;
    height: auto;
    transform: scale(0.95) translateY(-10px);
    transform-origin: max(14px, var(--safe-zone-top)) max(13px, var(--safe-zone-left));
    /* Animace začíná z pozice hamburger menu */
    opacity: 0;
    visibility: hidden;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.menu-panel-desktop.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Skryj handle, graphic handle a bar pro desktop verzi */
.menu-panel-desktop .menu-panel-handle,
.menu-panel-desktop .menu-panel-graphic-handle,
.menu-panel-desktop .menu-panel-bar {
    display: none;
}

/* Desktop container úpravy */
.menu-panel-desktop .menu-panel-container {
    padding: 24px;
    height: 100%;
}

.menu-panel-handle {
    /* Průhledná dotyková oblast - větší pro lepší ovládání */
    position: absolute;
    top: 0px; /* Pokrývá střed panelu */
    right: -30px; /* Částečně venku z panelu */
    width: 100px; /* Širší dotyková oblast */
    height: 100%; /* Vyšší = pohodlnější drag */
    cursor: pointer;
    background: transparent;
    z-index: 2; /* Nad grafickou lištou */
    /* Touch optimizations */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    /* Zakázat tap highlight a focus outline */
    -webkit-tap-highlight-color: transparent;
    outline: none; 
}

/* NOVÝ: Wrapper pro grafickou úchopnou lištu menu panelu */
.menu-panel-graphic-handle {
    width: 28px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1; /* Nad obsahem, pod dotykovou oblastí */
    pointer-events: none; /* Jen vizuální */
    background: rgba(255, 255, 255, 0.98);
    border-radius: 0 20px 20px 0; /* Zaoblené jen pravé rohy */
}

.menu-panel-bar {
    width: 4px;
    height: 40px;
    background: #ccc;
    border-radius: 2px;
    transition: background 0.3s ease;
}

/* Hover efekt přes dotykovou oblast */
.menu-panel-handle:hover + .menu-panel-graphic-handle .menu-panel-bar {
    background: #999;
}

.menu-panel-container {
    padding: 20px;
    height: 100%;
    width: calc(100% - 28px); 
}

.menu-panel-container h3 {
    color: var(--primary-color, #333);
    margin-bottom: 15px;
}

/* HAMBURGER MENU BUTTON */
.hamburger-menu-btn {
    position: fixed;
    top: max(14px, var(--safe-zone-top));
    left: max(13px, var(--safe-zone-left));
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: auto;
    /* Zajisti vždy funkční clicks */
}

.hamburger-menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hamburger to Cross Animation */
.hamburger-menu-btn.cross .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(4.2px, 4.2px);
}

.hamburger-menu-btn.cross .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.hamburger-menu-btn.cross .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(4.2px, -4.2px);
}

/* MENU OVERLAY */
.menu-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* MOBILE TOUCH OPTIMIZATIONS */
.info-panel-handle,
.menu-panel-handle,
.hamburger-menu-btn {
    /* Ensure minimum touch target size */
    min-width: 44px;
    min-height: 44px;

    /* Prevent mobile zoom on touch */
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}



/* ACCESSIBILITY */
.hamburger-menu-btn:focus,
.info-panel-handle:focus,
.menu-panel-handle:focus {
    outline: 2px solid var(--primary-color, #333);
    outline-offset: 2px;
}


/* UI REŽIM podle data atributů - shell komponenty */
body[data-ui-mode="bubble"] .info-panel {
    display: none !important;
}

body[data-ui-mode="panel"] .bubble-info-window {
    display: none !important;
}

/* ============================================================================
   SAFE AREA VISUALIZATION
   ============================================================================ */
.safe-area-visualization {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
}

.safe-area {
    position: absolute;
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid red;
}

.safe-area.top {
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-zone-top);
}

.safe-area.bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--safe-zone-bottom);
}

.safe-area.left {
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--safe-zone-left);
}

.safe-area.right {
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--safe-zone-right);
}
.safe-area.hidden {
    display: none;
}