/* ==========================================================
   EMATECH Smart Barcode Scanner & POS - Executive Design System
   Modern, Cohesive & Elegant Darker-Light Gray Theme Palette
   High-Contrast Deep Typography & Refined Status Accents
   ========================================================== */

:root {
    /* Brand Primary Accent - Deep Royal / Navy Blue */
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #93c5fd;

    /* Semantic Status Colors - Darker, richer tones for high contrast */
    --success: #047857;
    --success-hover: #065f46;
    --success-light: #ecfdf5;
    --success-border: #86efac;

    --warning: #b45309;
    --warning-hover: #92400e;
    --warning-light: #fffbeb;
    --warning-border: #fcd34d;

    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --danger-light: #fef2f2;
    --danger-border: #fca5a5;

    --purple: #6d28d9;
    --purple-hover: #5b21b6;
    --purple-light: #f5f3ff;
    --purple-border: #d8b4fe;

    --cyan: #0e7490;
    --cyan-hover: #155e75;
    --cyan-light: #ecfeff;
    --cyan-border: #7dd3fc;

    --indigo: #4338ca;
    --pink: #be185d;

    /* Surfaces & Backgrounds - Darker executive slate gray */
    --bg-dark: #eaedf2;
    --bg-body: #eaedf2;
    --card-bg: #ffffff;
    --card-subtle: #e2e6ec;
    --card-header: #f1f4f8;
    --card-border: #cbd3de;
    --card-border-subtle: #dbe0e8;
    --border-strong: #aeb8c6;

    /* Typography Colors - Rich Charcoal & Slate */
    --text-main: #090d16;
    --text-body: #1e293b;
    --text-muted: #475569;
    --text-sub: #64748b;

    /* Geometry & Shadows */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;

    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

    --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    background-image: radial-gradient(#c2c9d6 1.3px, transparent 1.3px);
    background-size: 22px 22px;
    color: var(--text-body);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 75px; /* space for mobile bottom bar */
}

/* Custom Refined Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #e2e6ec;
}
::-webkit-scrollbar-thumb {
    background: #b4becb;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #8e9bb0;
}

/* ==========================================================
   Header Navigation Bar (Enhanced Frosted Glass)
   ========================================================== */
.app-header {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 500;
    height: 64px;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
}

.header-container {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    flex-shrink: 0;
}

.brand-svg-logo {
    height: 38px;
    width: auto;
    max-width: 190px;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Top Nav desktop pills */
.nav-links {
    display: none;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
    margin-left: auto;
    margin-right: 18px;
}

html[dir="ltr"] .nav-links {
    margin-left: 18px !important;
    margin-right: auto !important;
}

@media (min-width: 992px) {
    .nav-links {
        display: flex;
    }
}

.nav-link, .nav-dropdown-toggle {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 10px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}

.nav-link i, .nav-dropdown-toggle i {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.nav-link:hover, .nav-dropdown-toggle:hover {
    color: var(--text-main);
    background: #f1f5f9;
}

.nav-link:hover i, .nav-dropdown-toggle:hover i {
    transform: translateY(-1px);
}

.nav-link.active, .nav-dropdown-toggle.active {
    color: var(--primary);
    background: #eff6ff;
    border-color: var(--primary-border);
    box-shadow: 0 1px 3px rgba(29, 78, 216, 0.08);
    font-weight: 800;
}

/* Nav Dropdown Container */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle .chevron-icon {
    font-size: 13px;
    opacity: 0.6;
    transition: transform 0.2s ease;
    margin-right: -2px;
}

html[dir="ltr"] .nav-dropdown-toggle .chevron-icon {
    margin-right: 0;
    margin-left: -2px;
}

.nav-dropdown:hover .chevron-icon,
.nav-dropdown.open .chevron-icon {
    transform: rotate(180deg);
    opacity: 1;
}

/* Nav Floating Dropdown Menu Card */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 290px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.04);
    padding: 8px;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

html[dir="ltr"] .nav-dropdown-menu {
    right: auto;
    left: 0;
}

.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Dropdown Menu Item */
.dropdown-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.15s ease;
    position: relative;
}

.dropdown-nav-item:hover {
    background: #f8fafc;
    transform: translateX(-3px);
}

html[dir="ltr"] .dropdown-nav-item:hover {
    transform: translateX(3px);
}

.dropdown-nav-item.active {
    background: #eff6ff;
    color: var(--primary);
}

.dropdown-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dropdown-nav-item:hover .dropdown-icon-box {
    transform: scale(1.08);
}

.dropdown-item-content {
    flex: 1;
    min-width: 0;
    text-align: right;
}

html[dir="ltr"] .dropdown-item-content {
    text-align: left;
}

.dropdown-item-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

.dropdown-nav-item.active .dropdown-item-title {
    color: var(--primary);
}

.dropdown-item-desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Quick Add Button in Header */
.btn-header-add {
    background: #1d4ed8;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn-header-add:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.3);
    color: #ffffff;
}

/* User Account Dropdown in Header */
.user-account-dropdown {
    position: relative;
    display: inline-block;
}

.user-account-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    padding: 4px 10px 4px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

html[dir="ltr"] .user-account-btn {
    padding: 4px 6px 4px 10px;
}

.user-account-btn:hover, .user-account-dropdown.open .user-account-btn {
    border-color: #93c5fd;
    background: #f8fafc;
}

.user-account-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
}

