/* ================================
   Restoran POS - Mobile / PWA CSS
   ================================ */

/* ==== Offline indikator ==== */
#offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.25s ease;
}

#offline-indicator.show {
    transform: translateY(0);
}

#offline-indicator i {
    margin-right: 6px;
}

/* ==== PWA install banner ==== */
#pwa-update-banner {
    display: none;
}

#pwa-update-banner.show {
    display: flex !important;
}

/* ==== Bottom nav za mobitele ==== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1020;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: #64748b;
    padding: 6px 12px;
    min-width: 60px;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-radius: 8px;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    line-height: 1;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    color: #0d6efd;
    background: #f1f5f9;
}

.bottom-nav-item.bottom-nav-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white !important;
    transform: translateY(-12px);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.bottom-nav-item.bottom-nav-primary i {
    font-size: 1.75rem;
}

.bottom-nav-item.bottom-nav-primary span {
    display: none;
}

/* Offset za bottom nav, da sadržaj ne bude ispod */
@media (max-width: 991.98px) {
    body {
        padding-bottom: 70px;
    }

    main {
        padding-bottom: 1rem !important;
    }
}

/* ==== Touch-friendly poboljšanja ==== */
@media (max-width: 768px) {
    /* Veći dugmad na mobitelima */
    .btn {
        min-height: 44px;
        padding: 0.6rem 1.1rem;
    }

    .btn-sm {
        min-height: 36px;
    }

    /* Veći form inputi */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 1rem; /* sprječava iOS zoom kod focusa */
    }

    /* Veći tap target za nav linkove */
    .nav-link {
        padding: 0.85rem 1rem !important;
    }

    /* Dropdown menu - veće tap target */
    .dropdown-item {
        padding: 0.75rem 1rem;
    }

    /* Page title - manji na mobitelu */
    .page-title {
        font-size: 1.3rem;
    }

    /* Stat kartice - kompaktnije */
    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .stat-card .stat-label {
        font-size: 0.7rem;
    }

    /* Auth kartica - puna širina */
    .auth-card {
        margin: 1.5rem auto;
        padding: 1.75rem;
    }

    /* Tabele responsivne */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Menu kartice - veće za touch */
    .menu-item-card {
        padding: 1rem;
    }

    /* Sto kartice - veće */
    .sto-card {
        padding: 1rem;
    }

    .sto-card .sto-icon {
        font-size: 2rem;
    }
}

/* ==== iOS / Android PWA specific ==== */
@media (display-mode: standalone) {
    /* Sakrij elemente koji nisu potrebni u "instaliranoj" app */
    body.pwa-mode footer {
        display: none;
    }

    /* Status bar safe area */
    .navbar.sticky-top {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
}

/* ==== Pull-to-refresh hint ==== */
@media (max-width: 768px) {
    main {
        overscroll-behavior-y: contain;
    }
}

/* ==== Brže animacije na mobitelima ==== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==== Active state za touch (umjesto hover) ==== */
@media (hover: none) {
    .menu-item-card:hover,
    .sto-card:hover,
    .card-hover:hover {
        transform: none;
        box-shadow: none;
    }

    .menu-item-card:active,
    .sto-card:active,
    .card-hover:active {
        transform: scale(0.98);
        opacity: 0.85;
    }
}

/* ==== Skriveni elementi ==== */
@media (max-width: 991.98px) {
    /* Sakrij navbar toggler ako postoji bottom nav */
    .navbar-toggler {
        display: none;
    }

    .navbar-collapse {
        display: none !important;
    }

    /* Prikaži samo brand u navbaru */
    .navbar .container-fluid {
        justify-content: space-between;
    }
}

/* ==== Loading skeleton (za buduće API pozive) ==== */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
