/* ============================================
   Pharmacy POS System — Core Stylesheet
   Custom CSS 2025 — No frameworks
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Rubik:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
    /* Primary Palette */
    --primary: #0077B6;
    --primary-dark: #005F8A;
    --primary-light: #90E0EF;
    --primary-bg: #E3F6FD;
    --accent: #00B4D8;

    /* Semantic */
    --success: #2D9E6B;
    --success-bg: #E6F7EF;
    --warning: #F4A261;
    --warning-bg: #FFF4E6;
    --danger: #E63946;
    --danger-bg: #FDECEE;
    --info: #0077B6;
    --info-bg: #E3F6FD;

    /* Layout */
    --bg: #F0F7FF;
    --card: #FFFFFF;
    --sidebar: #E8F4FD;
    --sidebar-active: #D0EBFA;
    --text: #1A1A2E;
    --text-secondary: #4A4A6A;
    --muted: #6C757D;
    --border: #CCE5F0;
    --border-light: #E4EFF5;
    --input-bg: #F8FBFF;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Rubik', 'Inter', sans-serif;

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-full: 50px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-primary: 0 4px 14px rgba(0, 119, 182, 0.25);

    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

h1 {
    font-size: 1.85rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.1rem;
}

.text-muted {
    color: var(--muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

/* ── Layout: App Shell ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    object-fit: contain;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.sidebar-brand small {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 400;
    font-family: var(--font-primary);
}

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.sidebar-nav .nav-section {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 16px 12px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--sidebar-active);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.sidebar-nav a .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav a .badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

[dir="rtl"] .sidebar-nav a .badge {
    margin-left: 0;
    margin-right: auto;
}

/* ── Topbar ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

.topbar {
    height: var(--topbar-height);
    background: var(--card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 1.15rem;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
    position: relative;
}

.topbar-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
}

.topbar-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--card);
}

.topbar-branch {
    margin-right: 15px;
}

.branch-select {
    background: var(--sidebar);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.branch-select:hover {
    border-color: var(--primary);
}

.branch-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

[dir="rtl"] .topbar-branch {
    margin-right: 0;
    margin-left: 15px;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 4px;
}

.lang-switcher a {
    width: 30px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.lang-switcher a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.lang-switcher a.active {
    background: var(--primary);
    color: #fff;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}

.user-menu:hover {
    background: var(--input-bg);
}

.user-menu img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.user-menu .user-info {
    line-height: 1.2;
}

.user-menu .user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-menu .user-info .role {
    font-size: 0.7rem;
    color: var(--muted);
}

/* ── Content Area ── */
.content-area {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.breadcrumbs a {
    color: var(--muted);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .sep {
    opacity: 0.4;
}

/* ── Cards ── */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--input-bg);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-info h4 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.stat-card .stat-info .stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    font-family: var(--font-heading);
    line-height: 1;
}

.stat-card .stat-info .stat-change {
    font-size: 0.75rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.orange {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.red {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    filter: brightness(0.9);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(0.9);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--font-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text);
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.12);
    background: #fff;
}

.form-control::placeholder {
    color: #A0AEC0;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 4px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236C757D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

[dir="rtl"] select.form-control {
    background-position: left 12px center;
    padding-right: 14px;
    padding-left: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--input-bg);
    border-bottom: 2px solid var(--border-light);
    text-align: left;
    white-space: nowrap;
}

[dir="rtl"] table thead th {
    text-align: right;
}

table tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

table tbody tr:hover {
    background: var(--primary-bg);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges / Tags ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-muted {
    background: #eee;
    color: var(--muted);
}

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-success {
    background: var(--success-bg);
    border-color: #A3E4C1;
    color: #1B7A4A;
}

.alert-warning {
    background: var(--warning-bg);
    border-color: #F9D9A8;
    color: #8A5A1E;
}

.alert-danger {
    background: var(--danger-bg);
    border-color: #F5B7BC;
    color: #A42834;
}

.alert-info {
    background: var(--info-bg);
    border-color: #9AD4EC;
    color: #005F8A;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.05rem;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 20px;
}

.toast {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 420px;
    animation: toastSlideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

[dir="rtl"] .toast {
    border-left: none;
    border-right: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

[dir="rtl"] .toast.success {
    border-right-color: var(--success);
}

[dir="rtl"] .toast.error {
    border-right-color: var(--danger);
}

[dir="rtl"] .toast.warning {
    border-right-color: var(--warning);
}

.toast .toast-message {
    flex: 1;
    font-size: 0.88rem;
}

.toast .toast-close {
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition-fast);
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text);
}

.toast .toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

[dir="rtl"] @keyframes toastSlideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    justify-content: center;
    margin-top: 20px;
}

.pagination li a,
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.pagination li a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.pagination li.active span {
    background: var(--primary);
    color: #fff;
}

.pagination li.disabled span {
    opacity: 0.4;
    cursor: default;
}

/* ── Dropdowns ── */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    transform: translateY(5px);
    visibility: hidden;
    transition: var(--transition-fast);
}

[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-primary);
    text-align: left;
}

[dir="rtl"] .dropdown-menu button,
[dir="rtl"] .dropdown-menu a {
    text-align: right;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* ── Image Upload ── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--input-bg);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-zone .upload-icon {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 10px;
}

.upload-zone .upload-text {
    font-size: 0.9rem;
    color: var(--muted);
}

.upload-zone .upload-text strong {
    color: var(--primary);
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.upload-preview .preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--border-light);
}

.upload-preview .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview .preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transition: var(--transition-fast);
}

.upload-preview .preview-item:hover .remove-btn {
    opacity: 1;
}

