/* ============================================
   GLOBAL STYLES - Vape Shop POS System
   Modern, clean, high-contrast dashboard layout
   ============================================ */

/* CSS Variables */
:root {
    --primary: #0f3460;
    --primary-light: #1a4a7a;
    --primary-dark: #0a2545;
    --secondary: #e94560;
    --secondary-light: #ff6b81;
    --accent: #00d4aa;
    --bg-dark: #1a1a2e;
    --bg-sidebar: #16213e;
    --bg-card: #ffffff;
    --bg-body: #f0f2f5;
    --text-primary: #1a1a2e;
    --text-secondary: #666666;
    --text-light: #ffffff;
    --border-color: #e0e0e0;
    --success: #00c853;
    --warning: #ffab00;
    --danger: #ff1744;
    --info: #00b0ff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   PRIMARY BUTTON SYSTEM STYLES
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.btn-primary {
    background-color: #e94560; /* Your brand primary accents color */
    border-color: #e94560;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.15);
}

/* Hover State */
.btn-primary:hover {
    background-color: #ff6b81;
    border-color: #ff6b81;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(233, 69, 96, 0.25);
}

/* Active / Pressed State */
.btn-primary:active {
    background-color: #d2334c;
    border-color: #d2334c;
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(233, 69, 96, 0.15);
}

/* Focus State (Accessibility) */
.btn-primary:focus-visible {
    outline: none;
    border-color: #ff6b81;
    box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.35);
}

/* Disabled State */
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Icon Tweak inside buttons */
.btn-primary span,
.btn-primary i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

/* ============================================
   DANGER BUTTON SYSTEM STYLES
   ============================================ */

.btn-danger {
    background-color: #ff1744; /* Matches your defined --danger token */
    border-color: #ff1744;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 23, 68, 0.15);
}

/* Hover State */
.btn-danger:hover {
    background-color: #ff4d6d;
    border-color: #ff4d6d;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 23, 68, 0.25);
}

/* Active / Pressed State */
.btn-danger:active {
    background-color: #d5002f;
    border-color: #d5002f;
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(255, 23, 68, 0.15);
}

/* Focus State (Accessibility) */
.btn-danger:focus-visible {
    outline: none;
    border-color: #ff4d6d;
    box-shadow: 0 0 0 4px rgba(255, 23, 68, 0.35);
}

/* Disabled State */
.btn-danger:disabled,
.btn-danger.disabled {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Action button specific variance (for data table rows) */
.btn-sm.btn-danger {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
    box-shadow: none;
}

.btn-sm.btn-danger:hover {
    background-color: #ff1744; /* Force flat solid hover color inside your usersTable */
    color: white;
    transform: none;
    box-shadow: 0 2px 6px rgba(255, 23, 68, 0.2);
}
/* ============================================
   LAYOUT STRUCTURE
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Left-aligned on Desktop) */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 32px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    padding: 12px 16px 8px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-light);
}

.nav-link.active {
    background: var(--primary);
    color: var(--text-light);
    box-shadow: 0 2px 12px rgba(15, 52, 96, 0.4);
}

.nav-link .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
}

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

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: rgba(233, 69, 96, 0.15);
    color: var(--secondary-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(233, 69, 96, 0.25);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    background: var(--bg-card);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Hamburger Menu Button (Hidden by default on desktop) */
.menu-toggle {
    display: none;
    font-size: 35px !important;
    background: transparent;
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title .breadcrumb {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 2px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

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

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px 28px;
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* Responsive Table Wrapper Utility */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.metric-icon.sales { background: rgba(0, 212, 170, 0.12); }
.metric-icon.discount { background: rgba(255, 171, 0, 0.12); }
.metric-icon.expense { background: rgba(233, 69, 96, 0.12); }
.metric-icon.profit { background: rgba(0, 176, 255, 0.12); }

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-value.positive { color: var(--success); }
.metric-value.negative { color: var(--danger); }
.metric-value.warning { color: var(--warning); }

/* ============================================
   TABLES
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-body);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: rgba(15, 52, 96, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.form-control::placeholder {
    color: #aaa;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   RESPONSIVE OVERRIDES
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        left: auto;
        right: 0; /* Align sidebar to the right side */
        transform: translateX(100%); /* Hide off-screen to the right */
        box-shadow: -4px 0 20px rgba(0,0,0,0.25);
    }
    .sidebar.open {
        transform: translateX(0); /* Slide in from the right */
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block; /* Show menu toggle button */
    }
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 12px 16px;
    }
    .page-title {
        font-size: 18px;
    }
    .page-title .breadcrumb {
        font-size: 11px;
    }
    .top-bar-actions span {
        display: none; /* Hide date stamp to preserve space */
    }
    .content-area {
        padding: 16px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .metric-card {
        padding: 16px;
    }
    .metric-value {
        font-size: 22px;
    }
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 12px 10px;
    }
}
@keyframes loaderSpinner {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        /* Lock body scroll while mask layer is up */
        body.loading-locked {
            overflow: hidden !important;
            height: 100vh !important;
        }