﻿:root {
    --primary-hue: 221;
    --primary-color: hsl(var(--primary-hue), 83%, 53%);
    --primary-dark: hsl(var(--primary-hue), 83%, 43%);
    --primary-light: hsl(var(--primary-hue), 83%, 95%);

    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* Light Mode (Default) */
    --background-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --navbar-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --table-header-bg: #f8fafc;

    --sidebar-width: 260px;
    --navbar-height: 70px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

[data-theme="dark"] {
    --background-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: #1e293b;
    --navbar-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --table-header-bg: #0f172a;

    --primary-light: rgba(37, 99, 235, 0.1);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

[data-theme="dark"] .stat-card {
    background: #1e293b;
}

[data-theme="dark"] .clients-today {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .orders-progress {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .orders-ready {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .total-sales {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Inter', 'Cairo', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Modern & Premium Scrollbar - Global */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-hue), 83%, 53%, 0.15);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.3s;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-hue), 83%, 63%, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    background-clip: content-box;
}

/* Order Deadline Progress Bar */
.order-progress-container {
    width: 100%;
    max-width: 120px;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

[data-theme="dark"] .order-progress-container {
    background: rgba(255, 255, 255, 0.1);
}

.order-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background-color);
    background-image: radial-gradient(at 0% 0%, hsla(var(--primary-hue), 83%, 93%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(var(--primary-hue), 83%, 95%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(var(--primary-hue), 83%, 93%, 1) 0, transparent 50%);
}

/* =========================================
   MODERN LOGIN REDESIGN (app.html)
   ========================================= */

/* Hide background orbs by default */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    display: none;
}

/* Base Wrapper for Login only - FORCE DARK */
body:has(.premium-login:not(.hidden)) {
    background-color: #0f172a !important;
    /* Force deep dark background */
}

body:has(.premium-login:not(.hidden)) .bg-orbs {
    display: block;
    /* Show orbs only when in login */
}

.premium-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
    /* Rely on body bg and orbs */
}

.premium-login .centered {
    width: 100%;
    max-width: 480px;
    /* Slimmer, centered box */
    margin: auto;
}

.premium-login .login-card-panel {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Glassmorphism Card - FORCED DARK STYLE */
.premium-login .glass-card {
    width: 100%;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
}

/* Force Light Text inside Dark Login */
.premium-login .login-hero h2,
.premium-login .login-header h2 {
    color: #f1f5f9 !important;
}

.premium-login .login-hero .tagline,
.premium-login .auth-tab {
    color: #94a3b8 !important;
}

.premium-login .auth-tab.active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #60a5fa !important;
}

.premium-login .input-with-icon input {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

.premium-login .input-with-icon input:focus {
    border-color: var(--primary-color) !important;
    background: rgba(30, 41, 59, 0.8) !important;
}

/* Force dark mode for component containers inside premium login */
.premium-login .login-lang-switch,
.premium-login .auth-tabs {
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-login .login-lang-switch .divider {
    background: rgba(255, 255, 255, 0.1) !important;
}

.premium-login .login-lang-switch button {
    color: #94a3b8 !important;
}

.premium-login .login-lang-switch button:hover {
    color: #60a5fa !important;
}

.premium-login label {
    color: #cbd5e1 !important;
}

.premium-login .input-with-icon i {
    color: #94a3b8 !important;
}

.premium-login .forgot-link,
.premium-login .toggle-link {
    color: #60a5fa !important;
}

.premium-login .auth-footer {
    color: #94a3b8 !important;
}

/* Ensure all placeholders are muted in dark mode */
.premium-login .input-with-icon input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Fix any missed elements in auth forms */
.premium-login #auth-title {
    color: #f1f5f9 !important;
}

.premium-login .error-msg {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

/* Modals inside login flow (Forgot Password, Signup Success) */
#forgot-password-modal .modal-content,
#signup-success-modal .modal-content {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #f1f5f9 !important;
}

#forgot-password-modal .section-title,
#signup-success-modal .section-title {
    color: #f1f5f9 !important;
}

#forgot-password-modal label {
    color: #cbd5e1 !important;
}

#forgot-password-modal input {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
    border-radius: 12px;
    padding: 12px 15px;
}

#forgot-password-modal input:focus {
    border-color: var(--primary-color) !important;
    outline: none;
}

#forgot-password-modal #forgot-modal-desc,
#signup-success-modal p {
    color: #94a3b8 !important;
}

#forgot-password-modal .btn-outline {
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #cbd5e1 !important;
}

#forgot-password-modal .btn-outline:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Global Dark Overrides for Auth Modals Inputs */
#forgot-password-modal input::placeholder,
#signup-success-modal input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}


/* Login Hero Top Portion */
.login-hero {
    text-align: center;
    margin-bottom: 30px;
}

.login-hero img {
    height: 80px;
    /* Made the logo slightly bigger for emphasis */
    width: auto;
    margin-bottom: 16px;
    animation: spin 6s linear infinite;
    filter: drop-shadow(0 4px 10px rgba(59, 130, 246, 0.5));
}

.login-hero h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
}

.login-hero .tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Ensure consistent dark colors inside premium login wrapper */
.premium-login .login-hero h2 {
    color: #f1f5f9 !important;
}

.premium-login .login-hero .tagline {
    color: #94a3b8 !important;
}

.premium-login .auth-tab:not(.active) {
    color: #94a3b8 !important;
}

.premium-login .auth-tab:not(.active):hover {
    color: #f1f5f9 !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Fix for error messages appearing white */
.premium-login #login-error,
.premium-login .error-msg {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

/* Hide old dual-panel layout styles if we are in premium login */
.premium-login .login-branding-panel {
    display: none;
}

/* Adjust Login Header */
.premium-login .login-header {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding-top: 20px;
    margin-top: 0;
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.login-lang-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.login-lang-switch button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.login-lang-switch button:hover {
    color: var(--primary-color);
}

.login-lang-switch .divider {
    width: 1px;
    height: 12px;
    background: var(--border-color);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--background-color);
    padding: 6px;
    border-radius: 14px;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    background: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Input Styles */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i:first-child {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

[dir="rtl"] .input-with-icon i:first-child {
    left: auto;
    right: 18px;
}

.input-with-icon input {
    width: 100%;
    padding: 16px 16px 16px 50px !important;
    border-radius: 14px !important;
    border: 2px solid var(--border-color) !important;
    background: var(--background-color) !important;
    font-size: 1rem !important;
    transition: all 0.3s !important;
}

[dir="rtl"] .input-with-icon input {
    padding: 16px 50px 16px 16px !important;
}

.input-with-icon input:focus {
    border-color: var(--primary-color) !important;
    background: var(--card-bg) !important;
    box-shadow: 0 0 0 4px var(--primary-light) !important;
    outline: none !important;
}

.toggle-password {
    position: absolute;
    right: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 10px;
    z-index: 10;
}

[dir="rtl"] .toggle-password {
    right: auto;
    left: 18px;
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.toggle-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Mobile Adjustments */
.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .login-container {
        max-width: 480px;
        min-height: auto;
    }

    .login-branding-panel {
        display: none;
    }

    .mobile-only {
        display: flex;
        justify-content: center;
        margin-bottom: 30px;
    }

    .login-card-panel {
        padding: 30px;
    }
}

.error-msg {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.08);
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 100;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1;
    padding: 30px 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-hue), 83%, 53%, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    background-clip: content-box;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    padding: 4px 16px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 0 10px 10px 0;
    box-shadow: 2px 0 8px var(--primary-light);
}

[dir="rtl"] .nav-item.active::before {
    left: auto;
    right: 0;
    border-radius: 10px 0 0 10px;
    box-shadow: -2px 0 8px var(--primary-light);
}

.sidebar-badge {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] .sidebar-badge {
    right: auto;
    left: 25px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
    font-weight: 500;
}

.nav-item.active a {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
}

[data-theme="dark"] .nav-item.active a {
    background-color: rgba(var(--primary-color), 0.15);
    /* Fallback */
    background-color: var(--primary-light);
}

@media print {

    .app-container,
    .navbar,
    .sidebar,
    .toast,
    .theme-toggle,
    #sidebar-toggle,
    .modal-header,
    .history-filters,
    .btn-close-modal {
        display: none !important;
    }

    .modal-overlay {
        position: static;
        background: none;
        padding: 0;
    }

    .modal-card {
        box-shadow: none;
        border: none;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
    }

    .hidden-print-only {
        display: block !important;
    }

    #salary-history-print-area {
        display: block !important;
    }

    #print-ticket {
        display: block !important;
        position: static;
        width: 100%;
        margin: 0;
        padding: 40px;
        background: white;
    }
}