.user-account-name {
    font-size: 12.5px;
    font-weight: 800;
    color: #1e293b;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-account-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.12);
    padding: 6px;
    z-index: 1050;
    display: none;
    text-align: right;
}

html[dir="ltr"] .user-account-menu {
    left: auto;
    right: 0;
    text-align: left;
}

.user-account-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.user-account-dropdown:hover .user-account-menu,
.user-account-dropdown.open .user-account-menu {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s ease;
}

.user-menu-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.user-menu-item.logout {
    color: #dc2626;
}

.user-menu-item.logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

/* Mobile Nav Drawer Button (< 992px) */
.mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
    font-size: 19px;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (min-width: 992px) {
    .mobile-nav-toggle {
        display: none !important;
    }
}

.mobile-nav-toggle:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* Language Switcher Pill */
.lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    color: var(--text-body);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-xs);
}

.lang-pill:hover {
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
    transform: translateY(-1px);
}

.lang-pill-text {
    font-size: 11.5px;
    letter-spacing: 0.5px;
}

/* User Profile Badge in Header */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 4px 6px 4px 12px;
    box-shadow: var(--shadow-xs);
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
}

.user-avatar i {
    color: var(--primary);
    font-size: 16px;
}

.user-name-text {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--danger-light);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
    transform: scale(1.05);
}

/* ==========================================================
   Layout & Container
   ========================================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 18px;
    width: 100%;
}

/* ==========================================================
   Summary KPI Metric Cards
   ========================================================== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 640px) {
    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-pill {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.purple { background: #ede9fe; color: var(--purple); }
.stat-icon.orange { background: #ffedd5; color: var(--warning); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 900; color: var(--text-main); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 700; margin-top: 2px; }

/* ==========================================================
   Main Scanner Section & Cards
   ========================================================== */
.scanner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 900px) {
    .scanner-grid {
        grid-template-columns: 1.15fr 0.85fr;
    }
}

.scanner-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
}

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

.scanner-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Camera Viewport */
.camera-wrapper {
    position: relative;
    background: #090d16;
    min-height: 280px;
    max-height: 400px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100% !important;
    border: none !important;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}

/* Overlay Laser Scan Line */
.scan-laser {
    position: absolute;
    top: 15%;
    left: 5%;
    right: 5%;
    height: 2.5px;
    background: linear-gradient(90deg, transparent, #1d4ed8, #60a5fa, transparent);
    box-shadow: 0 0 14px #1d4ed8;
    animation: scanAnim 2.2s infinite ease-in-out;
    pointer-events: none;
    z-index: 10;
    display: none;
}

.scanning .scan-laser {
    display: block;
}

@keyframes scanAnim {
    0% { top: 15%; opacity: 0.8; }
    50% { top: 85%; opacity: 1; }
    100% { top: 15%; opacity: 0.8; }
}

.scan-crosshairs {
    position: absolute;
    width: 220px;
    height: 220px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    display: none;
}

.scanning .scan-crosshairs {
    display: block;
}

.scan-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #1d4ed8;
    border-style: solid;
}

.scan-corner.tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 10px; }
.scan-corner.tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 10px; }
.scan-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 10px; }
.scan-corner.br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 10px; }

/* Camera Controls Toolbar */
.camera-controls {
    padding: 12px 18px;
    background: var(--card-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--card-border);
}

.btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-control {
    background: #ffffff;
    border: 1px solid var(--card-border);
    color: var(--text-body);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: var(--shadow-xs);
}

.btn-control:hover, .btn-control.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-control.danger {
    background: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger);
}

.btn-control.danger:hover {
    background: var(--danger);
    color: white;
}

