/* ============================================================
   POS & Inventory Management System - Main Stylesheet
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --navbar-height: 60px;
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #c8c8d4;
    --sidebar-active: #667eea;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #333;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.sidebar.collapsed { width: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo {
    height: 32px;
    margin-right: 10px;
    border-radius: 6px;
}

.sidebar-nav { padding: 12px 0; }

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border-radius: 0;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav .nav-link:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #fff;
    padding-left: 26px;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    font-size: 16px;
    min-width: 20px;
}

.nav-section {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 16px 20px 6px;
    text-transform: uppercase;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.main-content.expanded { margin-left: 0; }

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.top-navbar {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 0 20px;
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 14px 20px;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-card { transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-3px); }

.kpi-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-primary-soft { background: rgba(102, 126, 234, 0.12); }
.bg-success-soft { background: rgba(40, 167, 69, 0.12); }
.bg-warning-soft { background: rgba(255, 193, 7, 0.12); }
.bg-danger-soft  { background: rgba(220, 53, 69, 0.12); }
.bg-info-soft    { background: rgba(23, 162, 184, 0.12); }

/* ============================================================
   TABLES
   ============================================================ */
.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

.table td { vertical-align: middle; font-size: 14px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: 11px; font-weight: 500; }

/* ============================================================
   PAGINATION
   ============================================================ */
.page-link { color: var(--primary); }
.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert { border-radius: 10px; border: none; }

/* ============================================================
   POS SPECIFIC
   ============================================================ */
.pos-container {
    display: flex;
    gap: 16px;
    height: calc(100vh - 140px);
}

.pos-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    min-width: 0;
}

.pos-right {
    width: 420px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    flex-shrink: 0;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .top-navbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { width: 0; }
    .main-content { margin-left: 0; }
    .sidebar.mobile-open { width: var(--sidebar-width); }
    .pos-container { flex-direction: column; height: auto; }
    .pos-right { width: 100%; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer { cursor: pointer; }

.border-dashed { border-style: dashed !important; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
