/* ===========================================
   Inventory System - Minimal Custom Theme
   Bootstrap 5 Based - Custom Colors Only
   =========================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ===========================================
   CSS Variables - Theme Colors Only
   =========================================== */
:root {
    /* Primary Theme Colors */
    --primary-gold: #d4a84b;
    --primary-gold-light: #e8c36a;
    --primary-gold-dark: #b8923d;
    --primary-dark: #1a2942;
    --primary-navy: #243654;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

/* ===========================================
   Base - Font Override
   =========================================== */
body {
    font-family: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===========================================
   Layout Structure
   =========================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--primary-dark);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* ===========================================
   Sidebar Styles
   =========================================== */
.sidebar-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    min-height: 64px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.sidebar-logo-link:hover {
    text-decoration: none;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(212, 168, 75, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-logo-link:hover .sidebar-logo {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 168, 75, 0.4);
}

.sidebar-brand-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.sidebar-brand-sub {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.75rem 0.625rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

.nav-section {
    margin-bottom: 0.25rem;
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.75rem 0.375rem;
}

.nav-section-title-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.nav-section-title-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: rgba(255, 255, 255, 0.65);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 1px;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(212, 168, 75, 0.25);
}

.sidebar-nav .nav-link.active .nav-icon {
    color: var(--primary-dark);
}

.nav-icon {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
    line-height: 1;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-badge {
    background: var(--primary-gold);
    color: var(--primary-dark);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
}

.sidebar-nav .nav-link.active .nav-badge {
    background: var(--primary-dark);
    color: var(--primary-gold);
}

/* --- Sidebar Footer (Fixed at bottom) --- */
.sidebar-footer {
    flex-shrink: 0;
    flex-grow: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
}

.sidebar-footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0;
}

/* Collapse Button */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-collapse-btn i {
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

/* User Area */
.sidebar-user-wrapper {
    position: relative;
}

/* Dropdown opens upward from footer */
.sidebar-user-wrapper .dropdown-menu {
    inset: auto auto 100% 0 !important;
    transform: none !important;
    margin-bottom: 0.25rem !important;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.07);
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.75rem;
}

.user-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--primary-dark);
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.user-role i {
    font-size: 0.6rem;
}

.user-menu-icon {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-user:hover .user-menu-icon {
    color: rgba(255, 255, 255, 0.6);
}

/* Sidebar Dropdown Menu */
.sidebar-dropdown-menu {
    width: calc(var(--sidebar-width) - 1.5rem);
    margin: 0 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    transform-origin: bottom center;
    animation: dropdownSlideUp 0.2s ease;
}

@keyframes dropdownSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-dropdown-menu .dropdown-header {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: #f8f9fa;
    margin-bottom: 0.25rem;
}

.sidebar-dropdown-menu .dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.sidebar-dropdown-menu .dropdown-item:hover {
    background: #f0f1f3;
}

.sidebar-dropdown-menu .dropdown-item.text-danger:hover {
    background: #fef2f2;
}

.sidebar-dropdown-menu .dropdown-divider {
    margin: 0.25rem 0;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0.375rem;
    margin-left: auto;
    border-radius: 0.375rem;
    display: none;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ===========================================
   Header Styles
   =========================================== */
.app-header {
    background: #fff;
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    background: #f8f9fa;
    border: 1px solid transparent;
    border-radius: 0.75rem;
}

.header-search input:focus {
    background: #fff;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.15);
    outline: none;
}

.header-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.header-icon-btn {
    width: 42px;
    height: 42px;
    background: #f8f9fa;
    border: none;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.header-icon-btn:hover {
    background: var(--primary-gold);
    color: var(--primary-dark);
}

.header-icon-btn .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    padding: 0;
    background: #dc3545;
    border-radius: 50%;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    background: #f8f9fa;
    border-radius: 0.75rem;
    cursor: pointer;
}

.header-user:hover {
    background: #e9ecef;
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: 600;
}

.header-user-name {
    font-weight: 600;
}

/* ===========================================
   Page Header
   =========================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.page-subtitle {
    color: #6c757d;
    margin: 0.25rem 0 0;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===========================================
   Custom Buttons (Non-Bootstrap)
   =========================================== */
.btn-gold {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    color: var(--primary-dark);
    font-weight: 600;
}

.btn-gold:hover,
.btn-gold:focus {
    background: var(--primary-gold-dark);
    border-color: var(--primary-gold-dark);
    color: #fff;
}

.btn-soft {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #212529;
}

.btn-soft:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-soft.text-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff !important;
}

.btn-soft.text-success:hover {
    background: #198754;
    border-color: #198754;
    color: #fff !important;
}

.btn-filter {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-filter:hover,
.btn-filter:focus {
    background: var(--primary-navy);
    border-color: var(--primary-navy);
    color: #fff;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================================
   Form Focus States (Theme Color)
   =========================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.15);
}

.form-check-input:checked {
    background-color: var(--primary-gold);
    border-color: var(--primary-gold);
}

.form-check-input:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.15);
}

