/* SIAP - Sistem Inventaris Alat Praktik Custom Styling */
/* Mobile-First Responsive Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --siap-primary: #2563eb;
    --siap-primary-hover: #1d4ed8;
    --siap-secondary: #0ea5e9;
    --siap-accent: #6366f1;
    --siap-success: #10b981;
    --siap-warning: #f59e0b;
    --siap-danger: #ef4444;
    --siap-bg: #f8fafc;
    --siap-card-bg: #ffffff;
    --siap-border: #e2e8f0;
    --siap-text: #1e293b;
    --siap-text-muted: #64748b;
    --siap-sidebar-bg: #0f172a;
    --siap-sidebar-text: #cbd5e1;
    --siap-sidebar-hover: #1e293b;
    --siap-sidebar-active: #2563eb;
    --bottom-nav-h: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-bs-theme="dark"] {
    --siap-bg: #090d16;
    --siap-card-bg: #0f172a;
    --siap-border: #1e293b;
    --siap-text: #f1f5f9;
    --siap-text-muted: #94a3b8;
    --siap-sidebar-bg: #070a12;
    --siap-sidebar-text: #cbd5e1;
    --siap-sidebar-hover: #131b2e;
    --siap-sidebar-active: #3b82f6;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--siap-bg);
    color: var(--siap-text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1035;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
#sidebar-overlay.active { display: block; }

#sidebar {
    width: 270px;
    min-width: 270px;
    background-color: var(--siap-sidebar-bg);
    color: var(--siap-sidebar-text);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

#sidebar .brand-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#sidebar .nav-link {
    color: var(--siap-sidebar-text);
    padding: 0.72rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.5rem;
    margin: 0.15rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s;
    min-height: 44px;
}

#sidebar .nav-link i {
    font-size: 1.15rem;
    opacity: 0.85;
    flex-shrink: 0;
}

#sidebar .nav-link:hover {
    background-color: var(--siap-sidebar-hover);
    color: #ffffff;
    transform: translateX(3px);
}

#sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--siap-primary), var(--siap-secondary));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

#sidebar .nav-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #64748b;
    padding: 1rem 1.5rem 0.3rem;
}

#main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    background-color: var(--siap-card-bg);
    border-bottom: 1px solid var(--siap-border);
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-content {
    padding: 1.75rem;
    flex: 1;
}

.card {
    background-color: var(--siap-card-bg);
    border: 1px solid var(--siap-border);
    border-radius: 0.875rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card {
    border-radius: 1rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--siap-border);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.table-responsive { -webkit-overflow-scrolling: touch; }

.table {
    font-size: 0.85rem;
}

.table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--siap-text-muted);
    white-space: nowrap;
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
}

.table td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
}

.sortable-header {
    transition: background-color 0.15s ease;
}

.sortable-header:hover {
    background-color: rgba(37, 99, 235, 0.06) !important;
}

.table-pagination-bar {
    border-bottom-left-radius: 0.875rem;
    border-bottom-right-radius: 0.875rem;
}

.table-pagination-bar .pagination .page-link {
    font-size: 0.78rem;
    border-radius: 0.35rem;
    margin: 0 2px;
    color: var(--siap-text);
}

.table-pagination-bar .pagination .page-item.active .page-link {
    background-color: var(--siap-primary);
    border-color: var(--siap-primary);
    color: #fff;
    font-weight: 600;
}

.badge-condition-normal { background-color: #10b981; color: white; }
.badge-condition-rusak_ringan { background-color: #f59e0b; color: white; }
.badge-condition-rusak_berat { background-color: #ef4444; color: white; }
.badge-condition-perlu_pemeriksaan { background-color: #8b5cf6; color: white; }
.badge-condition-hilang { background-color: #334155; color: white; }
.badge-condition-belum_diperiksa { background-color: #64748b; color: white; }

.badge-status-tersedia { background-color: #059669; color: white; }
.badge-status-dipinjam { background-color: #2563eb; color: white; }
.badge-status-dalam_perbaikan { background-color: #d97706; color: white; }
.badge-status-dikarantina { background-color: #dc2626; color: white; }
.badge-status-dalam_pemeriksaan { background-color: #7c3aed; color: white; }

/* Mobile Bottom Navigation */
#bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--siap-card-bg);
    border-top: 1px solid var(--siap-border);
    z-index: 1030;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.09);
}

#bottom-nav .bottom-nav-inner {
    display: flex;
    align-items: stretch;
    height: var(--bottom-nav-h);
}

#bottom-nav .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--siap-text-muted);
    font-size: 0.63rem;
    font-weight: 600;
    padding: 8px 4px;
    transition: color 0.2s;
    min-height: 44px;
    position: relative;
}

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

#bottom-nav .bn-item.active { color: var(--siap-primary); }

#bottom-nav .bn-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 3px;
    background: var(--siap-primary);
    border-radius: 0 0 4px 4px;
}

#bottom-nav .bn-scan-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bottom-nav .bn-item.bn-scan {
    background: linear-gradient(135deg, var(--siap-primary), var(--siap-secondary));
    color: white;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    min-height: unset;
    flex: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
    padding: 0;
    align-self: center;
}
#bottom-nav .bn-item.bn-scan::before { display: none; }
#bottom-nav .bn-item.bn-scan i { font-size: 1.45rem; }

/* Mobile breakpoint */
@media (max-width: 767.98px) {
    #sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        width: 82vw;
        max-width: 300px;
        min-width: unset;
        height: 100%;
    }

    #sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0,0,0,0.28);
    }

    #main-wrapper {
        padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    }

    .main-content { padding: 1rem 0.875rem; }
    .top-navbar { padding: 0.5rem 0.875rem; }
    #bottom-nav { display: flex; flex-direction: column; }

    .stat-card { padding: 1rem; }
    .stat-card h3 { font-size: 1.55rem; }

    h4.fw-bold { font-size: 1.1rem; }
    h5.fw-bold { font-size: 1rem; }

    .modal-dialog { margin: 0.5rem; }
    .modal-body { padding: 1rem; }

    .table td, .table th {
        font-size: 0.78rem;
        padding: 0.45rem 0.6rem;
    }

    .btn { min-height: 40px; }
    .btn-sm { min-height: 34px; }
    .card { border-radius: 0.75rem; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    #sidebar { width: 230px; min-width: 230px; }
    .main-content { padding: 1.5rem 1.25rem; }
    #sidebar .nav-link { font-size: 0.86rem; }
}

@media (min-width: 992px) {
    #sidebar { position: sticky; transform: none !important; }
    #sidebar-overlay { display: none !important; }
    #bottom-nav { display: none !important; }
    .main-content { padding: 1.75rem; }
}

@media print {
    body { background: white !important; color: black !important; }
    #sidebar, #bottom-nav, .top-navbar, .no-print, .btn, .breadcrumb, footer {
        display: none !important;
    }
    #main-wrapper { margin: 0 !important; padding: 0 !important; }
    .main-content { padding: 0 !important; }
    .qr-print-sheet { display: flex !important; flex-wrap: wrap !important; gap: 12px !important; }
    .qr-label-card {
        page-break-inside: avoid;
        border: 2px solid #000 !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }
}

.qr-label-card {
    width: 320px;
    height: 190px;
    border: 1.5px solid #0f172a;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

.tracking-tight { letter-spacing: -0.02em; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
