/* -------------------------------------------------------------
   Masah Gift Dashboard - Premium CSS Stylesheet
   Theme: Red, Black, & White
   Supports: RTL (Arabic), Login Screens, Bulk Upload, & Admin Views
   ------------------------------------------------------------- */

/* Custom CSS Variables */
:root {
    --bg-main: #080809;
    --bg-sidebar: #0f0f11;
    --bg-card: #141416;
    --bg-card-hover: #1a1a1d;
    --border-color: #202024;
    --border-glow: rgba(229, 9, 20, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0a5;
    --text-muted: #5e5e64;
    
    --red-primary: #e50914;
    --red-hover: #ff1f29;
    --red-dark: #99060b;
    --red-glow: rgba(229, 9, 20, 0.4);
    --red-light-alpha: rgba(229, 9, 20, 0.08);
    
    --white-alpha: rgba(255, 255, 255, 0.04);
    --white-alpha-hover: rgba(255, 255, 255, 0.08);
    
    --green-success: #10b981;
    --green-success-alpha: rgba(16, 185, 129, 0.1);
    --yellow-warning: #f59e0b;
    --yellow-warning-alpha: rgba(245, 158, 11, 0.1);
    
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 260px;
    --navbar-height: 70px;
    --border-radius: 12px;
    --transition-speed: 0.25s;
    --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--red-primary);
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--red-primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--red-hover);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-red { color: var(--red-primary) !important; }
.text-white { color: var(--text-primary) !important; }
.text-yellow { color: var(--yellow-warning) !important; }
.text-muted { color: var(--text-secondary) !important; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* Grid & Layout containers */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition-speed) ease-in-out;
}

.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    white-space: nowrap;
}

.logo-accent {
    color: var(--red-primary);
    margin-right: 2px;
    font-size: 1.6rem;
    text-shadow: 0 0 10px rgba(229, 9, 20, 0.4);
}

.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 0.35rem;
    transition: all var(--transition-speed);
}

.nav-item i {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background-color: var(--white-alpha);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--red-light-alpha);
    color: var(--text-primary);
    border-left: 3px solid var(--red-primary);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    padding-left: calc(1rem - 3px);
}

.nav-item.active i {
    color: var(--red-primary);
    filter: drop-shadow(0 0 8px var(--red-glow));
}

/* Sidebar User Profile (Mobile App Style) */
.sidebar-user-profile {
    display: none; /* Hidden on desktop */
    align-items: center;
    gap: 12px;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
}