/* Hide print ticket normally */
#print-ticket,
.hidden-print-only {
    display: none;
}

.payment-log {
    margin-top: 15px;
    padding: 10px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

.payment-log-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.payment-log-item:last-child {
    border-bottom: none;
}

.nav-item a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    min-width: 0;
    max-width: 100%;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

/* Sections Transition */
.page-section {
    display: none;
    padding: 24px;
    width: 100%;
}

.page-section.visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ring {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(15deg);
    }

    20% {
        transform: rotate(-15deg);
    }

    30% {
        transform: rotate(10deg);
    }

    40% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(5deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(0);
    }
}

.ring-animation {
    display: inline-block;
    animation: ring 1s ease infinite;
    color: var(--warning-color);
}

.reminder-row-tomorrow {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.reminder-row-tomorrow td {
    color: var(--success-color) !important;
    font-weight: 600;
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    max-width: 100vw;
}

/* Navbar Branding */
.nav-branding-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    border-right: 1px solid var(--border-color);
    margin-right: 15px;
}

[dir="rtl"] .nav-branding-top {
    border-right: none;
    border-left: 1px solid var(--border-color);
    margin-right: 0;
    margin-left: 15px;
}

.nav-logo-small {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.nav-logo-small img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-shop-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    white-space: nowrap;
}

#page-title {
    font-size: 1.1rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .nav-branding-top {
        display: none;
    }
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
}

.lang-switcher {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 30px;
    display: flex;
}

.lang-btn {
    padding: 6px 16px;
    border-radius: 25px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.clients-today {
    background: #dbeafe;
    color: #2563eb;
}

.orders-progress {
    background: #fef3c7;
    color: #d97706;
}

.orders-ready {
    background: #d1fae5;
    color: #059669;
}

.total-sales {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Cards & Tables */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

[dir="rtl"] table {
    text-align: right;
}

th {
    background: var(--table-header-bg);
    padding: 16px 24px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

@media (max-width: 768px) {

    th,
    td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
}

/* Sticky Table Header */
.table-container thead th {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--table-header-bg);
    box-shadow: 0 1px 0 var(--border-color);
}

/* Sticky Action Column */
.sticky-col-actions {
    position: sticky;
    right: 0;
    background-color: var(--card-bg);
    z-index: 20 !important;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.08);
    width: 200px;
    min-width: 200px;
}

/* Sticky Status Column */
.sticky-col-status {
    position: sticky;
    right: 200px;
    /* Offset by the width of the actions column */
    background-color: var(--card-bg);
    z-index: 19 !important;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.04);
    width: 160px;
    min-width: 160px;
}

[data-theme="dark"] .sticky-col-actions,
[data-theme="dark"] .sticky-col-status {
    background-color: var(--sidebar-bg);
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] .sticky-col-actions {
    left: 0;
    right: auto;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.08);
}

[dir="rtl"] .sticky-col-status {
    left: 200px;
    right: auto;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.04);
}

[dir="rtl"][data-theme="dark"] .sticky-col-actions,
[dir="rtl"][data-theme="dark"] .sticky-col-status {
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
}

th.sticky-col-actions {
    z-index: 41 !important;
}

th.sticky-col-status {
    z-index: 40 !important;
}

