/* ==========================================
   Oko Sklad — Premium UI System
   ========================================== */

:root {
    --brand-primary: #5BC2E7;
    --brand-secondary: #29B489;
    --brand-dark: #0f172a;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--slate-800);
    background-color: var(--slate-50);
}

/* === SCROLLBAR === */
.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* === SIDEBAR === */
#sidebar {
    background-color: var(--slate-900);
    color: white;
    border-right: none;
}

.sidebar-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--slate-400);
    border-radius: 12px;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-item.active {
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(91, 194, 231, 0.3);
}

.sidebar-item.active i {
    color: white;
}

/* === CARDS & CONTAINERS === */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-card {
    background: white;
    border: 1px solid var(--slate-100);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 4px 12px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 12px 24px rgba(0,0,0,0.06);
}

/* === TABLE STYLES === */
#data-table {
    border-spacing: 0;
}

#data-table thead th {
    background-color: var(--slate-50);
    color: var(--slate-500);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--slate-200);
}

#data-table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--slate-100);
    transition: background-color 0.15s;
}

#data-table tbody tr:last-child td {
    border-bottom: none;
}

#data-table tbody tr:hover td {
    background-color: var(--slate-50);
}

/* === BADGES === */
.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-instock { background-color: #ecfdf5; color: #059669; }
.badge-lowstock { background-color: #fffbeb; color: #d97706; }
.badge-outstock { background-color: #fef2f2; color: #dc2626; }

/* === BUTTONS === */
.btn-primary {
    background-color: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 6px rgba(91, 194, 231, 0.2);
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #48b2d6;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(91, 194, 231, 0.3);
}

/* === MODALS === */
.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

/* === IMAGE THUMBNAILS === */
.img-preview {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* === ANIMATIONS === */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

/* Mobile Quick Actions */
.mobile-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background-color: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(91, 194, 231, 0.4);
    z-index: 50;
    border: none;
}

/* Transaction List Item */
.history-item {
    border-left: 4px solid var(--slate-200);
    padding: 12px 16px;
    background: white;
    border-radius: 0 12px 12px 0;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.history-item.income { border-left-color: var(--brand-secondary); }
.history-item.outcome { border-left-color: #f43f5e; }
.history-item.add { border-left-color: var(--brand-primary); }
.history-item.delete { border-left-color: var(--slate-400); }

/* === MODAL MOBILE === */
#item-modal-content {
    -webkit-overflow-scrolling: touch;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    height: 100vh;
}/* === COMPACT UI SYSTEM === */
/* Table Permanent Compact Mode */
#data-table tbody td,
#data-table.table-compact tbody td {
    padding: 0.22rem 0.5rem;
    font-size: 0.8125rem;
}
#data-table thead th,
#data-table.table-compact thead th {
    padding: 0.32rem 0.5rem;
}
#data-table .img-preview,
#data-table.table-compact .img-preview {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    object-fit: cover !important;
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    cursor: zoom-in !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    background: #f8fafc;
}

#data-table .img-preview:hover {
    transform: scale(1.18) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2) !important;
    z-index: 20 !important;
    position: relative !important;
}

@media (min-width: 640px) {
    #data-table .img-preview,
    #data-table.table-compact .img-preview {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
    }
}

/* Sidebar Collapsed State */
#sidebar {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden !important;
}
#sidebar.collapsed {
    width: 68px !important;
    min-width: 68px !important;
}
#sidebar.collapsed .sidebar-header {
    padding: 12px 6px !important;
    justify-content: center !important;
    gap: 4px;
}
#sidebar.collapsed .sidebar-header-text {
    display: none !important;
}
#sidebar.collapsed #toggle-sidebar {
    margin-left: 0 !important;
}
#sidebar.collapsed .sidebar-user-box {
    margin: 8px auto !important;
    padding: 0 !important;
    width: 40px !important;
    height: 40px !important;
    background: transparent !important;
    border: none !important;
    justify-content: center !important;
}
#sidebar.collapsed .user-info-text,
#sidebar.collapsed .sidebar-logout-btn {
    display: none !important;
}
#sidebar.collapsed .sidebar-section-header {
    display: none !important;
}
#sidebar.collapsed .sidebar-divider-rule {
    display: block !important;
}
#sidebar.collapsed .sidebar-item {
    justify-content: center !important;
    padding: 10px 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 44px !important;
    border-radius: 12px !important;
    gap: 0 !important;
}
#sidebar.collapsed .sidebar-item span,
#sidebar.collapsed .sidebar-item div span,
#sidebar.collapsed .sidebar-item > span,
#sidebar.collapsed .sidebar-item div.overflow-hidden span {
    display: none !important;
}
#sidebar.collapsed .sidebar-item div {
    gap: 0 !important;
    justify-content: center !important;
}
#sidebar.collapsed .sidebar-item i {
    margin: 0 !important;
}

/* Quick Details Drawer (Slide-over) */
.slide-over-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.slide-over-drawer.open {
    transform: translateX(0);
}
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.2);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Omnisearch Highlighting */
mark.search-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 0 0.125rem;
    border-radius: 0.125rem;
    font-weight: 600;
}

/* Filter Chips */
.filter-chip {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--slate-200);
    background: white;
    color: var(--slate-600);
    transition: all 0.2s;
    white-space: nowrap;
}
.filter-chip:hover {
    background: var(--slate-50);
}
.filter-chip.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

/* Compact Buttons */
.btn-qty-compact {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--slate-100);
    color: var(--slate-600);
    border-radius: 4px;
    transition: background 0.15s;
}
.btn-qty-compact:hover {
    background: var(--slate-200);
}

/* Shake Animation for Auth Error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.animate-shake {
    animation: shake 0.4s ease-in-out;
}

#app-screen.hidden {
    display: none !important;
}
#auth-screen {
    z-index: 99999 !important;
}

/* === FLOATING BULK ACTIONS TOOLBAR (100% Mobile & Desktop Centered) === */
#bulk-toolbar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    bottom: 24px !important;
    bottom: max(24px, calc(16px + env(safe-area-inset-bottom, 0px))) !important;
    width: -moz-fit-content !important;
    width: fit-content !important;
    max-width: calc(100vw - 20px) !important;
    z-index: 9990 !important;
    box-sizing: border-box !important;
    padding: 7px 12px !important;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(51, 65, 85, 0.8) !important;
    border-radius: 18px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4) !important;
    transform: none !important;
    pointer-events: auto !important;
    gap: 8px !important;
}

#bulk-toolbar.hidden {
    display: none !important;
}

#bulk-toolbar:not(.hidden) {
    display: flex !important;
    align-items: center !important;
    animation: bulkToolbarIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes bulkToolbarIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 640px) {
    #bulk-toolbar {
        padding: 10px 18px !important;
        bottom: 28px !important;
        gap: 14px !important;
    }
}