.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.upload-progress .progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 20px;
}

.tabs button {
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font-primary);
    color: var(--muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tabs button:hover {
    color: var(--primary);
}

.tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Search Bar ── */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    font-size: 0.88rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    font-family: var(--font-primary);
    outline: none;
    transition: var(--transition-fast);
}

[dir="rtl"] .search-box input {
    padding: 9px 38px 9px 14px;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

[dir="rtl"] .search-box .search-icon {
    left: auto;
    right: 12px;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 3.5rem;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 20px;
}

/* ── Installation Wizard ── */
.install-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E3F6FD 0%, #F0F7FF 50%, #E8F4FD 100%);
    padding: 20px;
}

.install-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 680px;
    overflow: hidden;
}

.install-header {
    padding: 30px 36px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}

.install-header h1 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.install-header p {
    opacity: 0.85;
    font-size: 0.9rem;
}

.install-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 36px;
    background: var(--input-bg);
    border-bottom: 1px solid var(--border-light);
}

.install-steps .step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.install-steps .step.active {
    background: var(--primary);
    color: #fff;
}

.install-steps .step.done {
    color: var(--success);
}

.install-steps .step .num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--border-light);
    color: var(--muted);
}

.install-steps .step.active .num {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.install-steps .step.done .num {
    background: var(--success-bg);
    color: var(--success);
}

.install-body {
    padding: 36px;
}

.install-footer {
    padding: 16px 36px 28px;
    display: flex;
    justify-content: space-between;
}

/* ── Login Page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E3F6FD 0%, #F0F7FF 50%, #E8F4FD 100%);
    padding: 20px;
}

.login-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    text-align: center;
}

.login-card .logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 1.8rem;
}

.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.login-card .form-group {
    text-align: left;
}

[dir="rtl"] .login-card .form-group {
    text-align: right;
}

/* ── POS Interface ── */
.pos-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    height: calc(100vh - var(--topbar-height));
}

.pos-products {
    padding: 20px;
    overflow-y: auto;
}

.pos-cart {
    background: var(--card);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
}

[dir="rtl"] .pos-cart {
    border-left: none;
    border-right: 1px solid var(--border-light);
}

.pos-cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.pos-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border-bottom: 1px solid var(--border-light);
}

.pos-cart-item:hover {
    background: var(--input-bg);
}

.pos-cart-item .item-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
}

.pos-cart-item .item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-cart-item .item-qty button {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.pos-cart-item .item-qty button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pos-cart-item .item-price {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: right;
}

.pos-cart-summary {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--input-bg);
}

.pos-cart-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.88rem;
}

.pos-cart-summary .summary-row.total {
    font-size: 1.2rem;
    font-weight: 700;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 2px solid var(--border);
    color: var(--primary);
}

.pos-cart-actions {
    padding: 16px 20px;
    display: flex;
    gap: 10px;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.pos-product-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.pos-product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.pos-product-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.pos-product-card .product-name {
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.pos-product-card .product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.pos-product-card .product-stock {
    font-size: 0.72rem;
    color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    [dir="rtl"] .main-content {
        margin-right: 0;
    }

    .pos-wrapper {
        grid-template-columns: 1fr;
    }

    .pos-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border-light);
        transform: translateY(100%);
        transition: var(--transition);
        z-index: 100;
    }

    .pos-cart.open {
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar {
        padding: 0 16px;
    }

    .install-body,
    .install-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .install-steps {
        flex-wrap: wrap;
    }

    .login-card {
        padding: 28px 20px;
    }
}

/* ── Utilities ── */
.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 16px;
}

.gap-4 {
    gap: 24px;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.p-1 {
    padding: 8px;
}

.p-2 {
    padding: 16px;
}

.p-3 {
    padding: 24px;
}

.w-100 {
    width: 100%;
}

.fw-bold {
    font-weight: 700;
}

.fw-medium {
    font-weight: 500;
}

.rounded {
    border-radius: var(--radius);
}

/* ── Print Styles ── */
@media print {

    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0;
    }

    .content-area {
        padding: 0;
    }

    body {
        background: #fff;
    }
}

/* ── Loading Spinner ── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

/* ══════════════════════════════════════
   Installer UI — Premium Glassmorphic
   ══════════════════════════════════════ */
.install-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 50%, #e8f4fd 100%);
    padding: 30px 20px;
}

.install-card {
    width: 100%;
    max-width: 640px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 119, 182, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 45px 40px;
    position: relative;
    overflow: hidden;
}

.install-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
}

/* ── Installer Header ── */
.install-header {
    text-align: center;
    margin-bottom: 30px;
}

.install-header .icon {
    font-size: 2.2rem;
    color: var(--primary);
    background: var(--primary-bg);
    width: 72px;
    height: 72px;
    line-height: 72px;
    border-radius: 18px;
    display: inline-block;
    margin-bottom: 18px;
    box-shadow: 0 4px 14px rgba(0, 119, 182, 0.15);
}

.install-header h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.install-header p {
    color: var(--muted);
    font-size: 0.95rem;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Step Items Grid ── */
.install-steps {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.install-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 14px 8px;
    border-radius: 14px;
    border: 1px solid var(--border-light);
    font-size: 0.8rem;
    text-align: center;
    transition: var(--transition);
    color: var(--text-secondary);
}

.install-step-item i {
    font-size: 1.2rem;
    color: var(--muted);
}

.install-step-item.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.install-step-item.active i {
    color: var(--primary);
}

/* ── Footer ── */
.install-footer {
    margin-top: 35px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .install-card {
        padding: 30px 22px;
    }
    .install-steps {
        grid-template-columns: repeat(2, 1fr);
    }
}
