/* === APLAUZ brand palette === */
:root {
    --apl-pink:   #F4BFC8;
    --apl-blue:   #A7D9EE;
    --apl-yellow: #FFF1A8;
    --apl-grey:   #B9B9B9;
    --apl-dark:   #1a1a2e;
    --apl-sidebar:#16213e;
    --sidebar-width: 240px;
    --studio-d: #F4BFC8;
    --studio-m: #A7D9EE;
    --studio-f: #FFF1A8;
}

body {
    font-family: 'Helvetica Neue', Arial, system-ui, sans-serif;
    background: #f5f6fa;
}

/* === Sidebar === */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--apl-sidebar) !important;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
}

.sidebar-brand {
    background: var(--apl-dark);
    padding: 1rem;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--apl-pink), var(--apl-blue), var(--apl-yellow)) 1;
}

.sidebar .nav-link {
    padding: .45rem .75rem;
    font-size: .875rem;
    transition: background .15s;
    border-radius: 6px;
    color: rgba(255,255,255,.75) !important;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.1) !important;
    color: #fff !important;
}

.sidebar .nav-link.active-link {
    background: var(--apl-pink) !important;
    color: #1a1a2e !important;
    font-weight: 700;
}

.sidebar .section-label {
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--apl-grey);
    padding: .25rem .75rem 0;
    display: block;
    margin-top: .5rem;
}

/* === Cards === */
.card {
    border-radius: .75rem;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.card-header {
    background: #fff !important;
    border-bottom: 1px solid #f0f0f0;
    border-radius: .75rem .75rem 0 0 !important;
    font-weight: 600;
}

/* === Stat cards === */
.stat-card {
    border-left: 4px solid var(--apl-pink);
}
.stat-card.blue   { border-left-color: var(--apl-blue); }
.stat-card.yellow { border-left-color: #e6c800; }
.stat-card.grey   { border-left-color: var(--apl-grey); }
.stat-card.green  { border-left-color: #198754; }

/* === Tables === */
.table th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    font-weight: 600;
    border-bottom-width: 1px;
}

/* === Studio badges === */
.studio-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}
.studio-d { background: var(--studio-d); color: #7a1a2e; }
.studio-m { background: var(--studio-m); color: #1a4a6a; }
.studio-f { background: var(--studio-f); color: #6a5a00; }

/* === Status colors === */
.status-aktivan    { color: #198754; font-weight: 600; }
.status-neaktivan  { color: #dc3545; font-weight: 600; }
.status-pocasni    { color: #6f42c1; font-weight: 600; }
.status-arhiviran  { color: #6c757d; font-weight: 600; }
.status-reaktiviran { color: #0d6efd; font-weight: 600; }

/* === Role badges === */
.badge-uloga-admin       { background: #6f42c1; }
.badge-uloga-koordinator { background: #0d6efd; }
.badge-uloga-prodavac    { background: #198754; }
.badge-uloga-volonter    { background: #6c757d; }

/* === Gantt === */
.gantt-bar {
    height: 24px;
    border-radius: 4px;
    position: absolute;
    top: 4px;
}

/* === QR stiker (CR80 85.6x54mm) === */
.qr-print-area {
    width: 85.6mm;
    height: 54mm;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* === POS / Touch interface === */
.pos-btn {
    min-height: 72px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: transform .1s, box-shadow .1s;
    cursor: pointer;
    border: none;
    letter-spacing: .02em;
}
.pos-btn:active { transform: scale(.97); box-shadow: none !important; }

/* === Scanner page (fullscreen dark) === */
.scanner-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0f0f1a;
    color: #fff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}
.scanner-result-ok   { background: #0a3a1a !important; }
.scanner-result-fail { background: #3a0a0a !important; }

/* === Language toggle === */
.lang-toggle {
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1.5px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.7);
    background: transparent;
    transition: all .15s;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: .05em;
}
.lang-toggle:hover,
.lang-toggle.active {
    border-color: var(--apl-pink);
    color: var(--apl-pink);
    text-decoration: none;
}

/* === Membership warning === */
.badge-expiry-warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.badge-expiry-danger  { background: #f8d7da; color: #842029; border: 1px solid #dc3545; }

/* === Top bar === */
.topbar {
    background: var(--apl-dark);
    padding: .4rem 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

@media print {
    .sidebar, .btn, .alert, nav, .topbar, .mobile-topbar { display: none !important; }
    main { padding: 0 !important; }
}

/* =====================================================================
   MOBILNA OPTIMIZACIJA
   ===================================================================== */

/* --- Mobile topbar --- */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    height: 54px;
    background: var(--apl-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 2px solid var(--apl-pink);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* --- Hamburger button --- */
.mobile-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.mobile-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all .25s;
}

/* --- Sidebar backdrop --- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1041;
}
.sidebar-backdrop.show {
    display: block;
}

/* --- Responsive sidebar --- */
@media (max-width: 767.98px) {
    /* Sidebar skrivena, slide-in drawer */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh !important;
        z-index: 1042;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4,0,.2,1);
        width: 260px !important;
        min-width: 260px !important;
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0,0,0,.3);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Main content pomjeren ispod topbara */
    .main-content {
        padding: 1rem !important;
        padding-top: calc(54px + 1rem) !important;
    }

    /* Tabele scrollable horizontalno */
    .table-responsive-auto table,
    .card .table,
    .card .table-responsive,
    table.table {
        min-width: 540px;
    }
    .card .table-wrapper,
    .card > .table-responsive,
    .card-body > .table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Automatski wrap kartica */
    .row.g-3 > [class*="col-md"],
    .row.g-4 > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Dugmad u redu — wrap */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    /* Stat kartice u 2 kolone na mobilnom */
    .row .stat-col {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Manji naslovi */
    h4.fw-bold { font-size: 1.1rem; }
    h5.fw-bold { font-size: 1rem; }

    /* Footer kompaktniji */
    footer {
        font-size: .7rem !important;
        padding: 8px 12px !important;
    }

    /* Flash poruke imaju padding od topbara */
    .alert { margin-top: 0; }

    /* Sakri sporedne kolone tablice na malim ekranima */
    .d-none-mobile { display: none !important; }

    /* Forme — full width na mobilnom */
    .form-control, .form-select, .input-group {
        font-size: 16px; /* sprječava auto-zoom na iOS */
    }
}

/* --- Desktop: main-content normalan padding --- */
@media (min-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }
    .mobile-topbar {
        display: none !important;
    }
}

/* Globalni table wrapper — sve tablice u karticama su scrollable */
.card .table {
    margin-bottom: 0;
}
.card .table-responsive,
.table-responsive {
    border-radius: 0 0 .75rem .75rem;
}

/* Na mobilnom — tablice manje i scrollabilne (JS automatski wrapa) */
@media (max-width: 767.98px) {
    .table {
        font-size: .82rem;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}