/* Manual Input Section */
.manual-input-box {
    padding: 14px 18px;
    background: var(--card-subtle);
    border-top: 1px solid var(--card-border);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    background: #ffffff;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-xs);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 18px;
    font-weight: 800;
    font-size: 13.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Product Result Card */
.result-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 380px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
}

.result-placeholder-icon {
    font-size: 54px;
    margin-bottom: 14px;
    color: #aeb8c6;
}

.result-placeholder-text {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-body);
    margin-bottom: 6px;
}

.result-placeholder-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Product Info Display */
.product-details {
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-header {
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.product-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge.barcode-badge { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
.badge.brand-badge { background: var(--purple-light); color: var(--purple); border: 1px solid var(--purple-border); }
.badge.category-badge { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.badge.in-stock { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge.low-stock { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge.out-stock { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }

/* Pricing & Stock Grid */
.price-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.price-box {
    background: var(--card-subtle);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}

.price-box.sell {
    border-color: #93c5fd;
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.08), #ffffff);
}

.price-box-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.price-box-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
}

.price-box.stock .price-box-value {
    color: var(--success);
}

.price-box-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

/* Cost & Profit Row */
.cost-profit-row {
    background: var(--card-subtle);
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px dashed var(--border-strong);
    color: var(--text-body);
}

.cost-profit-values {
    display: flex;
    gap: 16px;
}

.cost-hidden {
    filter: blur(5px);
    user-select: none;
    transition: filter 0.2s;
}

/* Quick Stock Adjustment */
.quick-stock-adjust {
    background: var(--card-subtle);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stock-adjust-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--text-body);
}

.adjust-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-qty {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: #ffffff;
    color: var(--text-main);
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: var(--shadow-xs);
}

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

/* Barcode on-screen render */
.barcode-preview-box {
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--card-border);
    padding: 16px 10px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xs);
}

.barcode-preview-box svg {
    max-width: 100%;
    height: auto;
}

/* Action Buttons row */
.action-buttons-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-action {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-action.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}

.btn-action.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-action.secondary {
    background: #ffffff;
    border: 1px solid var(--card-border);
    color: var(--text-body);
    box-shadow: var(--shadow-xs);
}

.btn-action.secondary:hover {
    background: var(--card-subtle);
    color: var(--text-main);
}

/* Scan History Section */
.history-section {
    margin-top: 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

.history-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-table-wrapper {
    overflow-x: auto;
    max-height: 320px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: right;
}

.history-table th {
    background: var(--card-header);
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 800;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--card-border);
}

.history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border-subtle);
    color: var(--text-body);
}

.history-table tr:hover td {
    background: #f1f4f9;
}

/* ==========================================================
   Mobile Bottom Navigation
   ========================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    gap: 3px;
    transition: color 0.2s;
    flex: 1;
}

.bottom-nav-item i {
    font-size: 20px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

/* ==========================================================
   Modals & Overlays
   ========================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 13, 22, 0.65);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.open, .modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: var(--shadow-modal);
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 16px 22px;
    background: var(--card-header);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 22px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(9, 13, 22, 0.94);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastPop 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes toastPop {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   Universal Theme Harmonization & Deep Contrast Overrides
   ========================================================== */

/* Dark cards converted to crisp white cards */
[style*="background: #111827"],
[style*="background:#111827"],
[style*="background: #0f172a"],
[style*="background:#0f172a"],
[style*="background: #090d16"],
[style*="background:#090d16"],
[style*="background: rgba(17, 24, 39"],
[style*="background:rgba(17, 24, 39"],
[style*="background: rgba(15, 23, 42"],
[style*="background:rgba(15, 23, 42"] {
    background: #ffffff !important;
    border-color: #cbd3de !important;
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.05), 0 6px 16px rgba(0, 0, 0, 0.03) !important;
    color: var(--text-body) !important;
}

/* Sub-panels and table headers - slightly darker gray */
[style*="background: #1e293b"],
[style*="background:#1e293b"],
[style*="background: #0b1120"],
[style*="background:#0b1120"],
[style*="background: #131c2e"],
[style*="background: #f8fafc"],
[style*="background:#f8fafc"] {
    background: #edf0f5 !important;
    border-color: #cbd3de !important;
    color: var(--text-body) !important;
}

/* Headings color override */
[style*="color: #ffffff"],
[style*="color:#ffffff"],
[style*="color: #f8fafc"],
[style*="color:#f8fafc"],
[style*="color: #f1f5f9"],
[style*="color:#f1f5f9"] {
    color: #090d16 !important;
}

