/* ============================================
   SmartPOS - Custom Stylesheet
   ============================================ */

:root {
    --sidebar-width: 260px;
    --primary-color: #4361ee;
    --primary-dark: #3a0ca3;
    --primary-light: #7209b7;
    --secondary-color: #4cc9f0;
    --accent-color: #f72585;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --dark-color: #1a1a2e;
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --body-bg: #f0f2f5;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: #333;
    font-size: 14px;
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    min-width: 36px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 400;
}

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

.sidebar-link.active {
    color: #fff;
    background: var(--primary-color);
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
}

.sidebar-link .dropdown-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.sidebar-link:not(.collapsed) .dropdown-icon {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding-left: 0;
}

.sidebar-submenu .sidebar-link {
    padding-left: 42px;
    font-size: 13px;
}

/* Make sidebar menu area scrollable while keeping header and user panels visible */
.sidebar-header {
    z-index: 2;
}
.sidebar-user {
    z-index: 2;
}
.sidebar-nav {
    /* reserve space for header + user + logout area (~140px) */
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: 8px; /* space for scrollbar */
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
}

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

/* ============================================
   Content Area
   ============================================ */
.content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   Cards
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.stat-card .stat-label {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.bg-gradient-primary { background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.bg-gradient-success { background: linear-gradient(135deg, #06d6a0, #059669); }
.bg-gradient-warning { background: linear-gradient(135deg, #fbbf24, #d97706); }
.bg-gradient-danger { background: linear-gradient(135deg, #ef476f, #dc2626); }
.bg-gradient-info { background: linear-gradient(135deg, #4cc9f0, #0891b2); }
.bg-gradient-purple { background: linear-gradient(135deg, #7c3aed, #5b21b6); }

/* ============================================
   Tables
   ============================================ */
.table {
    font-size: 13.5px;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #555;
    padding: 12px;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    padding: 10px 12px;
}

.table-hover tbody tr:hover {
    background-color: #f0f7ff;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    padding: 8px 16px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #3651d4;
    border-color: #3651d4;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12.5px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    padding: 9px 14px;
    font-size: 13.5px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 100%;
    padding: 40px;
}

.auth-card .auth-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

/* ============================================
   Badge
   ============================================ */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
}

/* ============================================
   Pagination
   ============================================ */
.page-link {
    border-radius: 8px;
    margin: 0 2px;
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================
   POS Cashier Styles
   ============================================ */
.pos-wrapper {
    height: 100vh;
    overflow: hidden;
}

.pos-products {
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.pos-cart {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
}

.pos-cart-total {
    border-top: 2px solid #eee;
    padding: 15px;
    background: #f8f9fa;
}

.product-card-pos {
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    border-radius: 12px;
}

.product-card-pos:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.2);
}

.product-card-pos .product-img {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 32px;
    color: #aaa;
}

.cart-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: var(--transition);
}

.cart-item:hover {
    background: #f8f9fa;
}

.qty-input {
    width: 50px;
    text-align: center;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 4px;
    font-size: 13px;
}

/* ============================================
   Utilities
   ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Print styles */
@media print {
    .sidebar, .navbar, .btn, .no-print {
        display: none !important;
    }
    .content-wrapper {
        margin: 0 !important;
        width: 100% !important;
    }
}