tr:last-child td {
    border-bottom: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-progress {
    background: #fef3c7;
    color: #92400e;
}

.badge-ready {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #059669;
}

.badge-delivered {
    background: #e2e8f0;
    color: #475569;
}

.badge-exam {
    background: #dbeafe;
    color: #1e40af;
}

.badge-presc {
    background: #f1f5f9;
    color: #475569;
}

.badge-select {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    outline: none;
}

.status-select {
    min-width: 140px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.2s;
}

.status-select:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.badge-progress {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-lens_ordered {
    background-color: #e0f2fe;
    color: #075985;
    border-color: #7dd3fc;
}

.badge-lens_received {
    background-color: #ede9fe;
    color: #5b21b6;
    border-color: #c4b5fd;
}

.badge-ready {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #34d399;
}

.badge-delivered {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

[data-theme="dark"] .status-select {
    background-color: #334155;
    color: white;
}

.status-select-sm {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-container {
    padding: 30px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Multi-step Form Styling */
.form-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px 0;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--background-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step-item.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-item.active .step-label {
    color: var(--primary-color);
}

.step-divider {
    height: 2px;
    background: var(--border-color);
    flex: 1;
    margin-top: -25px;
    z-index: 1;
}

.step-content {
    display: none;
    animation: slideIn 0.4s ease;
}

.step-content.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    font-size: 1.2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
}

/* Personal Info Grid Adjustment */
/* Photo Section in Client Form */
.profile-pic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
    gap: 12px;
}

.photo-preview-container {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--background-color);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
}

.photo-preview-container:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.photo-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#photo-placeholder {
    color: var(--text-muted);
    text-align: center;
}

#photo-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

#photo-placeholder span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Professional Optical Table */
.optical-table.professional {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.optical-table.professional th {
    background: var(--primary-light);
    color: var(--primary-color);
}

.optical-table.professional td {
    padding: 12px;
}

.optical-table.professional input {
    text-align: center;
    border-color: transparent;
    background: var(--background-color);
    font-weight: 600;
}

.optical-table.professional input:focus {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--text-main);
}

.merged-cell {
    background: var(--background-color);
}

[data-theme="dark"] .merged-cell {
    background: #1e293b;
}


/* Pending Order Styling */
.pending-order-row .history-card {
    background: rgba(245, 158, 11, 0.05) !important;
    border-left: 4px solid #f59e0b !important;
}

.pending-order-row .history-card:hover {
    background: rgba(245, 158, 11, 0.1) !important;
}

.pending-icon {
    color: #f59e0b;
    margin-right: 5px;
    animation: pulse-pending 2s infinite;
}

@keyframes pulse-pending {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.badge-pending {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

[data-theme="dark"] .badge-pending {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

/* Photo Placeholder Adjustment */
#photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

#photo-placeholder small {
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    text-align: left;
}

[dir="rtl"] .form-group label {
    text-align: right;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--card-bg);
    color: var(--text-main);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Optical Table */
.optical-table-container {
    overflow-x: auto;
}

.optical-table {
    min-width: 600px;
    background: var(--table-header-bg);
    border-radius: 8px;
}

.optical-table th {
    padding: 12px;
}

.optical-table td {
    padding: 8px;
}

.optical-table input {
    width: 100%;
    border-radius: 4px;
    padding: 8px;
}

/* Upload box */
.upload-box {
    border: 2px dashed var(--border-color);
    padding: 40px;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-box i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.manual-input-link {
    margin-top: 15px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* UI Enhancements */
.load-more-container {
    transition: all 0.3s ease;
}

.load-more-container:hover {
    background-color: var(--hover-color);
}

.load-more-container .btn {
    border-radius: 0 0 12px 12px;
}

.stat-value {
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #0ea171;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-pending {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-pending:hover {
    background: #d97706;
}

/* Status Badge: Pending */
.badge-pending {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #b45309 !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

select.badge-pending {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #b45309 !important;
}

/* Pending order card glow */
.pending-order-row {
    background: rgba(245, 158, 11, 0.05) !important;
}

.pending-icon {
    color: #f59e0b;
    animation: pulse-pending 1.5s ease-in-out infinite;
}

@keyframes pulse-pending {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    width: 100%;
}

.form-actions {
    margin-top: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 28px;
    background: #1e293b;
    color: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    z-index: 5000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.hidden {
    transform: translateY(100px);
    opacity: 0;
    visibility: hidden;
}

.toast-error {
    background: #ef4444 !important;
    /* Bold Red */
    border-color: #f87171 !important;
}

.toast-success {
    background: #10b981 !important;
    /* Success Green */
    border-color: #34d399 !important;
}

[dir="rtl"] .toast {
    right: auto;
    left: 24px;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* Theme Controls Styling */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--border-color);
}

.color-palette {
    display: flex;
    gap: 6px;
}

.color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color-circle:hover {
    transform: scale(1.2);
}

.bg-blue {
    background: #2563eb;
}

.bg-green {
    background: #10b981;
}

.bg-purple {
    background: #7c3aed;
}

.bg-red {
    background: #ef4444;
}

input,
select,
textarea {
    background-color: var(--sidebar-bg);
    color: var(--text-main);
}

/* Fix for badge select in dark mode */
.badge-select {
    background-color: var(--sidebar-bg);
    color: var(--text-main);
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.client-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border: 1px solid var(--border-color);
}

.client-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.client-avatar {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
    border: 4px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--primary-light);
    overflow: hidden;
}

.client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-age-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    z-index: 5;
}

[dir="rtl"] .client-age-badge {
    right: auto;
    left: 12px;
}

.debt-badge-floating {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ef4444;
    /* Bright Red */
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    z-index: 5;
    animation: pulse-red 2s infinite;
}

[dir="rtl"] .debt-badge-floating {
    left: auto;
    right: 12px;
}

/* Adjust Age badge if Debt is present */
.debt-badge-floating+.client-age-badge {
    top: 45px;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
}

.client-info h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.client-phone {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.client-badge-row {
    margin-bottom: 20px;
}

.client-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.client-actions .btn {
    flex: 1;
}

.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-delete:hover {
    background: #fecaca;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
}

[dir="rtl"] .search-box i {
    left: auto;
    right: 14px;
}

.search-box input {
    padding-left: 40px;
    width: 250px;
}

[dir="rtl"] .search-box input {
    padding-left: 14px;
    padding-right: 40px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .sidebar-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100% !important;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .table-container {
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* Professional Table responsiveness */
    table {
        min-width: 850px;
        /* Forces horizontal scroll instead of breaking layout */
    }

    .navbar-right {
        gap: 8px;
    }

    .color-palette {
        display: none;
        /* Hide palette on mobile to save space for lang buttons */
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .profile-main {
        flex-direction: column;
        text-align: center;
    }

    .profile-meta-grid {
        flex-direction: column;
        align-items: center;
    }
}

/* Client Profile & Timeline */
.client-profile-header {
    padding: 30px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--primary-light) 100%);
    border-left: 5px solid var(--primary-color);
    border-radius: var(--radius);
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 30px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    border: 4px solid white;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- MODERN SETTINGS PAGE --- */
.settings-modern-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    align-items: start;
}

.settings-card {
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.settings-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.login-card .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.login-lang-switch {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-card .logo i {
    font-size: 3rem;
}

.settings-card-header {
    padding: 18px 24px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.settings-card-header i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.settings-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.settings-card-body {
    padding: 24px;
}

/* Professional Logo Upload */
.logo-upload-professional {
    width: 200px;
    height: 120px;
    margin: 0 auto;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: var(--background-color);
    transition: all 0.3s ease;
}

.logo-upload-professional:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.logo-upload-professional .preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-upload-professional img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.logo-upload-professional .upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s;
}

.logo-upload-professional:hover .upload-overlay {
    opacity: 1;
}

#settings-logo-placeholder {
    text-align: center;
    color: var(--text-muted);
}

#settings-logo-placeholder i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

/* Hue Selector */
.hue-selector-professional {
    position: relative;
}

/* Color Circles */
.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.color-circle:hover {
    transform: scale(1.15);
}

.color-circle.active {
    border-color: var(--text-main);
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--primary-color);
}

.color-circle.custom-circle {
    background: linear-gradient(45deg, #f06, #9f6, #0cf, #f06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    overflow: hidden;
}

.color-circle.custom-circle input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.hue-selector-professional {
    display: none;
}

/* Visual Chip Selectors */
.visual-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.chip-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.chip-btn i {
    font-size: 1.2rem;
}

.chip-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

.chip-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chip-btn .chip-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Language Toggle Modern */
.language-toggle-modern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--background-color);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.lang-toggle-btn {
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.lang-toggle-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(var(--primary-hue, 221), 0.4);
}

.settings-actions {
    margin-top: 40px;
    display: flex;
    justify-content: flex-end;
}

.btn-save-settings {
    padding: 14px 30px;
    font-size: 1.1rem;
    border-radius: 12px;
    gap: 10px;
}

@media (max-width: 768px) {
    .settings-modern-layout {
        grid-template-columns: 1fr;
    }
}

.profile-info-large h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.profile-meta-grid {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.profile-meta-grid span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

[dir="rtl"] .timeline {
    padding-left: 0;
    padding-right: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}

[dir="rtl"] .timeline::before {
    left: auto;
    right: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-dot {
    position: absolute;
    left: -26px;
    top: 20px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--card-bg);
}

[dir="rtl"] .timeline-dot {
    left: auto;
    right: -26px;
}

.history-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}

.history-date {
    font-weight: 700;
    color: var(--primary-color);
}

.history-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .history-body {
        grid-template-columns: 1fr;
    }
}

.history-measures {
    background: var(--background-color);
    padding: 15px;
    border-radius: var(--radius);
}

.history-order {
    padding: 10px;
}

.history-order p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.mini-item {
    background: var(--card-bg);
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.mini-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mini-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Global Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background-image: url('assets/icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: spin 1.2s linear infinite;
    filter: drop-shadow(0 4px 8px rgba(37, 99, 235, 0.3));
}

.loader-content p {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: 'Cairo', 'Inter', sans-serif;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

/* Modern Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: all 0.3s ease;
}

#salary-modal,
#confirm-modal {
    z-index: 2100;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    /* Added */
    display: flex;
    /* Added */
    flex-direction: column;
    /* Added */
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-card {
    transform: translateY(20px);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    /* Added */
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    /* Added */
    flex: 1;
    /* Added */
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    /* Added */
}

/* Order Card Design System */
.order-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    padding-top: 40px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.order-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-tag {
    position: absolute;
    top: -12px;
    left: 20px;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-tag.primary {
    background: var(--primary-color);
}

.card-tag.success {
    background: var(--success-color);
}

.card-tag.warning {
    background: var(--warning-color);
}

.card-tag.secondary {
    background: var(--secondary-color);
}

.card-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.card-fields.full-row {
    grid-template-columns: 1fr;
    margin-bottom: 15px;
}

/* Selection Group (Mutuelle Toggle) */
.selection-group {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    width: fit-content;
    border: 1px solid var(--border-color);
}

.selection-group input[type="radio"] {
    display: none;
}

.selection-group label {
    margin: 0 !important;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-muted);
}

.selection-group input[type="radio"]:checked+label {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Input with Icon / Currency */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-right: 45px !important;
}

.currency-label {
    position: absolute;
    right: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
}

/* RTL Adjustments for Arabic */
[dir="rtl"] .card-tag {
    left: auto;
    right: 20px;
}

[dir="rtl"] .currency-label {
    right: auto;
    left: 15px;
}

/* Financial Sub-sections */
.price-sub-section {
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.price-sub-section.warning-light {
    background: #fffbeb;
    border-color: #fef3c7;
}

.sub-section-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.price-summary-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--primary-light);
    border-radius: 16px;
    border: 2px solid var(--primary-color);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.summary-item label {
    margin: 0 !important;
    font-weight: 700;
    color: var(--text-main);
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.warning-text {
    color: #b45309 !important;
}

/* RTL Adjustments */
[dir="rtl"] .summary-value {
    letter-spacing: 0;
}

.payment-info-box {
    background: var(--primary-light);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

.payment-info-box span {
    font-size: 0.85rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.payment-info-box strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--background-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Dark Mode Overrides for New Components */
[data-theme="dark"] .selection-group {
    background: #0f172a;
    border-color: var(--border-color);
}

[data-theme="dark"] .selection-group input[type="radio"]:checked+label {
    background: var(--sidebar-bg);
    color: var(--primary-color);
}

[data-theme="dark"] .price-sub-section {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}

[data-theme="dark"] .price-sub-section.warning-light {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .price-summary-box {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
}

[data-theme="dark"] .summary-value {
    color: #60a5fa;
}

[data-theme="dark"] .warning-text {
    color: #fbbf24 !important;
}

[data-theme="dark"] .sub-section-header {
    color: var(--text-muted);
}

[data-theme="dark"] .currency-label {
    color: var(--text-muted);
}

/* =========================================
   NEW CLIENT FORM LAYOUT & DARK MODE FIXES
   ========================================= */
.client-form-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    width: 100%;
}

@media (max-width: 900px) {
    .client-form-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .profile-pic-section {
        margin: 0 auto;
        max-width: 240px;
    }
}

.input-readonly-ref {
    background-color: #f1f5f9;
    /* Slate 100 */
    color: var(--text-muted);
    font-family: monospace;
    font-weight: 700;
    text-align: center;
    border-color: var(--border-color);
    cursor: default;
}

[data-theme="dark"] .input-readonly-ref {
    background-color: #1e293b;
    /* Slate 800 */
    color: var(--primary-color);
    border-color: #334155;
    opacity: 0.8;
}

/* Ensure photo section centers its content */
/* Remove redundant profile-pic-section as it is handled above */
/* .profile-pic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
} */

.field-group {
    background: hsl(var(--primary-hue), 83%, 98%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    width: 100%;
}

[data-theme="dark"] .field-group {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
}

.field-group:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.field-group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    width: 18px;
    color: var(--primary-color);
    margin-right: 8px;
}

[dir="rtl"] .form-group label i {
    margin-right: 0;
    margin-left: 8px;
}

.field-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .field-group-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* =========================================
   ENHANCED CLIENT MANAGEMENT STYLES
   ========================================= */

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.client-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.client-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.client-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.client-card:hover::after {
    opacity: 1;
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.client-avatar {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.client-avatar.male {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.client-avatar.female {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.client-main-info {
    flex: 1;
    min-width: 0;
}

.client-main-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.client-status-badges {
    position: absolute;
    top: -10px;
    right: -10px;
}

.client-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: var(--background-color);
    padding: 12px;
    border-radius: 12px;
}

[data-theme="dark"] .client-card-stats {
    background: rgba(15, 23, 42, 0.4);
}

.client-card-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.client-card-stats .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.client-card-stats .stat-val {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.client-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Profile Details Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px dashed var(--border-color);
}

.profile-stat-card {
    background: var(--background-color);
    padding: 18px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

[data-theme="dark"] .profile-stat-card {
    background: rgba(30, 41, 59, 0.4);
}

.profile-stat-card:hover {
    transform: scale(1.02);
}

.profile-stat-card .label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.profile-stat-card .value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.profile-stat-card.warning .value {
    color: var(--danger-color);
}

.profile-stat-card.info .value {
    color: var(--primary-color);
}

.profile-avatar-large.male {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.profile-avatar-large.female {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

/* --- Auth Tabs --- */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
}

[data-theme="dark"] .auth-tabs {
    background: #1e293b;
}

.auth-tab {
    flex: 1;
    padding: 12px 5px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-tab.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.auth-tab i {
    font-size: 1rem;
}

/* --- Top Bar Profile --- */
.user-profile-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 15px;
    border-left: 1px solid var(--border-color);
    margin-left: 15px;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.profile-avatar-top {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s;
}

.profile-avatar-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-top:hover {
    transform: scale(1.05);
}

/* --- Profile Settings --- */
.profile-settings-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.profile-avatar-large {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    border: 4px solid var(--card-bg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.staff-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    overflow: hidden;
}

.staff-avatar-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info-section {
    flex: 1;
}

@media (max-width: 768px) {
    .profile-settings-grid {
        grid-template-columns: 1fr;
    }
}

.logout-btn-top {
    color: var(--text-muted);
    margin-left: 5px;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.logout-btn-top:hover {
    color: var(--text-error);
}

/* --- Permission Pills --- */
.permission-pill {
    padding: 4px 10px;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

[data-theme="dark"] .permission-pill {
    background: #1e293b;
}

.permission-pill.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.permission-pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* --- Profile Page Utility --- */
#section-profile .settings-grid {
    margin-top: 20px;
}

/* Forgot Password Link */
.forgot-link {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

[dir="rtl"] .forgot-link {
    right: auto;
    left: 0;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    padding: 30px;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.load-more-container {
    display: flex;
    justify-content: center;
    padding: 10px 20px;
}

.load-more-container.hidden,
.hidden {
    display: none !important;
}

/* Force specific modals to be on top of history modal */
#salary-modal,
#edit-salary-modal,
#payment-modal,
#confirm-modal {
    z-index: 20000 !important;
}

/* Reminders Table Enhancements */
.client-mini-info {
    display: flex;
    flex-direction: column;
}

.client-name-cell {
    font-weight: 700;
    color: var(--text-main);
}

.phone-cell {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.phone-cell i {
    color: var(--primary-color);
}

.reminder-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
}

.reminder-date-badge.late {
    background: #fee2e2;
    color: #ef4444;
}

.row-late {
    background-color: rgba(239, 68, 68, 0.02);
}

.reminder-actions {
    display: flex;
    gap: 8px;
}

.btn-action-remind {
    background: #dcfce7;
    color: #15803d;
    box-shadow: 0 2px 4px rgba(21, 128, 61, 0.1);
}

.btn-action-remind:hover {
    background: #bbf7d0;
    transform: translateY(-2px);
}

.btn-action-view {
    color: var(--primary-color);
    border-color: var(--primary-light);
}

.btn-action-whatsapp {
    background: #f0fdf4;
}

.btn-action-whatsapp:hover {
    background: #dcfce7;
}

[data-theme="dark"] .btn-action-remind {
    background: #064e3b;
    color: #34d399;
}

[data-theme="dark"] .reminder-date-badge {
    background: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .reminder-date-badge.late {
    background: rgba(239, 68, 68, 0.15);
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.1rem;
}

/* ===== Reminder Group Headers ===== */
.reminder-group-header td {
    padding: 10px 24px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: none;
}

.overdue-header td {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
    border-left: 3px solid var(--danger-color);
}

.upcoming-header td {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
    border-left: 3px solid var(--success-color);
}

[dir="rtl"] .overdue-header td {
    border-left: none;
    border-right: 3px solid var(--danger-color);
}

[dir="rtl"] .upcoming-header td {
    border-left: none;
    border-right: 3px solid var(--success-color);
}

[data-theme="dark"] .overdue-header td {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .upcoming-header td {
    background: rgba(16, 185, 129, 0.12);
}

/* Next 5 Days â€” urgent warning orange */
.next5-header td {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-left: 3px solid var(--warning-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

[dir="rtl"] .next5-header td {
    border-left: none;
    border-right: 3px solid var(--warning-color);
}

[data-theme="dark"] .next5-header td {
    background: rgba(245, 158, 11, 0.18);
}

/* Urgent row subtle highlight */
tr.row-urgent td {
    background: rgba(245, 158, 11, 0.04);
}

[data-theme="dark"] tr.row-urgent td {
    background: rgba(245, 158, 11, 0.08);
}

/* Urgent date badge */
.reminder-date-badge.urgent {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .reminder-date-badge.urgent {
    background: rgba(245, 158, 11, 0.2);
}

/* Count pill inside the section header */
.reminder-urgent-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--warning-color);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    margin-left: 6px;
}

[dir="rtl"] .reminder-urgent-badge {
    margin-left: 0;
    margin-right: 6px;
}

/* ===================================================
   STOCK PAGE STYLES
   =================================================== */

/* Quantity badges */
.stock-qty-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.stock-qty-ok {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
}

.stock-qty-low {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.stock-qty-empty {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
}

/* Low stock pulsing indicator */
.stock-low-indicator {
    display: inline-block;
    animation: pulse-warning 1.5s ease-in-out infinite;
    font-size: 0.9rem;
}

@keyframes pulse-warning {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

/* Category badges */
.stock-cat-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Card header */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Purchase total display box */
#purchase-total-display {
    display: inline-block;
    transition: all 0.2s ease;
}

/* ============================================================
   ORDER DETAILS MODAL
   ============================================================ */
.od-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.od-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.od-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.od-section-title i {
    color: var(--primary-color);
}

.od-info-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
}

.od-info-card label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.od-info-value {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.od-stat-card {
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
}

.od-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.od-stat-val {
    font-size: 1.25rem;
    font-weight: 800;
}

.od-payment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 0.88rem;
    border: 1px solid var(--border-color);
}

.od-payment-row i {
    width: 16px;
    text-align: center;
}

/* Clickable order rows hover */
tr.order-row-clickable:hover td {
    background: var(--primary-light);
}

tr.order-row-clickable {
    transition: background 0.15s;
}

/* Optical table inside modal */
.optical-table.professional th,
.optical-table.professional td {
    padding: 9px 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.optical-table.professional thead th {
    background: var(--bg-color);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.optical-table.professional tr.od-row td:first-child {
    font-weight: 800;
    color: #2563eb;
}

.optical-table.professional tr.og-row td:first-child {
    font-weight: 800;
    color: #16a34a;
}

/* ============================================================
   NEW ORDER FORM â€” STEP 2 (Refactored Layout)
   ============================================================ */

.new-order-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.new-order-section-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* Two-column grid for Monture + Verres */
.new-order-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .new-order-two-col {
        grid-template-columns: 1fr;
    }
}

/* Full-width panels */
.new-order-full {
    width: 100%;
    margin-bottom: 16px;
}

/* Panel card */
.new-order-panel {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-color);
    margin-bottom: 0;
}

.new-order-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
}

.new-order-panel-header i {
    font-size: 0.95rem;
}

/* Panel colour variants */
.panel-primary {
    background: var(--primary-color);
}

.panel-success {
    background: #16a34a;
}

.panel-warning {
    background: #d97706;
}

.panel-secondary {
    background: #6b7280;
}

.panel-purple {
    background: linear-gradient(135deg, #7c3aed, #9f67fa);
}

.new-order-panel-body {
    padding: 16px;
}

.new-order-panel-body .form-group {
    margin-bottom: 12px;
}

.new-order-panel-body .form-group:last-child {
    margin-bottom: 0;
}

/* Price grid (4-col default, override with style) */
.new-order-price-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 700px) {
    .new-order-price-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 420px) {
    .new-order-price-grid {
        grid-template-columns: 1fr;
    }
}

/* Mutuelle toggle row */
.mutuelle-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
}

/* Summary bar */
.new-order-summary-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.summary-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
}

.chip-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.chip-value {
    font-size: 1.1rem;
    font-weight: 800;
}

.chip-value.primary {
    color: var(--primary-color);
}

.chip-value.warning {
    color: #d97706;
}

.chip-input {
    flex: 1;
    min-width: 90px;
    max-width: 140px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-color);
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Accessories Picker Row */
.new-order-acc-picker {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.new-order-acc-picker .form-group {
    margin-bottom: 0;
}

.acc-select-group {
    flex: 3;
    min-width: 180px;
}

.acc-qty-group {
    flex: 1;
    min-width: 80px;
}

.acc-price-group {
    flex: 1;
    min-width: 100px;
}

.acc-add-btn {
    height: 42px;
    align-self: flex-end;
    white-space: nowrap;
    padding: 0 18px;
}

@media (max-width: 560px) {
    .new-order-acc-picker {
        flex-direction: column;
    }

    .acc-select-group,
    .acc-qty-group,
    .acc-price-group {
        width: 100%;
    }
}

/* â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ
   ORDER CONFIRMATION BANNER â€” Premium Sticky Footer
   â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ */

.order-confirm-banner {
    margin-top: 28px;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 4px var(--primary-light);
    background: var(--card-bg);
    animation: bannerSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* â”€â”€ Totals Row â”€â”€ */
.order-confirm-totals {
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg,
            hsla(var(--primary-hue), 83%, 53%, 0.06) 0%,
            hsla(var(--primary-hue), 83%, 53%, 0.02) 100%);
    border-bottom: 1px solid var(--border-color);
}

.order-confirm-total-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
}

.order-confirm-total-item i {
    font-size: 1.6rem;
    color: var(--primary-color);
    opacity: 0.7;
    flex-shrink: 0;
}

.order-confirm-total-item.remaining-item i {
    color: var(--warning-color);
}

.order-confirm-total-item div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.confirm-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.confirm-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.confirm-value.grand-total {
    color: var(--primary-color);
    font-size: 1.7rem;
}

.confirm-value.advance-val {
    color: var(--success-color);
}

.confirm-value.remaining-val {
    color: var(--warning-color);
}

.order-confirm-separator {
    width: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

/* â”€â”€ Advance Input inside banner â”€â”€ */
.order-confirm-advance-item {
    flex: 1.2;
    /* slightly wider than others to accommodate input */
}

.confirm-advance-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 6px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--background-color);
    transition: border-color 0.2s;
}

.confirm-advance-input-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.confirm-advance-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--success-color);
    outline: none;
    min-width: 0;
    width: 100%;
}

.confirm-advance-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1rem;
}

/* Remove browser default number arrows */
.confirm-advance-input::-webkit-outer-spin-button,
.confirm-advance-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.confirm-advance-cur {
    padding: 0 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--table-header-bg);
    border-left: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-height: 42px;
}

/* â”€â”€ Payment Reference Row â”€â”€ */
.payment-reference-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    animation: refSlideIn 0.25s ease;
}

@keyframes refSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.payment-reference-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.payment-reference-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-ref-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.payment-ref-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
    padding: 4px 2px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', monospace;
    letter-spacing: 0.05em;
}

.payment-ref-input:focus {
    border-bottom-color: var(--primary-color);
}

.payment-ref-input::placeholder {
    color: var(--border-color);
    font-weight: 400;
    letter-spacing: 0;
}

[data-theme="dark"] .payment-reference-row {
    background: rgba(255, 255, 255, 0.04);
}

/* â”€â”€ Payment Method Row â”€â”€ */
.order-confirm-payment {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}

.payment-method-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.payment-method-title i {
    color: var(--primary-color);
}

.payment-method-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.payment-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 40px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.22s ease;
    user-select: none;
    background: var(--card-bg);
}

.payment-option input[type="radio"] {
    display: none;
}

.payment-option:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.payment-option:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pay-icon {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
}

/* â”€â”€ Actions Row (Back + Confirm) â”€â”€ */
.order-confirm-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    gap: 16px;
    background: var(--card-bg);
}

.btn-back-confirm {
    padding: 12px 22px;
    font-size: 0.9rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.btn-back-confirm:hover {
    opacity: 1;
}

/* â”€â”€ The BIG Confirm Button â”€â”€ */
.btn-confirm-order {
    flex: 1;
    max-width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg,
            hsl(var(--primary-hue), 83%, 53%) 0%,
            hsl(var(--primary-hue), 83%, 43%) 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px hsla(var(--primary-hue), 83%, 53%, 0.45);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-confirm-order::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.15) 0%,
            transparent 60%);
    pointer-events: none;
}

.btn-confirm-order:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 28px hsla(var(--primary-hue), 83%, 53%, 0.55);
}

.btn-confirm-order:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 12px hsla(var(--primary-hue), 83%, 53%, 0.35);
}

.btn-confirm-order:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.confirm-btn-icon {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .order-confirm-banner {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 4px var(--primary-light);
}

[data-theme="dark"] .order-confirm-payment {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .payment-option {
    background: rgba(255, 255, 255, 0.04);
}

/* RTL Support */
[dir="rtl"] .order-confirm-banner {
    direction: rtl;
}

[dir="rtl"] .order-confirm-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .confirm-advance-cur {
    border-left: none;
    border-right: 1px solid var(--border-color);
}

/* Dark mode: advance input */
[data-theme="dark"] .confirm-advance-input-wrap {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .confirm-advance-cur {
    background: rgba(255, 255, 255, 0.06);
}

/* Tablet / Mobile Responsive */
@media (max-width: 768px) {
    .order-confirm-totals {
        flex-direction: column;
    }

    .order-confirm-separator {
        width: 100%;
        height: 1px;
        margin: 0;
    }

    .order-confirm-total-item {
        padding: 14px 20px;
    }

    .confirm-value.grand-total {
        font-size: 1.4rem;
    }

    .btn-confirm-order {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .payment-method-options {
        gap: 8px;
    }

    .payment-option {
        padding: 9px 14px;
        font-size: 0.82rem;
    }

    .confirm-advance-input {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .order-confirm-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .btn-confirm-order,
    .btn-back-confirm {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }
}

/* ======================== 
   INVOICE PRINT STYLES 
   ======================== */
.invoice-wrapper {
    width: 100%;
    margin: 0 auto;
    background: white;
    color: #1a202c;
    font-family: 'Inter', 'Cairo', sans-serif;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.invoice-wrapper * {
    box-sizing: border-box;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.invoice-logo-section {
    max-width: 50%;
}

#print-inv-logo {
    max-height: 65px;
    margin-bottom: 12px;
    display: block;
}

.invoice-shop-name {
    font-size: 1.7rem;
    font-weight: 900;
    color: #111827;
    letter-spacing: -0.025em;
}

.invoice-barcode-section {
    text-align: right;
}

.invoice-barcode-section svg {
    max-width: 160px;
}

.invoice-sub-header {
    padding: 1rem 0;
    border-top: 2px solid #edf2f7;
    border-bottom: 2px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a5568;
}

.invoice-info-banner {
    padding: 1.5rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.info-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item {
    font-size: 1rem;
    color: #4a5568;
}

.info-item strong {
    color: #111827;
    display: inline-block;
    min-width: 100px;
}

.invoice-table-container {
    padding: 0;
    flex: 1;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    table-layout: fixed;
}

.invoice-table th {
    background: #1e293b;
    color: #ffffff;
    padding: 12px 14px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.invoice-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
    color: #2d3748;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}



.invoice-table tbody tr:last-child td {
    border-bottom: 2px solid #1e293b;
}

.invoice-measures {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 8px;
    font-family: inherit;
    line-height: 1.6;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border-inline-start: 3px solid #cbd5e0;
    max-width: 100%;
    word-break: break-all;
}

.invoice-prescription-box {
    margin: 20px 0;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.presc-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
}

[dir="rtl"] .presc-title {
    text-align: right;
    font-family: 'Cairo', sans-serif;
}

.invoice-financial-summary {
    padding: 0 0 3rem;
    margin-inline-start: auto;
    /* Uses margin-left in LTR, margin-right in RTL */
    width: 320px;
    max-width: 100%;
}

.financial-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 1rem;
    border-bottom: 1px solid #edf2f7;
}

.financial-row .label-box {
    font-weight: 600;
    color: #4a5568;
}

.financial-row .value-box {
    font-weight: 800;
    color: #111827;
}

.financial-row.grand-total {
    background: #1e293b;
    color: white;
    border-radius: 8px;
    margin-top: 8px;
}

.financial-row.grand-total .label-box,
.financial-row.grand-total .value-box {
    color: white;
    font-size: 1.1rem;
}

.financial-row.remaining-total {
    border-top: 2px dashed #e2e8f0;
    margin-top: 10px;
    color: #dc2626;
}

.financial-row.remaining-total .value-box {
    color: #dc2626;
}

.words-row {
    margin: 1rem 0 2rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.5;
}

.words-row strong {
    color: #111827;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.invoice-header,
.invoice-sub-header,
.invoice-info-banner,
.invoice-financial-summary,
.words-row,
.invoice-shop-footer {
    break-inside: avoid;
    page-break-inside: avoid;
}

.invoice-shop-footer {
    padding: 2rem 0;
    border-top: 1px solid #edf2f7;
    text-align: center;
    font-size: 0.85rem;
    color: #718096;
    background: #fafafa;
    margin-top: auto;
}

/* Print Overrides */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
        /* Narrower margin to fit more content on one page */
    }

    html,
    body {
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    #invoice-print-container.active-print,
    #staff-print-container.active-print,
    #caisse-custom-print-container.active-print {
        display: block !important;
        width: 100% !important;
        position: relative !important;
        contain: none !important;
    }

    .print-page-break {
        page-break-after: always;
        break-after: page;
        height: 0;
        margin: 0;
        padding: 0;
    }

    .invoice-wrapper {
        width: 100% !important;
        max-width: none !important;
        height: auto;
        min-height: 0;
        margin: 0 !important;
        padding: 0 0 80px 0 !important;
        /* Space for fixed footer */
    }

    .invoice-shop-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        display: block !important;
        background: #fafafa !important;
        /* Keep the light grey background */
        border-top: 1px solid #edf2f7 !important;
        padding: 15px 0 !important;
        margin: 0 !important;
        z-index: 9999;
    }

    .app-container,
    .navbar,
    .sidebar,
    .modal-overlay,
    .toast,
    .loader-overlay,
    #action-loader,
    .no-print {
        display: none !important;
    }

    /* ==========================================
       --- STATISTICS PRINT STYLES ---
       ========================================== */
    body.stats-printing .app-container,
    body.stats-printing #section-stats,
    body.stats-printing #stats-print-header {
        display: block !important;
    }

    body.stats-printing #stats-print-annual-period {
        display: inline-block !important;
    }

    body.stats-printing .sidebar,
    body.stats-printing .navbar,
    body.stats-printing .page-header button {
        display: none !important;
    }

    body.stats-printing .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body.stats-printing #section-stats {
        padding: 10px !important;
    }

    body.stats-printing .card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        margin-bottom: 20px !important;
    }

    body.stats-printing .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }

    body.stats-printing .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ==========================================
       --- CAISSE PRINT STYLES ---
       ========================================== */
    body.caisse-printing .app-container,
    body.caisse-printing #section-caisse,
    body.caisse-printing #caisse-print-header,
    body.caisse-summary-printing .app-container,
    body.caisse-summary-printing #section-caisse,
    body.caisse-summary-printing #caisse-print-header {
        display: block !important;
    }

    body.caisse-printing .sidebar,
    body.caisse-printing .navbar,
    body.caisse-printing .page-header button,
    body.caisse-summary-printing .sidebar,
    body.caisse-summary-printing .navbar,
    body.caisse-summary-printing .page-header button {
        display: none !important;
    }

    body.caisse-printing .main-content,
    body.caisse-summary-printing .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body.caisse-printing #section-caisse,
    body.caisse-summary-printing #section-caisse {
        padding: 10px !important;
    }

    body.caisse-printing .card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        margin-bottom: 20px !important;
    }

    body.caisse-printing .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
        margin-bottom: 20px;
    }

    body.caisse-printing .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body.caisse-printing #caisse-table-body td {
        border-color: #cbd5e0 !important;
        padding: 5px 8px !important;
        font-size: 0.85rem !important;
        /* Smaller text for printing Details */
    }

    body.caisse-printing #caisse-table th {
        border-color: #cbd5e0 !important;
        font-size: 0.9rem !important;
        padding: 6px 8px !important;
        background: #f8fafc !important;
        /* Light background for print header */
    }

    body.caisse-printing .status-select-sm {
        transform: scale(0.9);
        transform-origin: left;
    }

    body.caisse-summary-printing #caisse-details-card,
    body.caisse-summary-printing .caisse-load-more-container {
        display: none !important;
    }

    body.caisse-summary-printing #caisse-summary-print-preview {
        display: block !important;
    }

    body.caisse-summary-printing .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
        margin-bottom: 20px;
    }




    /* Ensure canvas elements print well */
    body.stats-printing canvas {
        max-width: 100% !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    #staff-print-container.active-print {
        display: block !important;
        width: 100% !important;
        background: white !important;
    }

    /* Staff Badge Styling */
    .staff-badge-box {
        width: 60mm;
        height: 100mm;
        border: 2px solid #333;
        border-radius: 10mm;
        padding: 5mm;
        text-align: center;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        background: white;
    }

    .badge-header {
        font-weight: 800;
        font-size: 1.2rem;
        color: var(--primary-color);
        margin-bottom: 5mm;
        text-transform: uppercase;
    }

    .badge-photo {
        width: 35mm;
        height: 35mm;
        border-radius: 50%;
        object-fit: cover;
        margin: 0 auto;
        border: 2px solid var(--primary-color);
    }

    .badge-name {
        font-weight: 700;
        font-size: 1.1rem;
        margin-top: 5mm;
    }

    .badge-role {
        font-size: 0.9rem;
        color: #666;
        margin-bottom: 5mm;
    }

    .badge-qr {
        width: 20mm;
        height: 20mm;
        margin: 0 auto;
    }

    /* Staff Dossier Styling */
    .staff-dossier {
        padding: 10mm;
        padding-bottom: 80px;
        /* Space for fixed footer */
        max-width: 210mm;
        position: relative;
        box-sizing: border-box;
    }

    .staff-dossier * {
        box-sizing: border-box;
    }

    .dossier-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 30px;
    }

    .dossier-title {
        font-size: 1.8rem;
        font-weight: 800;
        color: var(--primary-color);
    }

    .dossier-section {
        margin-bottom: 8mm;
    }

    .dossier-section-title {
        font-size: 1.1rem;
        font-weight: 700;
        border-bottom: 1px solid #ddd;
        padding-bottom: 2mm;
        margin-bottom: 4mm;
        background: #f8f9fa;
        padding-left: 5px;
    }

    .dossier-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .dossier-item {
        margin-bottom: 5px;
    }

    .dossier-label {
        font-weight: 600;
        color: #555;
        font-size: 0.85rem;
    }

    .dossier-value {
        font-weight: 700;
        font-size: 1rem;
    }
}