.sidebar-avatar {
    font-size: 2.2rem;
    color: var(--red-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 6px rgba(229, 9, 20, 0.35));
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

#sidebarProfileUsername {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebarProfileRole {
    align-self: flex-start;
    font-size: 0.65rem;
    padding: 2px 6px;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.status-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: var(--white-alpha);
    padding: 0.6rem 0.85rem;
    border-radius: 20px;
    margin-bottom: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.online {
    background-color: var(--green-success);
    box-shadow: 0 0 8px var(--green-success);
}
.status-dot.offline {
    background-color: var(--red-primary);
    box-shadow: 0 0 8px var(--red-primary);
}

.dev-sign {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content Wrapper */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Navbar Style */
.top-navbar {
    height: var(--navbar-height);
    background-color: rgba(8, 8, 9, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sheet-indicator {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 200px;
}

.sheet-label {
    color: var(--text-secondary);
}

.sheet-val {
    color: var(--text-primary);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User profile badge inside navbar */
.user-profile-block {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--white-alpha);
    padding: 0.4rem 0.85rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.user-profile-block span {
    font-size: 0.85rem;
    font-weight: 600;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 5px;
    transition: color var(--transition-speed);
}
.logout-btn:hover {
    color: var(--red-hover);
}

/* Language selector container */
.header-lang-switcher select,
.login-lang-switch button {
    font-family: var(--font-primary);
    font-weight: 600;
    cursor: pointer;
}

.header-lang-switcher select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.8rem;
    width: auto;
}

/* Page Containers */
.page-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-panel.active {
    display: block;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-speed);
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-icon {
    padding: 0.65rem 1rem;
}

.btn-primary {
    background-color: var(--red-primary);
    color: #ffffff !important;
    box-shadow: 0 4px 14px 0 rgba(229, 9, 20, 0.25);
}
.btn-primary:hover {
    background-color: var(--red-hover);
    box-shadow: 0 6px 20px 0 var(--red-glow);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-action-edit {
    color: #ffffff !important;
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--white-alpha-hover);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--red-primary);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    transition: color var(--transition-speed);
}
.btn-text:hover {
    color: var(--red-hover);
    text-decoration: underline;
}

/* Metric Cards Dashboard Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: border-color var(--transition-speed);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--text-muted);
}

.metric-card:nth-child(1)::before {
    background-color: var(--red-primary);
    box-shadow: 0 0 10px var(--red-primary);
}

.metric-card:nth-child(2)::before {
    background-color: var(--text-secondary);
    box-shadow: 0 0 10px var(--text-secondary);
}

.metric-card:nth-child(3)::before {
    background-color: var(--yellow-warning);
    box-shadow: 0 0 10px var(--yellow-warning);
}

.metric-card:hover {
    border-color: var(--text-muted);
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bg-red-alpha {
    background-color: rgba(229, 9, 20, 0.1);
}
.bg-white-alpha {
    background-color: rgba(255, 255, 255, 0.05);
}
.bg-red-light-alpha {
    background-color: rgba(245, 158, 11, 0.1);
}

.metric-info h3 {
    font-size: 1.85rem;
    line-height: 1.1;
    margin-bottom: 2px;
}

.metric-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    background-color: var(--white-alpha);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Dashboard Row Structures */
.dashboard-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.flex-1 { flex: 1 1 300px; min-width: 0; }
.flex-2 { flex: 2 1 600px; min-width: 0; }

/* Content Cards */
.content-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.grid-col-2 {
    grid-column: span 2;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

/* Connection Status Block */
.connection-status-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.conn-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: var(--bg-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.conn-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.conn-item .val {
    font-size: 0.9rem;
    font-weight: 600;
}

.conn-item .val.success {
    color: var(--green-success);
}
.conn-item .val.error {
    color: var(--red-primary);
}

/* Forms System */
.form-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 850px;
    margin: 0 auto;
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

label .required {
    color: var(--red-primary);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all var(--transition-speed);
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px var(--border-glow);
}

textarea {
    resize: vertical;
}

/* Searchable custom dropdown dropdown logic */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.select-trigger {
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 8px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
}

.select-trigger input {
    border: none;
    background: transparent;
    padding-right: 2.5rem;
}
.select-trigger input:focus {
    box-shadow: none;
}

.select-trigger:focus-within {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px var(--border-glow);
    outline: none;
}

.select-chevron {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: transform var(--transition-speed);
}

.custom-select-wrapper.open .select-chevron {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    z-index: 10;
    display: none;
    max-height: 280px;
    overflow-y: auto;
}

.custom-select-wrapper.open .select-dropdown {
    display: block;
}

.dropdown-search {
    position: sticky;
    top: 0;
    background-color: var(--bg-card);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-search i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.dropdown-search input {
    padding: 0.45rem 0.5rem 0.45rem 2rem;
    font-size: 0.85rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
}

.dropdown-list {
    list-style: none;
}

.dropdown-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color var(--transition-speed);
}
.dropdown-item:hover {
    background-color: var(--white-alpha);
    color: var(--red-primary);
}
.dropdown-item.selected {
    background-color: var(--red-light-alpha);
    color: var(--text-primary);
    font-weight: 600;
}

.dropdown-no-results {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.dropdown-action-item {
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: var(--bg-card-hover);
    transition: opacity var(--transition-speed);
}
.dropdown-action-item:hover {
    opacity: 0.9;
}

/* Custom Category Input Panel */
.new-category-input-group {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.new-category-input-group.visible {
    display: flex;
}

.new-category-input-group input {
    flex: 1;
}

/* Input Prefixes */
.input-prefix-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.input-prefix-wrapper input {
    border: none;
    background: transparent;
}
.input-prefix-wrapper input:focus {
    box-shadow: none;
}
.input-prefix-wrapper:focus-within {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px var(--border-glow);
}
.input-prefix {
    padding: 0 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid var(--border-color);
}

/* Checkbox Switches Grid */
.checkbox-switches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.75rem 0;
}

.switch-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.switch-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}
.switch-info p {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--red-primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--red-primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: var(--text-primary);
}

/* Form Action layout */
.form-actions {
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

/* Form Feedback warning/success states */
.form-feedback {
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 500;
    min-height: 18px;
}

.error-feedback {
    color: var(--red-primary);
}

/* Photo URL Image Preview */
.photo-preview-box {
    margin-top: 8px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-main);
}

.photo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.photo-preview-box img.loaded {
    display: block;
}

.photo-preview-box img.loaded ~ .preview-placeholder {
    display: none;
}

.preview-placeholder {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Form Help text */
.help-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}


/* -------------------------------------------------------------
   Bulk Excel upload & reconciliations systems styling
   ------------------------------------------------------------- */

.bulk-excel-card {
    border-left: 4px solid var(--red-primary);
}

.bulk-header-actions {
    display: flex;
    gap: 8px;
}

.bulk-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.excel-drop-zone {
    background-color: var(--bg-main);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    min-height: 220px;
    transition: all var(--transition-speed);
}

.excel-drop-zone:hover,
.excel-drop-zone.dragover {
    border-color: var(--red-primary);
    background-color: rgba(229, 9, 20, 0.02);
    box-shadow: 0 0 20px var(--border-glow);
}

.excel-drop-zone .drop-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    transition: transform var(--transition-speed);
}

.excel-drop-zone:hover .drop-icon {
    color: var(--red-primary);
    transform: scale(1.1);
}

.excel-drop-zone h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.excel-drop-zone p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-select-wrapper {
    position: relative;
    overflow: hidden;
}

.file-select-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.bulk-upload-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulk-upload-status h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.console-box {
    background-color: #030303;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.8rem;
    height: 140px;
    overflow-y: auto;
    color: #00ff66;
}

.console-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.console-line {
    margin-bottom: 4px;
    line-height: 1.4;
}

.console-line.info { color: #3b82f6; }
.console-line.warning { color: #f59e0b; }
.console-line.success { color: #10b981; }
.console-line.error { color: #ef4444; }


/* -------------------------------------------------------------
   User login portal system panel overlay styling
   ------------------------------------------------------------- */

.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #050506;
    background-image: radial-gradient(circle at center, #230406 0%, #050506 80%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background-color: rgba(20, 20, 22, 0.75);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.9);
    position: relative;
}

.login-lang-switch {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-lang-switch button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
}

.login-lang-switch button.active {
    color: var(--red-hover);
}

.login-header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-header .logo {
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-view-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.login-view-panel.active {
    display: block;
}

.login-view-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--red-primary);
    padding-left: 8px;
}

.login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
}

.login-actions a {
    color: var(--text-secondary);
}
.login-actions a:hover {
    color: var(--red-hover);
}

.recovery-result-box {
    display: none;
    background-color: var(--green-success-alpha);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-primary);
}

.recovery-result-box strong {
    color: var(--green-success);
    font-size: 1.15rem;
    display: block;
    margin-top: 4px;
    letter-spacing: 1px;
}


/* -------------------------------------------------------------
   Tables Styling
   ------------------------------------------------------------- */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    background-color: rgba(255,255,255,0.01);
}

tr:hover td {
    background-color: var(--bg-card-hover);
}

/* Badges systems */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-red {
    background-color: var(--red-light-alpha);
    color: var(--red-hover);
    border: 1px solid rgba(229, 9, 20, 0.2);
}

.badge-outline {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-success {
    background-color: var(--green-success-alpha);
    color: var(--green-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background-color: var(--yellow-warning-alpha);
    color: var(--yellow-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Product list thumbnail cell */
.product-thumbnail {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    display: block;
}

/* Inventory List Controls */
.inventory-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    padding-left: 2.5rem;
    width: 100%;
}

.filter-dropdowns {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.filter-group label {
    margin-bottom: 0;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    width: auto;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Settings View Elements */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
}

.instructions-steps {
    font-size: 0.85rem;
    line-height: 1.6;
}

.instructions-steps ol {
    padding-left: 1.2rem;
}

.instructions-steps li {
    margin-bottom: 0.65rem;
    color: var(--text-secondary);
}

.instructions-steps li strong {
    color: var(--text-primary);
}

.code-editor-block {
    background-color: #050505;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    max-height: 350px;
    overflow-y: auto;
}

.code-editor-block pre {
    margin: 0;
}

.code-editor-block code {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    color: #e4e4e7;
    white-space: pre-wrap;
}

.link {
    color: var(--red-hover);
    text-decoration: underline;
}

/* Toast Notifications styling */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--red-primary);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 380px;
}

.toast.show {
    transform: translateY(0);
}

.toast-icon {
    font-size: 1.2rem;
    color: var(--red-hover);
}

.toast.success {
    border-left-color: var(--green-success);
}
.toast.success .toast-icon {
    color: var(--green-success);
}

.toast-content p {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}


/* -------------------------------------------------------------
   RTL SYSTEM COMPATIBILITY STYLING
   Active when <body class="rtl"> is parsed
   ------------------------------------------------------------- */

body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .metric-badge {
    right: auto;
    left: 1rem;
}

/* Sidebar right-alignment in RTL */
body.rtl .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

body.rtl .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

/* Nav Item active highlights inside RTL */
body.rtl .nav-item.active {
    border-left: none;
    border-right: 3px solid var(--red-primary);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    padding-left: 1rem;
    padding-right: calc(1rem - 3px);
}

/* Custom Dropdown adjustments in RTL */
body.rtl .select-chevron {
    right: auto;
    left: 1rem;
}

body.rtl .select-trigger input {
    padding-left: 2.5rem;
    padding-right: 1rem;
}

body.rtl .dropdown-search i {
    left: auto;
    right: 1rem;
}

body.rtl .dropdown-search input {
    padding-left: 0.5rem;
    padding-right: 2rem;
}

/* Table layout adjustments in RTL */
body.rtl th,
body.rtl td {
    text-align: right;
}

body.rtl .search-box i {
    left: auto;
    right: 1rem;
}

body.rtl .search-box input {
    padding-left: 1rem;
    padding-right: 2.5rem;
}

/* Input Prefixes in RTL */
body.rtl .input-prefix {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* Metric Cards indicator border in RTL */
body.rtl .metric-card::before {
    left: auto;
    right: 0;
}

/* Login panel elements in RTL */
body.rtl .login-lang-switch {
    right: auto;
    left: 1.5rem;
}

body.rtl .login-view-panel h2 {
    border-left: none;
    border-right: 3px solid var(--red-primary);
    padding-left: 0;
    padding-right: 8px;
}

body.rtl .toast {
    right: auto;
    left: 2rem;
    border-left: none;
    border-right: 4px solid var(--red-primary);
}

body.rtl .toast.success {
    border-right-color: var(--green-success);
}

body.rtl .bulk-excel-card {
    border-left: none;
    border-right: 4px solid var(--red-primary);
}

body.rtl .logout-btn {
    margin-left: 0;
    margin-right: 5px;
}

body.rtl .logout-btn i {
    transform: scaleX(-1);
}


/* Bottom Navigation Bar (Desktop Hidden) */
.bottom-nav {
    display: none;
}

/* Responsive media queries */
@media (max-width: 1024px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .grid-col-2 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    /* Premium Bottom Navigation Tab Bar for Mobile App View */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 60px;
        background-color: rgba(15, 15, 17, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding: 4px 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
        box-sizing: border-box;
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        font-size: 0.68rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        flex: 1;
        gap: 3px;
        height: 100%;
    }
    
    .bottom-nav-item i {
        font-size: 1.15rem;
        transition: transform 0.2s ease, color 0.2s ease;
    }
    
    .bottom-nav-item:hover {
        color: var(--text-primary);
    }
    
    .bottom-nav-item.active {
        color: var(--red-hover);
    }
    
    .bottom-nav-item.active i {
        color: var(--red-hover);
        filter: drop-shadow(0 0 6px var(--red-glow));
        transform: translateY(-2px);
    }

    /* Fixed top navbar on mobile to mimic native app */
    .top-navbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: 54px !important;
        background-color: rgba(8, 8, 9, 0.85) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid var(--border-color) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 0.85rem !important;
        z-index: 1000 !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure page is pushed down/up correctly */
    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-top: 54px !important;
        padding-bottom: 74px !important; /* spacing for bottom nav */
        width: 100vw !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    .page-container {
        padding: 1rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Hide desktop sidebar, overlays, and hamburger/close buttons completely */
    .sidebar, .sidebar-overlay, .mobile-toggle-btn, .mobile-close-btn, .sheet-indicator {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Header elements tuning */
    .nav-left {
        display: flex;
        align-items: center;
        gap: 0;
        min-width: 0;
    }
    
    .page-title {
        font-size: 0.95rem !important;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }
    
    .nav-right {
        display: flex;
        align-items: center;
        gap: 8px !important;
    }
    
    .header-lang-switcher select {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
        max-width: 90px !important;
        background-color: var(--bg-card) !important;
        border-radius: 6px !important;
    }
    
    /* Compact user profile and actions */
    .user-profile-block {
        background: none !important;
        border: none !important;
        padding: 0 !important;
    }
    
    .user-profile-block span {
        display: none !important;
    }
    
    .logout-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background-color: var(--white-alpha) !important;
        border: 1px solid var(--border-color) !important;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-primary) !important;
        font-size: 0.85rem !important;
        margin: 0 !important;
    }

    #btnRefreshSheet {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    #btnRefreshSheet span {
        display: none !important;
    }

    /* 1-column metrics grid */
    .metrics-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .metric-card {
        padding: 0.85rem 1rem !important;
        gap: 12px !important;
    }
    
    .metric-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.15rem !important;
        border-radius: 8px !important;
    }
    
    .metric-info h3 {
        font-size: 1.35rem !important;
    }
    
    .metric-badge {
        font-size: 0.65rem !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
    }
    
    body.rtl .metric-badge {
        right: auto !important;
        left: 0.75rem !important;
    }

    /* Content Cards and Dashboard Rows */
    .content-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .dashboard-row {
        gap: 1rem !important;
        flex-direction: column !important;
    }

    /* Forms responsive layouts */
    .form-container {
        padding: 1rem !important;
    }
    
    .form-row-2 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .form-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .form-actions .btn {
        width: 100% !important;
    }

    /* Bulk uploads stack layout */
    .bulk-header-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    
    .bulk-header-actions .btn {
        width: 100% !important;
    }
    
    .bulk-upload-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .excel-drop-zone {
        min-height: 160px !important;
        padding: 1.25rem !important;
    }

    .inventory-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .filter-dropdowns {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .filter-group select {
        width: 100% !important;
    }

    /* Custom Category Select Overlay */
    .select-dropdown {
        z-index: 1500 !important;
    }

    /* Premium responsive card layouts for all product and inventory tables */
    .table-responsive {
        border: none !important;
        overflow: visible !important;
    }
    
    .dashboard-table, .inventory-table, .staff-table {
        min-width: 100% !important;
    }

    table, thead, tbody, th, td, tr {
        display: block !important;
    }
    
    thead {
        display: none !important;
    }
    
    tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    /* General card style for rows */
    tr {
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--border-radius) !important;
        padding: 1rem !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
        transition: all 0.2s ease !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    tr:hover {
        border-color: var(--text-muted) !important;
    }

    tr:hover td {
        background-color: transparent !important;
    }

    td {
        padding: 4px 0 !important;
        border: none !important;
        font-size: 0.82rem !important;
        background: transparent !important;
    }

    /* Inventory Table Stacked Layout */
    .inventory-table tr {
        display: grid !important;
        grid-template-columns: 30px 60px minmax(0, 1fr) !important;
        gap: 8px !important;
        align-items: start !important;
    }

    .inventory-table tr td:nth-child(1) {
        grid-column: 1 !important;
        grid-row: 1 / span 2 !important;
        padding: 0 !important;
        align-self: center !important;
        display: flex !important;
        justify-content: center !important;
    }

    .inventory-table tr td:nth-child(2) {
        grid-column: 2 !important;
        grid-row: 1 / span 2 !important;
        padding: 0 !important;
    }

    .inventory-table tr td:nth-child(4) {
        grid-column: 3 !important;
        grid-row: 1 !important;
        padding: 0 !important;
    }

    .inventory-table tr td:nth-child(3) {
        grid-column: 3 !important;
        grid-row: 2 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .inventory-table tr td:nth-child(3)::before {
        content: "SKU: ";
        font-size: 0.72rem;
        color: var(--text-secondary);
        font-weight: 600;
    }
    body.rtl .inventory-table tr td:nth-child(3)::before {
        content: "الرمز: ";
    }

    .inventory-table tr td:nth-child(5) {
        grid-column: 1 / span 3 !important;
        grid-row: 3 !important;
        padding: 6px 0 !important;
        border-top: 1px dashed var(--border-color) !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .inventory-table tr td:nth-child(5)::before {
        content: "Category";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .inventory-table tr td:nth-child(5)::before {
        content: "القسم";
    }

    .inventory-table tr td:nth-child(6) {
        grid-column: 1 / span 3 !important;
        grid-row: 4 !important;
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-weight: 700 !important;
    }

    .inventory-table tr td:nth-child(6)::before {
        content: "Price";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .inventory-table tr td:nth-child(6)::before {
        content: "السعر";
    }

    .inventory-table tr td:nth-child(7) {
        grid-column: 1 / span 3 !important;
        grid-row: 5 !important;
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .inventory-table tr td:nth-child(7)::before {
        content: "Stock";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .inventory-table tr td:nth-child(7)::before {
        content: "المخزون";
    }

    .inventory-table tr td:nth-child(8) {
        grid-column: 1 / span 3 !important;
        grid-row: 6 !important;
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .inventory-table tr td:nth-child(8)::before {
        content: "Badges";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .inventory-table tr td:nth-child(8)::before {
        content: "الشارات";
    }

    .inventory-table tr td:nth-child(9) {
        grid-column: 1 / span 3 !important;
        grid-row: 7 !important;
        padding: 8px 0 0 0 !important;
        border-top: 1px solid var(--border-color) !important;
        display: flex !important;
        gap: 8px !important;
    }
    
    .inventory-table tr td:nth-child(9) .btn {
        flex: 1 !important;
        justify-content: center !important;
    }

    /* Dashboard Table (Recently Added) Stacked Layout */
    .dashboard-table tr {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .dashboard-table tr td:nth-child(2) {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        padding: 0 !important;
    }

    .dashboard-table tr td:nth-child(1) {
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .dashboard-table tr td:nth-child(1)::before {
        content: "SKU: ";
        font-size: 0.72rem;
        color: var(--text-secondary);
        font-weight: 600;
    }
    body.rtl .dashboard-table tr td:nth-child(1)::before {
        content: "الرمز: ";
    }

    .dashboard-table tr td:nth-child(3) {
        padding: 6px 0 !important;
        border-top: 1px dashed var(--border-color) !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .dashboard-table tr td:nth-child(3)::before {
        content: "Category";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .dashboard-table tr td:nth-child(3)::before {
        content: "القسم";
    }

    .dashboard-table tr td:nth-child(4) {
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-weight: 700 !important;
    }

    .dashboard-table tr td:nth-child(4)::before {
        content: "Price";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .dashboard-table tr td:nth-child(4)::before {
        content: "السعر";
    }

    .dashboard-table tr td:nth-child(5) {
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .dashboard-table tr td:nth-child(5)::before {
        content: "Stock";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .dashboard-table tr td:nth-child(5)::before {
        content: "المخزون";
    }

    /* Staff Registry Table Stacked Layout */
    .staff-table tr {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .staff-table tr td:nth-child(1) {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        padding: 0 !important;
    }

    .staff-table tr td:nth-child(2) {
        padding: 6px 0 !important;
        border-top: 1px dashed var(--border-color) !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .staff-table tr td:nth-child(2)::before {
        content: "Password";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .staff-table tr td:nth-child(2)::before {
        content: "كلمة المرور";
    }

    .staff-table tr td:nth-child(3) {
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .staff-table tr td:nth-child(3)::before {
        content: "Role";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .staff-table tr td:nth-child(3)::before {
        content: "الصلاحية";
    }

    .staff-table tr td:nth-child(4) {
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .staff-table tr td:nth-child(4)::before {
        content: "Status";
        color: var(--text-secondary);
        font-weight: 500;
    }
    body.rtl .staff-table tr td:nth-child(4)::before {
        content: "حالة الحساب";
    }

    .staff-table tr td:nth-child(5) {
        padding: 8px 0 0 0 !important;
        border-top: 1px solid var(--border-color) !important;
        display: block !important;
    }

    .staff-table tr td:nth-child(5) div {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .staff-table tr td:nth-child(5) div button {
        flex: 1 !important;
        justify-content: center !important;
        padding: 6px 4px !important;
        font-size: 0.7rem !important;
    }
}

/* Small screen login layout adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem 1.25rem !important;
    }
    .login-lang-switch {
        top: 1rem !important;
        right: 1rem !important;
    }
    body.rtl .login-lang-switch {
        left: 1rem !important;
        right: auto !important;
    }
    .login-header {
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 400px) {
    .login-wrapper {
        padding: 0.75rem !important;
    }
    .login-card {
        padding: 1.25rem 1rem !important;
        border-radius: 12px !important;
    }
    .login-header {
        margin-bottom: 1.25rem !important;
    }
}

/* Active style for role toggles */
.forgot-role-toggle button.active {
    background-color: var(--red-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--red-primary) !important;
    box-shadow: 0 4px 12px var(--red-glow) !important;
}

/* Edit Staff Modal overlay styling */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

.modal-overlay.show {
    display: flex !important;
}

/* Bilingual logo switching */
.logo-text-ar {
    display: none;
}
body.rtl .logo-text-en {
    display: none;
}
body.rtl .logo-text-ar {
    display: inline !important;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0px;
    direction: rtl;
}

/* Password Toggle Eye Icon Styling */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 40px !important;
}

body.rtl .password-input-wrapper input {
    padding-right: 12px !important;
    padding-left: 40px !important;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 10;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--text-primary);
}

body.rtl .toggle-password {
    right: auto;
    left: 12px;
}

/* Custom Top Bar with Logo and Back Button */
.masah-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(8, 8, 9, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
    flex-direction: row; /* LTR (English): Back button left, Logo right */
    z-index: 999;
}

body.rtl .masah-top-bar {
    flex-direction: row-reverse; /* RTL (Arabic): Back button right, Logo left */
}

.btn-back-nav {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn-back-nav:hover {
    background-color: var(--bg-card);
    border-color: var(--red-primary);
    color: var(--red-primary);
    box-shadow: 0 0 8px rgba(229, 9, 20, 0.3);
}

body.rtl .btn-back-nav i {
    transform: rotate(180deg); /* Arrow points right in RTL */
}

/* Light mode variable overrides */
body.light-mode {
    --bg-main: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --white-alpha: rgba(0, 0, 0, 0.02);
    --white-alpha-hover: rgba(0, 0, 0, 0.05);
    --box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

body.light-mode .top-navbar {
    background-color: rgba(243, 244, 246, 0.8);
}

body.light-mode .masah-top-bar {
    background-color: rgba(243, 244, 246, 0.95);
}

/* WhatsApp support button overrides */
.btn-whatsapp-support {
    background-color: #25d366 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3) !important;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
}

.btn-whatsapp-support:hover {
    background-color: #22c35e !important;
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4) !important;
}

.btn-whatsapp-support:active {
    transform: translateY(0);
}

/* Avatar container in top bar and header */
.top-bar-profile-container {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    width: 38px;
    height: 38px;
    transition: transform var(--transition-speed);
}

.top-bar-profile-container:hover {
    transform: scale(1.05);
}

/* Settings forms styling overrides */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Custom layout rules for profile details modal lists */
.profile-modal-details div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}
.profile-modal-details div:last-child {
    border-bottom: none;
}

body.rtl .profile-modal-details {
    text-align: right;
}
body.rtl .profile-modal-details div {
    flex-direction: row-reverse;
}