/* ===========================================
   Table Action Buttons
   =========================================== */
.table-action-btns {
    display: flex;
    gap: 0.375rem;
}

.table-action-btns .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===========================================
   Dashboard Stat Cards
   =========================================== */
.stat-card {
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card.gradient-gold {
    background: linear-gradient(135deg, #d4a84b 0%, #e8c36a 50%, #b8923d 100%);
    color: var(--primary-dark);
}

.stat-card.gradient-navy {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-navy) 100%);
    color: #fff;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card-label {
    opacity: 0.9;
}

.stat-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.75rem;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 1.25rem;
}

/* Info Cards */
.info-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #dee2e6;
    transition: all 0.15s ease;
}

.info-card:hover {
    border-color: var(--primary-gold);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.info-card-icon {
    width: 52px;
    height: 52px;
    background: #f8f9fa;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.info-card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.info-card-label {
    color: #6c757d;
    font-size: 0.85rem;
}

.info-card-trend {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.info-card-trend.up { color: #198754; }
.info-card-trend.down { color: #dc3545; }

/* ===========================================
   Warehouse Card
   =========================================== */
.warehouse-card {
    transition: all 0.15s ease;
}

.warehouse-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.warehouse-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-dark) 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

/* ===========================================
   Empty State
   =========================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* ===========================================
   Product Image
   =========================================== */
.product-image,
.product-image-sm {
    background: #f8f9fa;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.product-image {
    width: 48px;
    height: 48px;
}

.product-image-sm {
    width: 40px;
    height: 40px;
}

.product-image img,
.product-image-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image i,
.product-image-sm i {
    color: #6c757d;
}

.product-name {
    font-weight: 600;
    color: #212529;
    transition: color 0.15s ease;
}

.product-name:hover {
    color: var(--primary-gold);
}

.product-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Low Stock Warning */
.low-stock-warning {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #dc3545;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ===========================================
   Activity List
   =========================================== */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #dee2e6;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.success { background: #d1e7dd; color: #198754; }
.activity-icon.warning { background: #fff3cd; color: #856404; }
.activity-icon.danger { background: #f8d7da; color: #dc3545; }
.activity-icon.info { background: #cff4fc; color: #0dcaf0; }

.activity-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.activity-time {
    color: #6c757d;
    font-size: 0.8rem;
}

/* ===========================================
   Chart Container
   =========================================== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container.small {
    height: 200px;
}

/* ===========================================
   Loading Spinner
   =========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ===========================================
   Login Page
   =========================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-navy) 100%);
    padding: 1.25rem;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-gold);
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.login-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-title {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.login-subtitle {
    text-align: center;
    color: #6c757d;
    margin-bottom: 2rem;
}

/* ===========================================
   DataTables Customization
   =========================================== */
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.15);
    outline: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-gold) !important;
    border-color: var(--primary-gold) !important;
    color: var(--primary-dark) !important;
}

/* ===========================================
   Select2 Customization
   =========================================== */
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.15);
}

/* ===========================================
   Pagination Theme
   =========================================== */
.page-item.active .page-link {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.page-link:hover {
    background-color: var(--primary-gold);
    border-color: var(--primary-gold);
    color: var(--primary-dark);
}

/* ===========================================
   Utility Classes
   =========================================== */
.text-gold { color: var(--primary-gold) !important; }
.bg-gold { background-color: var(--primary-gold) !important; }
.text-navy { color: var(--primary-dark) !important; }
.bg-navy { background-color: var(--primary-dark) !important; }

/* Status backgrounds */
.bg-pending { background: #fff3cd; color: #856404; }
.bg-in-progress { background: #cff4fc; color: #055160; }
.bg-completed { background: #d1e7dd; color: #0f5132; }
.bg-cancelled { background: #f8d7da; color: #842029; }
.bg-draft { background: #e9ecef; color: #495057; }

/* ===========================================
   Responsive - Sidebar
   =========================================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1050;
    }
    
    .app-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .header-search {
        display: none !important;
    }
    
    .sidebar-close {
        display: block;
    }

    .sidebar-dropdown-menu {
        width: calc(280px - 1.5rem);
    }
}

@media (max-width: 767.98px) {
    .app-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-actions {
        width: 100%;
    }
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ===========================================
   Collapsed Sidebar - Desktop
   =========================================== */
@media (min-width: 992px) {
    .app-wrapper.sidebar-collapsed .app-sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .app-wrapper.sidebar-collapsed .app-main {
        margin-left: var(--sidebar-collapsed-width);
    }

    /* Hide text elements */
    .app-wrapper.sidebar-collapsed .sidebar-brand-group,
    .app-wrapper.sidebar-collapsed .nav-section-title,
    .app-wrapper.sidebar-collapsed .nav-text,
    .app-wrapper.sidebar-collapsed .nav-badge,
    .app-wrapper.sidebar-collapsed .user-info,
    .app-wrapper.sidebar-collapsed .user-menu-icon {
        display: none !important;
    }
    
    /* Header: center logo */
    .app-wrapper.sidebar-collapsed .sidebar-header {
        padding: 1rem;
        justify-content: center;
    }

    .app-wrapper.sidebar-collapsed .sidebar-logo-link {
        justify-content: center;
    }
    
    /* Nav: compact padding */
    .app-wrapper.sidebar-collapsed .sidebar-nav {
        padding: 0.75rem 0.375rem;
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .app-wrapper.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
    
    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link {
        padding: 0.625rem;
        justify-content: center;
        gap: 0;
    }

    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link:hover {
        transform: none;
    }

    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link .nav-icon {
        font-size: 1.1rem;
    }
    
    /* User area: center avatar only */
    .app-wrapper.sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding: 0.625rem;
    }

    .app-wrapper.sidebar-collapsed .user-status-dot {
        width: 8px;
        height: 8px;
    }

    /* Footer: compact */
    .app-wrapper.sidebar-collapsed .sidebar-footer {
        padding: 0;
    }

    /* Collapse button: icon only */
    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn {
        justify-content: center;
        padding: 0.625rem;
    }

    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn .nav-text {
        display: none !important;
    }

    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }

    /* Dropdown menu: position to the right in collapsed */
    .app-wrapper.sidebar-collapsed .sidebar-dropdown-menu {
        position: fixed !important;
        inset: auto auto 0.5rem calc(var(--sidebar-collapsed-width) + 0.5rem) !important;
        width: 240px !important;
        margin: 0 !important;
        transform: none !important;
    }

    .app-wrapper.sidebar-collapsed .sidebar-user-wrapper .dropdown-menu {
        inset: auto auto 0.5rem calc(var(--sidebar-collapsed-width) + 0.5rem) !important;
    }
    
    /* CSS Tooltip for collapsed menu items */
    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link {
        position: relative;
    }
    
    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link[data-title]::after {
        content: attr(data-title);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e293b;
        color: #fff;
        padding: 0.4rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.15s ease;
        z-index: 1100;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link[data-title]::before {
        content: '';
        position: absolute;
        left: calc(100% + 6px);
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #1e293b;
        opacity: 0;
        visibility: hidden;
        transition: all 0.15s ease;
        z-index: 1100;
    }
    
    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link:hover::after,
    .app-wrapper.sidebar-collapsed .sidebar-nav .nav-link:hover::before {
        opacity: 1;
        visibility: visible;
    }

    /* Collapse button tooltip */
    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn {
        position: relative;
    }

    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn::after {
        content: 'ขยายเมนู';
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e293b;
        color: #fff;
        padding: 0.4rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.15s ease;
        z-index: 1100;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .app-wrapper.sidebar-collapsed .sidebar-collapse-btn:hover::after {
        opacity: 1;
        visibility: visible;
    }
}

/* ===========================================
   Transfer Page
   =========================================== */
.transfer-summary {
    text-align: center;
}

.transfer-item {
    padding: 0.625rem;
    border-radius: 0.5rem;
    background: #f8f9fa;
    margin-bottom: 0.3125rem;
}

.transfer-item i {
    margin-right: 0.5rem;
}

.transfer-arrow {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin: 0.625rem 0;
}

/* ===========================================
   Inventory Count - Data Entry Enhancements
   =========================================== */

/* Row highlighting */
.count-row {
    transition: background-color 0.2s ease;
}

.count-row.row-has-diff {
    background-color: #fff3cd20;
}

.count-row:hover {
    background-color: #f8f9fa;
}

/* Sticky table header */
.table-responsive thead {
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Input focus enhancement */
.count-input:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 168, 75, 0.25);
    outline: none;
    background-color: #fffef8;
}

/* Quick filter buttons */
#quickFilters .btn-check:checked + label {
    background-color: var(--primary-dark);
    color: white;
}

#quickFilters label {
    font-size: 0.875rem;
}

#quickFilters .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

/* Checkbox styling */
.row-select {
    cursor: pointer;
}

/* Unsaved indicator */
#unsavedCount {
    font-weight: 600;
    color: var(--primary-gold);
}

/* Scanner collapsed state */
#scannerBody {
    overflow: hidden;
}

/* Keyboard shortcuts modal */
#keyboardHelpModal kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

/* Copy system button */
.btn-copy-system {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Row animation */
@keyframes highlight-fade {
    0% { background-color: rgba(13, 110, 253, 0.1); }
    100% { background-color: transparent; }
}

.table-primary {
    animation: highlight-fade 1s ease;
}

/* Loading state for inputs */
.count-input.saving {
    opacity: 0.6;
    pointer-events: none;
}

/* Product image placeholder */
.product-image-sm {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    color: #6c757d;
}

/* Scanner header cursor */
#scannerHeader {
    -webkit-user-select: none;
    user-select: none;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    #quickFilters {
        flex-direction: column;
        width: 100%;
    }

    #quickFilters label {
        width: 100%;
        text-align: left;
    }

    .table-responsive {
        max-height: 400px !important;
    }

    .count-input {
        font-size: 0.875rem;
    }
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    .app-sidebar,
    .app-header,
    .page-actions {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
    }
}
