/* ========== ERP System — Global Styles ========== */

/* ── Page Transition ─────────────────────────────────────────── */
#page-transition-bar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #5b9fff, #0d6efd, #5b9fff);
    background-size: 200% 100%;
    z-index: 9999;
    transition: width .12s ease;
    animation: bar-shimmer 1.2s linear infinite;
    pointer-events: none;
}
#page-transition-bar.indeterminate {
    width: 80% !important;
}
#page-transition-bar.done {
    width: 100% !important;
    transition: width .1s ease, opacity .25s ease .1s;
    opacity: 0;
}
@keyframes bar-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: 0%   center; }
}

/* Content fade transitions */
.content-area {
    animation: page-fade-in .18s ease forwards;
}
@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}
.page-leaving .content-area {
    animation: page-fade-out .12s ease forwards;
}
@keyframes page-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

:root {
    --sidebar-width: 240px;
    --navbar-height: 56px;
}

/* Layout */
body {
    background-color: #f5f6fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .9rem;
}

body.bg-login {
    background: linear-gradient(135deg, #1a237e 0%, #1976d2 100%);
}

.wrapper {
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: var(--navbar-height);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: #1e2130 !important;
    transition: transform .3s ease;
}

.sidebar .nav-link {
    color: #adb5bd;
    border-radius: 8px;
    padding: .45rem .75rem;
    font-size: .875rem;
    transition: background .2s, color .2s;
    display: flex;
    align-items: center;
}

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

.sidebar .nav-link.active {
    background: rgba(13, 110, 253, .25);
    color: #5b9fff;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
}

/* Content */
.content-area {
    min-width: 0;
}

/* Avatar helpers */
.avatar-xs  { width: 28px; height: 28px; font-size: .75rem; }
.avatar-sm  { width: 34px; height: 34px; font-size: .85rem; }
.avatar-md  { width: 42px; height: 42px; font-size: 1rem;   }
.avatar-lg  { width: 56px; height: 56px; font-size: 1.4rem; }

/* Icon helpers */
.icon-xs { width: 14px !important; height: 14px !important; }
.icon-sm { width: 16px !important; height: 16px !important; }

/* Stat card icon */
.stat-icon svg { width: 24px; height: 24px; }

/* Brand icon on login */
.brand-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #1976d2, #1a237e);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Cards */
.card {
    border-radius: 12px;
}

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

/* Alert custom */
.alert-success { --bs-alert-color: #0f5132; background-color: #d1e7dd; border: none; }
.alert-error,
.alert-danger  { --bs-alert-color: #842029; background-color: #f8d7da; border: none; }
.alert-warning { --bs-alert-color: #664d03; background-color: #fff3cd; border: none; }

/* Login card */
@media (max-width: 576px) {
    .sidebar { display: none; }
    .content-area { padding: 1rem !important; }
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Sidebar nav link smooth click feedback */
.sidebar .nav-link:active {
    transform: scale(.97);
    background: rgba(13,110,253,.35);
}

/* Card hover lift */
.card {
    transition: box-shadow .18s ease;
}
.card:not(.no-hover):hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.09) !important;
}

/* Table row hover */
.table-hover tbody tr {
    transition: background-color .1s ease;
}

/* Button transitions */
.btn {
    transition: opacity .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:active {
    transform: scale(.97);
}

/* Badge transitions */
.badge {
    transition: opacity .15s ease;
}

/* Modal fade is already Bootstrap's, but make it faster */
.modal.fade .modal-dialog {
    transition: transform .18s ease !important;
}
.modal-backdrop.fade {
    transition: opacity .18s ease !important;
}

/* QR Code Badge */
.qr-badge {
    display: inline-block;
    padding: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.qr-badge img,
.qr-badge canvas {
    display: block !important;
    border-radius: 4px;
}
@media print {
    .qr-badge { border: none; box-shadow: none; padding: 0; }
}

/* ── Global Search ───────────────────────────────────────────── */
#globalSearch::placeholder { color: rgba(255,255,255,.55); }
#globalSearch { color: #fff; }
#globalSearch:focus { background-color: rgba(255,255,255,.2) !important; outline: none; box-shadow: none; }
#searchResults .dropdown-item:hover { background-color: #f0f5ff; }
#searchResults .dropdown-item { white-space: normal; }

/* ── Avatar sizes ────────────────────────────────────────────── */
.avatar-xs  { width:28px;  height:28px;  font-size:.75rem; }
.avatar-sm  { width:34px;  height:34px;  font-size:.875rem; }
.avatar-md  { width:42px;  height:42px;  font-size:1rem; }
.avatar-lg  { width:56px;  height:56px;  font-size:1.25rem; }
.avatar-xl  { width:72px;  height:72px;  font-size:1.8rem; }

/* ── Sticky top offset (below fixed navbar) ──────────────────── */
.sticky-top { top: 72px !important; }