/* Hidden by default in normal view */
#invoice-print-container,
#staff-print-container,
#caisse-custom-print-container {
    display: none;
}

/* Relevأ© de Caisse PDF Styles (Outside @media print to work with html2pdf) */
.print-releve-wrapper {
    font-family: 'Inter', sans-serif;
    color: #0f172a;
    padding: 20px;
    background: white;
}

.print-releve-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.print-releve-shop-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.print-releve-shop-info img {
    max-height: 80px;
}

.print-releve-shop-info h1 {
    font-size: 22pt;
    font-weight: 800;
    margin: 0 0 5px 0;
}

.print-releve-shop-info p {
    color: #64748b;
    font-size: 10pt;
    margin: 2px 0;
}

.print-releve-title {
    text-align: right;
}

.print-releve-title h2 {
    font-size: 16pt;
    color: #334155;
    margin: 0 0 5px;
}

.print-releve-title h3 {
    font-size: 12pt;
    color: #64748b;
    margin: 0;
    font-weight: 600;
}

.print-releve-start-balance {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 12pt;
    font-weight: 700;
    color: #1e293b;
}

#print-caisse-start-balance {
    color: #2563eb;
    font-size: 14pt;
    font-weight: 800;
}

.print-releve-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    font-size: 10pt;
}

