/* =========================================
   MOBILE – TOUCH DEVICES
========================================= */

@media (hover: none) and (pointer: coarse) {

    /* =========================================
       HEADER – CLEAN MOBILE VERSION
    ========================================= */

    .app-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 12px;
        backdrop-filter: blur(10px);
    }

    .header-logo-center {
        position: absolute;
        left: 50vw;
        /* 👈 centrování podle viewportu */
        top: 50%;
        transform: translate(-50%, -50%);
        height: 40px;
        width: auto;
        object-fit: contain;
        pointer-events: none;
    }

    /* Skryj text Tracking System */
    .header-title span {
        display: none;
    }

    /* Zmenši levé logo */
    .header-title img {
        height: 56px;
    }

    /* Zarovnání levé části */
    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    /* Ikony vpravo */
    .header-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .btn-icon {
        font-size: 25px;
        padding: 6px;
    }

    /* Skryj uživatelské jméno – šetří místo */
    .user-name {
        display: none;
    }

    /* =========================================
       MACHINE BAR – FIXED HEIGHT + SNAP SCROLL
    ========================================= */

    .machine-bar {
        padding: 6px 8px;
        height: 110px;
        display: flex;
        align-items: center;
        overflow: hidden;
    }

    #machines-list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        align-items: center;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    #machines-list::-webkit-scrollbar {
        display: none;
    }

    .machine-card {
        width: 200px;
        min-width: 200px;
        height: 105px;
        flex-shrink: 0;
        scroll-snap-align: start;
        transform: none !important;
        display: flex;
        /* 👈 PŘIDAT */
        flex-direction: column;
        /* 👈 PŘIDAT */
        justify-content: center;
        /* 👈 PŘIDAT */
    }

    .machine-card:hover {
        transform: none;
        box-shadow: none;
    }

    .machine-bar-add {
        width: 65px;
        min-width: 65px;
        height: 100px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    /* =========================================
       DETAIL PANEL – BOTTOM SHEET STYLE
    ========================================= */

    .details-panel {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 10px;
        top: auto;

        width: calc(100% - 16px);
        max-width: 600px;
        /* aby to na větších mobilech nebylo moc široké */

        height: 75dvh;
    }

    .panel-header::before {
        content: '';
        display: block;
        width: 42px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
        margin: 0 auto 12px auto;
    }

    /* =========================================
       MAP CONTROLS
    ========================================= */

    .map-controls {
        top: 12px;
        right: 12px;
    }

    .leaflet-top .leaflet-control-zoom {
        display: none !important;
    }

    body.panel-open .leaflet-right .leaflet-control {
        margin-right: 16px !important;
    }

    /* =========================================
       MODAL – FULL HEIGHT SHEET
    ========================================= */

    .modal {
        align-items: flex-end;
        padding-bottom: 12px;
    }

    .modal-content {
        width: 100%;
        height: calc(100dvh - 24px);
        border-radius: 18px 18px 0 0;
        overflow-y: auto;
    }

    .modal-body {
        overflow-y: auto;
    }

    /* =========================================
       REFRESH INDICATOR
    ========================================= */

    .refresh-indicator {
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
    }
}


/* =========================================
   SMALL MOBILE (very narrow screens)
========================================= */

@media (hover: none) and (pointer: coarse) and (max-width: 400px) {

    .machine-card {
        width: 200px;
        min-width: 200px;
        height: 100px;
    }

    .machine-bar-add {
        width: 60px;
        min-width: 60px;
        height: 100px;
    }

    .header-logo-center {
        height: 24px;
    }

    .header-title img {
        height: 42px;
    }

    .btn-icon {
        font-size: 17px;
    }
}


/* =========================================
   MOBILE LANDSCAPE
========================================= */

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {

    .details-panel {
        left: auto;
        right: 0;
        top: 0;
        bottom: 0;
        width: 340px;
        height: 100%;
        border-radius: 0;
    }

    .machine-bar {
        height: 110px;
    }

    .machine-card {
        height: 105px;
    }

    .machine-bar-add {
        height: 75px;
    }
}

@media (hover: none) and (pointer: coarse) and (max-width: 420px) {

    .user-name {
        max-width: 70px;
        font-size: 12px;
    }

    .header-logo-main {
        height: 24px;
    }
}

@media (hover: none) and (pointer: coarse) {

    .app-header {
        height: 60px;
        padding: 0 12px;
    }

    .header-logo-center {
        height: 26px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-logo-small {
        height: 54px;
    }

    .user-name {
        max-width: 70px;
        font-size: 12px;
    }

    .header-right {
        gap: 8px;
    }

    .header-icon {
        height: 46px;
        padding: 0 0px;
    }

    .header-icon .icon {
        font-size: 40px;
        line-height: 1;
    }

    .header-icon .icon-label {
        font-size: 12px;
        margin-top: 2px;
    }
}

/* ===== MOBILE HEADER CLEANUP ===== */
@media (max-width: 768px) {

    .header-title {
        display: none;
    }

}