/* TechFlow POS - Dark Blue, Orange & Green Theme */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --primary-dark: #0f2744;
    --accent: #f97316;
    --accent-light: #fb923c;
    --accent-dark: #ea580c;
    --success: #22c55e;
    --success-light: #4ade80;
    --success-dark: #16a34a;
    --sidebar-width: 260px;
    --tblr-primary: #1e3a5f;
    --tblr-primary-rgb: 30, 58, 95;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

.sidebar-brand {
    padding: 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    position: relative;
}

.sidebar-logo {
    max-width: 60px;
    height: auto;
    max-height: 50px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-brand i { font-size: 2rem; }
.sidebar-brand h5 { font-weight: 700; margin: 0.5rem 0 0; font-size: 0.95rem; line-height: 1.2; }
.sidebar-brand small { opacity: 0.9; font-size: 0.7rem; }

/* Login Logo */
.login-logo-img {
    max-width: 80px;
    height: auto;
    max-height: 70px;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar-nav { 
    padding: 0.75rem; 
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-item { margin-bottom: 0.15rem; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.9rem;
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-link i { width: 22px; margin-right: 0.65rem; font-size: 1.15rem; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* Sidebar Close Button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover { background: rgba(255,255,255,0.3); }

/* 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;
}

.sidebar-overlay.show { display: block; }

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: #f8fafc;
    transition: margin-left 0.3s ease;
}

/* ========== NAVBAR ========== */
.mobile-menu-toggle {
    display: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover { opacity: 0.9; }
.mobile-menu-toggle i { font-size: 1.25rem; }

/* ========== STAT CARDS ========== */
.stat-card {
    border-radius: 12px;
    padding: 1.25rem;
    color: white;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stat-card .h2 { font-size: 1.5rem; }
.stat-card .small { font-size: 0.7rem; }
.stat-card i { font-size: 2.5rem !important; }

.stat-card.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.stat-card.success { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.stat-card.warning { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.stat-card.info { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card.secondary { background: linear-gradient(135deg, #64748b, #475569); }
.stat-card.danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ========== POS LAYOUT ========== */
.pos-container { display: flex; height: calc(100vh - 60px); }
.products-section { flex: 1; overflow-y: auto; padding: 1rem; background: #f8fafc; }
.cart-section { width: 380px; background: white; border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }

.product-card {
    background: white;
    border-radius: 10px;
    padding: 0.85rem;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.product-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(249, 115, 22, 0.15);
}

.product-card .icon { font-size: 1.75rem; color: var(--primary); margin-bottom: 0.4rem; }
.product-card .fw-medium { font-size: 0.8rem; line-height: 1.2; }
.product-card .text-muted { font-size: 0.7rem; }
.product-card .text-primary { color: var(--accent) !important; }

.cart-header {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.cart-items { flex: 1; overflow-y: auto; }
.cart-item { padding: 0.85rem; border-bottom: 1px solid #f0f0f0; }
.cart-footer { padding: 1rem; background: #f8fafc; border-top: 1px solid #e2e8f0; }

/* ========== LOGIN ========== */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
}

.login-logo i { font-size: 1.75rem; color: white; }


/* ========== CARDS & TABLES ========== */
.card { margin-bottom: 1rem; border-radius: 10px; border: 1px solid #e2e8f0; }
.card-header { padding: 0.85rem 1rem; background: white; border-bottom: 1px solid #e2e8f0; }
.card-body { padding: 1rem; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table th, .table td { padding: 0.65rem 0.75rem; vertical-align: middle; }

/* ========== BUTTONS ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border-color: var(--primary) !important;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary)) !important;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark)) !important;
    border-color: var(--success) !important;
}

.btn-warning, .btn-orange {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* ========== BADGES ========== */
.bg-primary { background-color: var(--primary) !important; }
.bg-orange, .bg-warning { background-color: var(--accent) !important; }
.bg-green, .bg-success { background-color: var(--success) !important; }
.text-primary { color: var(--primary) !important; }
.text-orange { color: var(--accent) !important; }

/* ========== ALERTS ========== */
.alert { padding: 0.75rem 1rem; font-size: 0.875rem; border-radius: 8px; }
.alert .btn-sm { white-space: nowrap; }

/* ========== FORM FOCUS ========== */
.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15) !important;
}

/* ========== RESPONSIVE - TABLET (992px) ========== */
@media (max-width: 992px) {
    .sidebar { 
        transform: translateX(-100%); 
        width: 280px;
    }
    .sidebar.show { transform: translateX(0); }
    .sidebar-close { 
        display: flex !important; 
        align-items: center;
        justify-content: center;
    }
    .sidebar-nav {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1.5rem;
    }
    .main-content { margin-left: 0; }
    .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; }
    
    .cart-section { width: 300px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ========== RESPONSIVE - MOBILE (768px) ========== */
@media (max-width: 768px) {
    .container-fluid { padding: 0.75rem !important; }
    .page-body { padding: 0; }
    
    .page-header { margin-bottom: 1rem !important; }
    .page-header .row { flex-direction: column; gap: 0.75rem; }
    .page-header .col-auto.ms-auto { margin-left: 0 !important; width: 100%; }
    .page-header .btn { width: 100%; }
    .page-header h2 { font-size: 1.15rem; }
    
    .row-deck.row-cards.mb-3 {
        display: flex !important;
        flex-wrap: wrap !important;
        margin: 0 -0.25rem !important;
    }
    .row-deck.row-cards.mb-3 > .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0.25rem !important;
    }
    .stat-card {
        padding: 0.75rem;
        height: 100%;
        min-height: 85px;
    }
    .stat-card .h2 { font-size: 1.05rem; margin-bottom: 0 !important; }
    .stat-card .small { font-size: 0.6rem; line-height: 1.2; }
    .stat-card i { font-size: 1.4rem !important; }
    
    .pos-container { 
        flex-direction: column; 
        height: auto; 
        min-height: calc(100vh - 60px);
    }
    .products-section { padding: 0.5rem; }
    .cart-section { 
        width: 100%; 
        border-left: none; 
        border-top: 2px solid var(--accent);
    }
    .cart-items { max-height: 180px; }
    
    .product-grid { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
    .product-card { padding: 0.5rem; }
    .product-card .icon { font-size: 1.2rem; margin-bottom: 0.2rem; }
    .product-card .fw-medium { font-size: 0.65rem; }
    .product-card .text-muted { font-size: 0.55rem; }
    .product-card .text-primary { font-size: 0.7rem; }
    
    .card { margin-bottom: 0.75rem; }
    .card-header { padding: 0.65rem 0.85rem; }
    .card-body { padding: 0.75rem; }
    
    .table { min-width: 600px; }
    .table th, .table td { padding: 0.5rem; font-size: 0.8rem; white-space: nowrap; }
    
    .form-control, .form-select { font-size: 16px; padding: 0.5rem 0.75rem; }
    .btn { font-size: 0.875rem; padding: 0.5rem 0.85rem; }
    
    .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
}

/* ========== RESPONSIVE - SMALL MOBILE (480px) ========== */
@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    
    .stat-card { padding: 0.6rem; min-height: 75px; }
    .stat-card .h2 { font-size: 0.9rem; }
    .stat-card i { font-size: 1.2rem !important; }
    
    .login-wrapper { padding: 0.75rem; }
    .login-card { padding: 1rem; max-width: 320px; }
    
    .sidebar { width: 85vw; max-width: 260px; }
    .sidebar-brand { padding: 0.6rem; }
    .sidebar-logo { max-width: 45px; max-height: 38px; }
    .nav-link { padding: 0.5rem 0.65rem; font-size: 0.8rem; }
}

/* ========== UTILITY CLASSES ========== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

html { scroll-behavior: smooth; }

.btn, .product-card, .nav-link {
    -webkit-user-select: none;
    user-select: none;
}

.btn:focus, .form-control:focus, .form-select:focus, .nav-link:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ========== ANIMATIONS ========== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* ========== PRINT STYLES ========== */
@media print {
    .sidebar, .navbar, .mobile-menu-toggle, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* ========== AVATAR COLORS ========== */
.avatar.bg-primary-lt, .bg-primary-lt { background: rgba(30, 58, 95, 0.1) !important; color: var(--primary) !important; }
.avatar.bg-orange-lt, .bg-orange-lt { background: rgba(249, 115, 22, 0.1) !important; color: var(--accent) !important; }
.avatar.bg-green-lt, .bg-green-lt { background: rgba(34, 197, 94, 0.1) !important; color: var(--success) !important; }