.print-releve-table th {
    background: #f1f5f9;
    border-bottom: 2px solid #cbd5e1;
    padding: 10px;
    text-align: left;
    color: #334155;
}

.print-releve-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px;
    color: #475569;
}

.print-releve-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.text-right {
    text-align: right;
}

.text-green {
    color: #10b981 !important;
    font-weight: 600;
}

.text-red {
    color: #ef4444 !important;
    font-weight: 600;
}

.print-releve-summary {
    display: flex;
    justify-content: flex-end;
    page-break-inside: avoid;
}

.summary-box {
    width: 350px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    background: white;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.total-row {
    background: #0f172a !important;
    color: white !important;
    font-size: 14pt;
    font-weight: 800;
    padding: 15px;
}

.summary-row.total-row span {
    color: white !important;
}


/* â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ
   ًں“± MOBILE RESPONSIVENESS (max-width: 768px)
   All changes below are isolated to mobile ONLY.
   Desktop layout is completely untouched.
â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ */

/* -- Sidebar Overlay (dark backdrop) -- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

@media (max-width: 768px) {

    /* -- Show hamburger on mobile -- */
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: var(--background-color);
        border: 1px solid var(--border-color);
        font-size: 1.1rem;
        cursor: pointer;
        color: var(--text-main);
        transition: background 0.2s;
    }

    .sidebar-toggle:hover {
        background: var(--primary-light);
        color: var(--primary-color);
    }

    /* -- Sidebar: hidden off-screen, slides in -- */
    .sidebar {
        transform: translateX(-100%);
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        box-shadow: none;
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        left: auto;
        right: 0;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2);
    }

    [dir="rtl"] body.sidebar-open .sidebar {
        box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    }

    /* -- Remove sidebar margin from main content -- */
    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* -- Reduce page padding -- */
    .page-section {
        padding: 16px 12px !important;
    }

    /* -- Navbar adjustments -- */
    .navbar {
        padding: 0 12px;
    }

    .navbar-right {
        gap: 6px;
    }

    /* Hide user name text on small screens */
    .user-profile-nav .user-name {
        display: none;
    }

    /* -- Stats grid: 2 columns on mobile -- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .stat-card {
        padding: 16px 12px;
        gap: 12px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    /* -- Tables: allow horizontal scrolling -- */
    .table-container,
    .card>.table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* -- Cards: reduce header padding -- */
    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* -- Multi-column form rows: stack vertically -- */
    .field-group-row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* -- Page header -- */
    .page-header {
        margin-bottom: 16px;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }

    /* -- Modals: fullâ€‘width and scrollable -- */
    .modal-overlay {
        padding: 8px !important;
        align-items: flex-end !important;
    }

    .modal-card,
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: var(--radius) var(--radius) 0 0 !important;
        margin: 0 !important;
    }

    /* -- Modal footers: stack buttons on tiny screens -- */
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }

    /* -- Dashboard recent orders table on mobile: hide less-important columns -- */
    .recent-orders-table th:nth-child(4),
    .recent-orders-table td:nth-child(4),
    .recent-orders-table th:nth-child(5),
    .recent-orders-table td:nth-child(5) {
        display: none;
    }

    /* -- Settings layout: single column -- */
    .settings-modern-layout {
        flex-direction: column !important;
        gap: 16px;
    }

    .settings-column {
        width: 100% !important;
    }

    /* -- Stock grid reduce columns -- */
    .stock-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* -- Profile layout: single column -- */
    .profile-layout {
        flex-direction: column !important;
    }

    /* -- Client form step buttons: smaller -- */
    .step-navigation .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* -- Charts: reduce height on mobile -- */
    #daily-chart,
    #annual-chart {
        max-height: 220px !important;
    }

    #age-chart,
    #gender-chart {
        max-height: 200px !important;
    }

    /* -- Stats grid of charts: single column -- */
    .stats-charts-grid,
    .stats-demographics-grid {
        grid-template-columns: 1fr !important;
    }

    /* -- Form groups: full-width labels -- */
    .form-group label {
        font-size: 0.85rem;
    }

    /* -- Buttons: ensure readable touch targets -- */
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    /* -- Tiny action buttons in tables -- */
    td .btn,
    td .action-btns .btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    /* -- Order details modal wide buttons -- */
    #od-print-btn,
    #od-print-ins-btn {
        flex: 1;
    }

    /* -- Lang switcher: smaller labels -- */
    .lang-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
}

/* Ultra-small phones (< 400px) */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 14px 10px;
    }

    .page-section {
        padding: 12px 10px !important;
    }

    .card-header {
        padding: 10px 12px;
    }
}

/* Fix print templates visibility in login */
@media screen {
    body:has(.premium-login:not(.hidden)) .print-templates-wrapper {
        display: none !important;
    }
}