/* ==========================================================
   DARKER COLORED TEXT TYPOGRAPHY (تغميق ألوان الكتابة الملونة)
   ========================================================== */

/* Blue text */
[style*="color: #60a5fa"],
[style*="color:#60a5fa"],
[style*="color: #3b82f6"],
[style*="color:#3b82f6"],
[style*="color: #2563eb"],
[style*="color:#2563eb"] {
    color: #1d4ed8 !important;
    font-weight: 800;
}

/* Green text */
[style*="color: #34d399"],
[style*="color:#34d399"],
[style*="color: #10b981"],
[style*="color:#10b981"],
[style*="color: #059669"],
[style*="color:#059669"] {
    color: #047857 !important;
    font-weight: 800;
}

/* Amber / Orange / Yellow text */
[style*="color: #fbbf24"],
[style*="color:#fbbf24"],
[style*="color: #f59e0b"],
[style*="color:#f59e0b"],
[style*="color: #d97706"],
[style*="color:#d97706"] {
    color: #b45309 !important;
    font-weight: 800;
}

/* Red / Danger text */
[style*="color: #f87171"],
[style*="color:#f87171"],
[style*="color: #ef4444"],
[style*="color:#ef4444"],
[style*="color: #dc2626"],
[style*="color:#dc2626"] {
    color: #b91c1c !important;
    font-weight: 800;
}

/* Purple text */
[style*="color: #c084fc"],
[style*="color:#c084fc"],
[style*="color: #a855f7"],
[style*="color:#a855f7"],
[style*="color: #8b5cf6"],
[style*="color:#8b5cf6"],
[style*="color: #7c3aed"],
[style*="color:#7c3aed"] {
    color: #6d28d9 !important;
    font-weight: 800;
}

/* Cyan text */
[style*="color: #38bdf8"],
[style*="color:#38bdf8"],
[style*="color: #06b6d4"],
[style*="color:#06b6d4"],
[style*="color: #0891b2"],
[style*="color:#0891b2"] {
    color: #0e7490 !important;
    font-weight: 800;
}

/* Indigo text */
[style*="color: #a5b4fc"],
[style*="color:#a5b4fc"],
[style*="color: #818cf8"],
[style*="color:#818cf8"],
[style*="color: #6366f1"],
[style*="color:#6366f1"] {
    color: #4338ca !important;
    font-weight: 800;
}

/* Pink text */
[style*="color: #f472b6"],
[style*="color:#f472b6"],
[style*="color: #ec4899"],
[style*="color:#ec4899"],
[style*="color: #db2777"],
[style*="color:#db2777"] {
    color: #be185d !important;
    font-weight: 800;
}

/* Darker Muted Text (eliminates faint washed out labels) */
[style*="color: #94a3b8"],
[style*="color:#94a3b8"],
[style*="color: #cbd5e1"],
[style*="color:#cbd5e1"] {
    color: #475569 !important;
    font-weight: 600;
}

/* Inputs & Form Controls override */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    background-color: #ffffff !important;
    color: #090d16 !important;
    border-color: #b4becb !important;
}
input::placeholder, textarea::placeholder {
    color: #64748b !important;
}

/* LTR Layout Styles (French Language Support) */
html[dir="ltr"] body, body.ltr-layout {
    direction: ltr !important;
    text-align: left !important;
}

html[dir="ltr"] .header-container {
    flex-direction: row;
}

html[dir="ltr"] .nav-links {
    margin-right: auto;
    margin-left: 20px;
}

html[dir="ltr"] .stat-pill,
html[dir="ltr"] .metric-card,
html[dir="ltr"] .card,
html[dir="ltr"] .table-container,
html[dir="ltr"] table th,
html[dir="ltr"] table td {
    text-align: left !important;
}

html[dir="ltr"] .search-bar-wrap input {
    text-align: left !important;
    padding-left: 40px !important;
    padding-right: 14px !important;
}

html[dir="ltr"] .search-bar-wrap i {
    left: 14px !important;
    right: auto !important;
}

html[dir="ltr"] .user-profile-badge {
    padding: 4px 12px 4px 6px;
}

/* ==========================================================
   Auto-Refresh Controller Styles
   ========================================================== */
.ar-menu-item:hover {
    background: #f1f5f9 !important;
    color: #1d4ed8 !important;
}
.ar-item-stop:hover {
    background: #fef2f2 !important;
    color: #b91c1c !important;
}
@keyframes arPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}
#arDot {
    animation: arPulse 2s infinite ease-in-out;
}
