/* NEK OA SERVICE STOC — UI style (SB Admin-inspired) */
:root {
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --danger: #e74a3b;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --dark: #5a5c69;
    --gray: #858796;
    --light: #f8f9fc;
    --border: #e3e6f0;
    --sidebar-width: 234px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    color: var(--dark);
    background: var(--light);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
small { font-size: 0.78em; color: var(--gray); font-weight: 400; }

/* ---------- layout ---------- */
#wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    color: #fff;
    list-style: none;
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
    transition: margin-left 0.2s;
}
.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.sidebar-brand a { display: flex; align-items: center; gap: 10px; color: #fff; }
.sidebar-brand a:hover { text-decoration: none; }
.sidebar-brand img {
    width: 44px; height: 44px; object-fit: contain;
    background: #fff; border-radius: 8px; padding: 3px;
}
.sidebar-brand span { font-size: 0.78rem; font-weight: 700; line-height: 1.25; max-width: 130px; }
.brand-version { font-size: 0.68rem; font-weight: 500; opacity: 0.85; }
.topbar-brand .brand-version { color: var(--gray); }
.sidebar-heading {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    padding: 16px 20px 6px;
    font-weight: 700;
}
.nav-item a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px; color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}
.nav-item a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }
.nav-item.active a { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 600; }
.nav-item i { width: 18px; text-align: center; }

#contentWrapper { flex: 1; margin-left: var(--sidebar-width); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sidebar-toggle {
    border: 0; background: transparent; color: var(--dark);
    font-size: 1.1rem; cursor: pointer; padding: 6px 8px; border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--light); }
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); }
.topbar-brand:hover { text-decoration: none; }
.topbar-brand img { height: 34px; width: auto; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.role-badge {
    background: var(--primary); color: #fff; font-size: 0.72rem;
    padding: 4px 10px; border-radius: 20px; font-weight: 600;
}
.role-badge.user { background: var(--gray); }
.main-content { padding: 24px; flex: 1; }
.footer {
    text-align: center; padding: 16px; color: var(--gray);
    font-size: 0.82rem; border-top: 1px solid var(--border); background: #fff;
}

body.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-width) * -1); }
body.sidebar-collapsed #contentWrapper { margin-left: 0; }
body.readonly .admin-only { display: none !important; }

/* ---------- page ---------- */
.page-section { animation: fade 0.15s ease-in; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.55rem; color: var(--dark); }
.page-header p { margin: 4px 0 0; color: var(--gray); }
.page-header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.card {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); margin-bottom: 20px;
}
.card-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header h2 { font-size: 1rem; color: var(--primary); }
.card-header h2 i { margin-right: 6px; }
.card-body { padding: 18px; }
.table-responsive { overflow-x: auto; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: 8px; padding: 18px; display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.stat-card.primary { border-left-color: var(--primary); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.info { border-left-color: var(--info); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 10px; background: var(--light);
    color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-card.danger .stat-icon { color: var(--danger); }
.stat-card.success .stat-icon { color: var(--success); }
.stat-card.info .stat-icon { color: var(--info); }
.stat-label { color: var(--gray); font-size: 0.82rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--dark); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { background: var(--light); color: var(--dark); font-weight: 700; white-space: nowrap; }
.table tbody tr:hover { background: #fafbff; }
.table tr.row-low-stock { background: #fff5f5; }
.table tr.row-low-stock:hover { background: #ffecec; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.empty-row { text-align: center; color: var(--gray); padding: 24px !important; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; color: #fff; }
.badge-low { background: var(--danger); }
.badge-secondary { background: var(--gray); }
.badge-in { background: var(--success); }
.badge-out { background: var(--danger); }
.badge-admin { background: var(--primary); }
.badge-user { background: var(--gray); }
.badge-active { background: var(--success); }
.badge-inactive { background: var(--gray); }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.thumb-placeholder { width: 46px; height: 46px; border-radius: 6px; border: 1px dashed var(--border); background: var(--light); color: var(--gray); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- forms ---------- */
.form-group { margin-bottom: 14px; min-width: 0; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.85rem; }
.form-control {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5e0; border-radius: 6px;
    font-family: inherit; font-size: 0.9rem; background: #fff; color: var(--dark);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.15); }
.form-control[readonly] { background: var(--light); color: var(--gray); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-group.full { grid-column: 1 / -1; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; }
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row .form-control { width: auto; min-width: 170px; }
.filter-row .checkbox-label { font-size: 0.85rem; white-space: nowrap; }
.filter-select { min-width: 140px !important; }
.form-card { max-width: 760px; }

.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    padding: 9px 16px; border: 0; border-radius: 6px; font-family: inherit;
    font-size: 0.88rem; font-weight: 600; cursor: pointer; color: #fff;
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-secondary { background: var(--gray); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 9px; font-size: 0.78rem; }
.btn-link { background: transparent; color: var(--primary); padding: 4px 6px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; font-size: 0.9rem; }
.alert-danger { background: #fdecea; color: #a52a1d; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff8e1; color: #8a6100; border: 1px solid #ffe082; }
.alert-success { background: #e8f8f1; color: #117a53; border: 1px solid #b7ebd4; }

/* ---------- modal ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto; z-index: 1000;
}
.modal[hidden] { display: none; }
.modal-dialog { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); }
.modal-dialog.modal-sm { max-width: 460px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 1.05rem; color: var(--primary); }
.modal-close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--gray); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.image-preview img { max-height: 120px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- toast ---------- */
#toastArea { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: #fff; border-left: 4px solid var(--success); border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); padding: 12px 16px; min-width: 250px; max-width: 380px;
    font-size: 0.88rem;
}
.toast.error { border-left-color: var(--danger); }

/* ---------- login ---------- */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-container { width: 100%; max-width: 430px; }
.login-card {
    background: #fff; border-radius: 12px; padding: 36px 32px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { width: 92px; height: 92px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 5px; }
.login-brand h1 { font-size: 1.15rem; color: var(--dark); margin-top: 14px; letter-spacing: 0.02em; }
.login-brand p { color: var(--gray); margin: 5px 0 0; font-size: 0.85rem; }
.login-footer { text-align: center; color: var(--gray); font-size: 0.78rem; margin-top: 24px; line-height: 1.8; }

/* ---------- responsive ---------- */
@media (max-width: 768px) {
    .sidebar { margin-left: calc(var(--sidebar-width) * -1); }
    body.sidebar-open .sidebar { margin-left: 0; }
    #contentWrapper, body.sidebar-collapsed #contentWrapper { margin-left: 0; }
    .main-content { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-brand span { display: none; }
    .filter-row .form-control { min-width: 130px; }
}
