/* ===== ROOT VARIABLES ===== */
:root {
    --cgo-red: #E74C3C;
    --cgo-red-dark: #C0392B;
    --cgo-black: #111111;
    --cgo-dark: #1b1b1b;
    --cgo-charcoal: #252525;
    --bg-light: #f4f5f7;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --sidebar-width: 280px;
    --navbar-height: 78px;
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
}

/* ===== APP CONTAINER ===== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--cgo-black), var(--cgo-dark));
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1001;
    transition: transform 0.3s ease;
}

@media (max-width: 1199px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Brand Section */
.sidebar-brand {
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.brand-icon {
    width: 46px;
    height: 46px;
    background: var(--cgo-red);
    color: var(--cgo-black);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: -1px;
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.25);
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.sidebar-brand p {
    font-size: 12px;
    color: #a3a3a3;
    margin-top: 2px;
    line-height: 1.3;
}

/* Navigation Menu */
.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 6px;
}

.nav-link {
    color: #b7b7b7;
    text-decoration: none;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-link:hover {
    background: rgba(231, 76, 60, 0.09);
    color: #fff;
}

.nav-link.active {
    background: var(--cgo-red);
    color: var(--cgo-black);
    font-weight: 800;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Submenu Icon Rotation */
.submenu-icon {
    margin-left: auto;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.nav-link[aria-expanded="true"] .submenu-icon {
    transform: rotate(-180deg);
}

/* Submenu Styles */
.submenu {
    list-style: none;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 6px;
    overflow: hidden;
}

.submenu-link {
    color: #a3a3a3;
    text-decoration: none;
    padding: 10px 12px 10px 44px;
    display: block;
    font-size: 13px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.submenu-link:hover {
    color: #fff;
    background: rgba(231, 76, 60, 0.09);
    border-left-color: var(--cgo-red);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 18px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #a3a3a3;
    font-size: 12px;
    text-align: center;
}

/* ===== SIDEBAR OVERLAY (MOBILE) ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    visibility: hidden;
}

.sidebar-overlay.show {
    opacity: 0;
    visibility: visible;
}

@media (max-width: 1199px) {
    .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 1199px) {
    .sidebar-overlay {
        display: block;
    }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-light);
}

/* ===== NAVBAR TOP ===== */
.navbar-top {
    background: var(--bg-white);
    height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.navbar-left h1 {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
    white-space: nowrap;
}

/* Hamburger Button */
.btn-hamburger {
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.btn-hamburger:hover {
    color: var(--cgo-red);
}

@media (max-width: 1199px) {
    .btn-hamburger {
        display: flex;
    }
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Navbar Items */
.navbar-item {
    position: relative;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-icon:hover {
    color: var(--cgo-red);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--cgo-red);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* User Button */
.btn-user {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.btn-user:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cgo-black);
    color: var(--cgo-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    color: var(--text-dark);
    display: none;
}

@media (min-width: 768px) {
    .user-name {
        display: block;
    }
}

/* ===== CONTENT AREA ===== */
.content-area {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

@media (min-width: 768px) {
    .content-area {
        padding: 24px;
    }
}

/* ===== HERO SECTION ===== */
.hero-section {
    background: linear-gradient(135deg, #121212 0%, #252525 70%, #3a2d05 100%);
    color: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.18);
}

.hero-header {
    position: relative;
    z-index: 1;
}

.hero-header h2 {
    font-size: 24px;
    margin-bottom: 4px;
    font-weight: 700;
}

.hero-header p {
    color: #d8d8d8;
    font-size: 13px;
    max-width: 760px;
}

/* ===== METRIC CARDS ===== */
.metric-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all 0.2s ease;
    height: 100%;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--cgo-red);
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.icon-yellow {
    background: rgba(231, 76, 60, 0.15);
    color: var(--cgo-red);
}

.icon-blue {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
}

.icon-green {
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
}

.icon-red {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    display: block;
    margin-bottom: 3px;
}

.metric-value {
    font-size: 26px;
    font-weight: 900;
    margin: 0;
    letter-spacing: -1px;
}

.metric-note {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--radius);
    border: none;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert i {
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===== SCROLLBAR CUSTOM ===== */
.sidebar::-webkit-scrollbar,
.content-area::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .content-area {
        padding: 16px;
    }
    
    .navbar-top {
        padding: 0 16px;
    }
}

/* ===== UTILITY CLASSES ===== */
.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: #dc2626 !important;
}

.opacity-75 {
    opacity: 0.75;
}

/* ===== INVENTORY SCREENS ===== */
.inventory-page {
    max-width: 1500px;
    margin: 0 auto;
}

.inventory-hero {
    background: linear-gradient(135deg, #151515 0%, #2b2b2b 68%, #5a1712 100%);
    border-radius: var(--radius);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px;
    box-shadow: var(--shadow-md);
}

.inventory-eyebrow {
    color: #f2b8b1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.inventory-hero h2 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 4px;
}

.inventory-hero p {
    color: #d6d6d6;
    font-size: 14px;
    margin: 0;
    max-width: 720px;
}

.inventory-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.inventory-toolbar,
.inventory-panel,
.inventory-form-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.inventory-toolbar {
    margin-bottom: 18px;
    padding: 18px;
}

.inventory-toolbar .form-label,
.inventory-form-card .form-label {
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.input-icon {
    position: relative;
}

.input-icon i {
    color: var(--text-muted);
    left: 12px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.input-icon .form-control {
    padding-left: 38px;
}

.inventory-panel,
.inventory-form-card {
    overflow: hidden;
}

.inventory-panel-header,
.inventory-form-header {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
}

.inventory-panel-header h3,
.inventory-form-header h3 {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 2px;
}

.inventory-panel-header p,
.inventory-form-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.inventory-panel-icon {
    align-items: center;
    background: rgba(231, 76, 60, 0.12);
    border-radius: 10px;
    color: var(--cgo-red);
    display: inline-flex;
    flex-shrink: 0;
    font-size: 20px;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.inventory-table {
    --bs-table-hover-bg: #fff7f6;
    font-size: 14px;
}

.inventory-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    color: #374151;
    font-size: 11px;
    font-weight: 900;
    padding: 12px 16px;
    text-transform: uppercase;
    white-space: nowrap;
}

.inventory-table tbody td {
    border-bottom: 1px solid #eef0f3;
    padding: 14px 16px;
    vertical-align: middle;
}

.inventory-table-compact tbody td {
    padding-bottom: 11px;
    padding-top: 11px;
}

.code-pill,
.warehouse-pill,
.movement-pill,
.status-pill,
.stock-status {
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.code-pill {
    background: #202020;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    padding: 7px 9px;
}

.warehouse-pill {
    background: #f3f4f6;
    border: 1px solid #d9dde3;
    color: #374151;
    font-size: 12px;
    padding: 7px 9px;
}

.movement-pill {
    background: rgba(231, 76, 60, 0.13);
    color: var(--cgo-red-dark);
    font-size: 11px;
    padding: 7px 9px;
}

.status-pill {
    font-size: 12px;
    padding: 7px 10px;
}

.status-pill-ok,
.stock-status-ok {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.status-pill-danger,
.stock-status-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.stock-status-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.stock-status {
    font-size: 12px;
    padding: 8px 10px;
}

.table-main-text {
    color: var(--text-dark);
    font-weight: 700;
}

.table-muted,
.quantity-unit,
.dash-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.table-subline {
    color: var(--text-muted);
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.quantity-value,
.quantity-warning {
    font-weight: 800;
}

.quantity-warning {
    color: #b45309;
}

.folio-text {
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

.row-muted-danger td {
    background: #fff1f1;
}

.empty-state {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 46px 16px;
    text-align: center;
}

.empty-state i {
    color: #a8b0bd;
    font-size: 34px;
}

.empty-state strong {
    color: var(--text-dark);
    font-size: 16px;
}

.inventory-pagination {
    border-top: 1px solid var(--border-color);
    padding: 14px 18px;
}

.inventory-form-body {
    padding: 22px;
}

.form-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 18px;
    padding: 18px;
}

.form-section-title {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.form-section-title i {
    align-items: center;
    background: #f3f4f6;
    border-radius: 10px;
    color: var(--cgo-red);
    display: inline-flex;
    flex-shrink: 0;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.form-section-title h4 {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
}

.form-section-title p {
    color: var(--text-muted);
    font-size: 12px;
    margin: 2px 0 0;
}

.inventory-note {
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    padding: 12px 14px;
}

.inventory-note i {
    color: var(--cgo-red);
    margin-top: 2px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .inventory-hero,
    .inventory-panel-header,
    .inventory-form-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .inventory-hero-actions,
    .form-actions {
        justify-content: stretch;
        width: 100%;
    }

    .inventory-hero-actions .btn,
    .form-actions .btn,
    .form-actions button {
        width: 100%;
    }

    .inventory-hero h2 {
        font-size: 22px;
    }
}
