/* dashboard/style.css — Premium Glassmorphism with Light/Dark Theme */

:root, [data-theme="dark"] {
    --bg-primary: #07050d;
    --bg-surface: rgba(15, 11, 28, 0.5);
    --border-color: rgba(255, 255, 255, 0.065);
    --border-hover: rgba(255, 255, 255, 0.14);
    --color-text-main: #f3f1f8;
    --color-text-muted: #9f9baa;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    --chart-grid: rgba(255,255,255,0.05);
    --input-bg: rgba(0, 0, 0, 0.25);
    --input-focus: rgba(0, 0, 0, 0.4);
    --glow-opacity: 0.15;
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.18);
    --color-text-main: #1a1a2e;
    --color-text-muted: #6b7280;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --chart-grid: rgba(0,0,0,0.06);
    --input-bg: rgba(0, 0, 0, 0.04);
    --input-focus: rgba(0, 0, 0, 0.08);
    --glow-opacity: 0.08;
}

:root { --font-heading: 'Outfit', sans-serif; --font-body: 'Plus Jakarta Sans', sans-serif; --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

* { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(128,128,128,0.2) transparent; }
body { background-color: var(--bg-primary); color: var(--color-text-main); font-family: var(--font-body); min-height: 100vh; overflow-x: hidden; position: relative; transition: background-color 0.4s, color 0.4s; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 600; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 10px; }

.glow-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; pointer-events: none; }
.glow-circle { position: absolute; border-radius: 50%; filter: blur(140px); opacity: var(--glow-opacity); transition: opacity 0.4s; }
.glow-circle-1 { top: -10%; right: 10%; width: 500px; height: 500px; background: radial-gradient(circle, #6366f1, transparent 80%); }
.glow-circle-2 { bottom: -10%; left: 10%; width: 600px; height: 600px; background: radial-gradient(circle, #ec4899, transparent 80%); }

.glass-panel { background: var(--bg-surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border-color); border-radius: 16px; transition: var(--transition-smooth); }
.glass-panel:hover { border-color: var(--border-hover); box-shadow: 0 8px 32px rgba(0,0,0,0.15); }

.hidden { display: none !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.max-w-xl { max-width: 36rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.overflow-hidden { overflow: hidden; }
.flex-justify { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

/* Login */
#login-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; display: flex; justify-content: center; align-items: center; z-index: 1000; }
.login-card { width: 100%; max-width: 440px; padding: 3rem 2.5rem; box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
.login-header { text-align: center; margin-bottom: 2.5rem; }
.brand-logo { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 1rem; text-shadow: 0 0 20px var(--primary-glow); }
.login-header h1 { font-size: 2rem; margin-bottom: 0.5rem; background: linear-gradient(135deg, var(--color-text-main) 0%, #a78bfa 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-header p { color: var(--color-text-muted); font-size: 0.95rem; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.form-group label i { margin-right: 4px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 0.85rem 1rem; color: var(--color-text-main); font-family: var(--font-body); font-size: 0.95rem; outline: none; transition: var(--transition-smooth); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 12px var(--primary-glow); background: var(--input-focus); }
.field-hint { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.35rem; }

/* Buttons */
.btn-primary { width: 100%; background: var(--primary-color); color: white; font-family: var(--font-heading); font-size: 1rem; font-weight: 550; border: none; border-radius: 10px; padding: 0.9rem 1.5rem; cursor: pointer; transition: var(--transition-smooth); box-shadow: 0 4px 15px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-sm { width: auto; padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-secondary { background: var(--input-bg); border: 1px solid var(--border-color); color: var(--color-text-main); padding: 0.8rem 1.5rem; border-radius: 10px; cursor: pointer; font-family: var(--font-heading); font-weight: 550; transition: var(--transition-smooth); }
.btn-secondary:hover { background: var(--input-focus); }

.alert-box { margin-top: 1.5rem; padding: 1rem; border-radius: 10px; font-size: 0.9rem; display: flex; align-items: flex-start; gap: 8px; border: 1px solid transparent; line-height: 1.5; }
.alert-box.error { background: rgba(239,68,68,0.1); color: var(--color-error); border-color: rgba(239,68,68,0.2); }

/* Layout */
#app-container { display: flex; min-height: 100vh; padding: 1.5rem; gap: 1.5rem; }
.sidebar { width: 260px; flex-shrink: 0; padding: 1.5rem 1.2rem; display: flex; flex-direction: column; height: calc(100vh - 3rem); position: sticky; top: 1.5rem; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; padding-left: 8px; }
.brand-icon { font-size: 1.8rem; background: linear-gradient(135deg, #a78bfa, #6366f1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-brand h2 { font-size: 1.4rem; letter-spacing: -0.5px; }
.sidebar-menu { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 0.75rem 1rem; color: var(--color-text-muted); text-decoration: none; border-radius: 10px; font-size: 0.9rem; font-weight: 500; transition: var(--transition-smooth); position: relative; }
.menu-item:hover { color: var(--color-text-main); background: rgba(128,128,128,0.06); }
.menu-item.active { color: var(--primary-color); background: rgba(99,102,241,0.1); font-weight: 600; }
.badge { position: absolute; right: 1rem; background: var(--color-error); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 20px; font-weight: 700; }
.sidebar-footer { border-top: 1px solid var(--border-color); padding-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-info i { font-size: 1.3rem; color: var(--primary-color); }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-status { font-size: 0.72rem; color: var(--color-text-muted); display: flex; align-items: center; gap: 4px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.online, .status-indicator.online { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.status-indicator.offline { background: var(--color-error); box-shadow: 0 0 8px var(--color-error); }
.btn-logout { background: transparent; border: 1px solid rgba(239,68,68,0.25); border-radius: 10px; color: var(--color-error); padding: 0.55rem; cursor: pointer; font-family: var(--font-heading); font-size: 0.85rem; transition: var(--transition-smooth); }
.btn-logout:hover { background: rgba(239,68,68,0.1); }

/* Main */
.main-content { flex-grow: 1; display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.topbar { padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }

/* Lang Selector */
.lang-selector { display: flex; gap: 2px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 3px; }
.lang-btn { background: transparent; border: none; font-size: 1.15rem; padding: 5px 8px; border-radius: 7px; cursor: pointer; transition: var(--transition-smooth); opacity: 0.45; line-height: 1; }
.lang-btn:hover { opacity: 0.75; }
.lang-btn.active { opacity: 1; background: rgba(99,102,241,0.2); }

/* Theme & Auto-refresh */
.btn-icon { background: var(--input-bg); border: 1px solid var(--border-color); color: var(--color-text-main); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: var(--transition-smooth); font-size: 0.9rem; }
.btn-icon:hover { background: rgba(128,128,128,0.1); border-color: var(--border-hover); color: var(--primary-color); }
.btn-icon.active { color: var(--color-success); border-color: rgba(16,185,129,0.3); }
.btn-icon.active i { animation: spin 2s linear infinite; }
#btn-export { color: #22c55e; }
#btn-export:hover { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); }
.api-status { display: flex; align-items: center; gap: 6px; background: var(--input-bg); border: 1px solid var(--border-color); padding: 0.4rem 0.8rem; border-radius: 20px; font-size: 0.75rem; }

/* Tabs */
.tab-content { display: none; flex-direction: column; gap: 1.5rem; }
.tab-content.active {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.action-bar { display: flex; }
.tabs-sub { display: flex; background: var(--input-bg); border: 1px solid var(--border-color); padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.sub-tab, .order-filter-btn { background: transparent; border: none; padding: 0.5rem 1rem; color: var(--color-text-muted); font-family: var(--font-body); font-weight: 550; cursor: pointer; border-radius: 7px; transition: var(--transition-smooth); font-size: 0.85rem; }
.sub-tab.active, .order-filter-btn.active { background: var(--primary-color); color: white; box-shadow: 0 4px 12px var(--primary-glow); }
.sub-tab-content { display: none; flex-direction: column; }
.sub-tab-content.active { display: flex; }

/* Metrics */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.metric-card { padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.metric-label { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 4px; }
.metric-info h3 { font-size: 1.6rem; font-weight: 700; }
.metric-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.15rem; }
.metric-icon.color-green { background: rgba(16,185,129,0.15); color: var(--color-success); }
.metric-icon.color-blue { background: rgba(59,130,246,0.15); color: var(--color-info); }
.metric-icon.color-purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.metric-icon.color-amber { background: rgba(245,158,11,0.15); color: var(--color-warning); }

/* Charts */
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1rem; }
.chart-card { padding: 1.5rem; }
.chart-wrapper { height: 220px; position: relative; }
.chart-wrapper canvas { width: 100% !important; height: 100% !important; }

/* Dashboard */
.dashboard-row { display: flex; gap: 1.5rem; }
.dashboard-col { padding: 1.5rem; }
.flex-grow-2 { flex: 1; }
.panel-header { margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; }
.panel-header h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.stock-status-list { display: flex; flex-direction: column; gap: 8px; }
.stock-status-item { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1rem; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 10px; }
.prod-badge { display: flex; align-items: center; gap: 8px; }
.prod-emoji { font-size: 1.15rem; }
.prod-name-lbl { font-weight: 500; font-size: 0.9rem; }
.stock-count-badge { padding: 3px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.stock-count-badge.ok { background: rgba(16,185,129,0.15); color: var(--color-success); }
.stock-count-badge.low { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.stock-count-badge.empty { background: rgba(239,68,68,0.15); color: var(--color-error); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.88rem; }
.data-table th, .data-table td { padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--border-color); }
.data-table th { background: var(--input-bg); color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.3px; }
.data-table tr:last-child td { border-bottom: none; }
.btn-table-action { background: transparent; border: none; cursor: pointer; font-size: 0.95rem; padding: 4px 6px; border-radius: 6px; transition: var(--transition-smooth); }
.btn-table-action.delete { color: var(--color-error); }
.btn-table-action.delete:hover { background: rgba(239,68,68,0.15); }
.btn-table-action.stock { color: var(--color-info); }
.btn-table-action.stock:hover { background: rgba(59,130,246,0.15); }
.btn-table-action.ban { color: var(--color-warning); }
.btn-table-action.ban:hover { background: rgba(245,158,11,0.15); }
.btn-table-action.unban { color: var(--color-success); }
.btn-table-action.unban:hover { background: rgba(16,185,129,0.15); }

/* Status Badges */
.status-badge { padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.status-badge.pending, .status-badge.awaiting_payment { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.status-badge.completed { background: rgba(16,185,129,0.15); color: var(--color-success); }
.status-badge.cancelled { background: rgba(239,68,68,0.15); color: var(--color-error); }
.status-badge.banned { background: rgba(239,68,68,0.15); color: var(--color-error); }
.status-badge.active-promo { background: rgba(16,185,129,0.15); color: var(--color-success); }
.status-badge.success { background: rgba(16,185,129,0.15); color: var(--color-success); }
.status-badge.neutral { background: rgba(128,128,128,0.15); color: var(--color-text-muted); }
.status-badge.info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.status-badge.expired { background: rgba(128,128,128,0.15); color: var(--color-text-muted); }
.status-badge.topup { background: rgba(99,102,241,0.15); color: var(--primary-color); }

/* Payment Method Badge */
.pay-method-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; }
.pay-method-badge.wallet { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.pay-method-badge.binance { background: rgba(251,191,36,0.15); color: #f59e0b; border: 1px solid rgba(251,191,36,0.3); }

/* Pagination */
.pagination-bar { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 1rem; color: var(--color-text-muted); font-size: 0.9rem; }

/* Categories */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.category-card { padding: 1.25rem; display: flex; gap: 1rem; align-items: flex-start; }
.cat-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--border-color); display: flex; justify-content: center; align-items: center; font-size: 1.4rem; }
.cat-info h4 { font-size: 1.05rem; margin-bottom: 3px; }
.cat-info p { font-size: 0.82rem; color: var(--color-text-muted); }

/* Tickets */
.tickets-list { display: flex; flex-direction: column; gap: 1rem; }
.ticket-card { padding: 1.25rem; }
.ticket-header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 0.7rem; margin-bottom: 0.75rem; }
.ticket-message { background: var(--input-bg); border: 1px solid var(--border-color); padding: 0.85rem; border-radius: 10px; font-size: 0.9rem; line-height: 1.5; margin-bottom: 1rem; }
.ticket-reply-form { display: flex; gap: 0.75rem; align-items: flex-end; }
.ticket-reply-form .form-group { flex-grow: 1; margin-bottom: 0; }
.btn-send-reply { width: auto; padding: 0.75rem 1.2rem; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.modal-overlay:not(.hidden) {
    animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modal-overlay:not(.hidden) .modal-card {
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card { width: 95%; max-width: 500px; padding: 1.75rem; box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
.modal-card-lg { max-width: 650px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; margin-bottom: 1.25rem; }
.btn-close-modal { background: transparent; border: none; color: var(--color-text-muted); font-size: 1.2rem; cursor: pointer; transition: var(--transition-smooth); }
.btn-close-modal:hover { color: var(--color-error); }
.form-row { display: flex; gap: 0.75rem; }
.col-3 { width: 25%; }
.col-4 { width: 33.33%; }
.col-6 { width: 50%; }
.col-9 { width: 75%; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border-color); padding-top: 1rem; margin-top: 1.25rem; }

/* Stock Modal */
.stock-modal-body { display: flex; flex-direction: column; gap: 1.25rem; }
.stock-add-section label { display: block; font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 0.4rem; font-weight: 500; }
.stock-add-section textarea { width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 0.75rem; color: var(--color-text-main); font-family: 'Courier New', monospace; font-size: 0.82rem; outline: none; transition: var(--transition-smooth); resize: vertical; }
.stock-add-section textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 12px var(--primary-glow); }
.stock-add-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.stock-add-left { display: flex; align-items: center; gap: 0.75rem; }
.stock-line-hint { font-size: 0.78rem; color: var(--color-text-muted); }
.file-import-btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 0.82rem; padding: 0.45rem 0.8rem !important; }
.stock-existing-section h4 { font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 6px; }
.stock-items-scroll { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.stock-item-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.78rem; font-family: 'Courier New', monospace; }
.stock-item-data { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0.5rem; transition: all 0.2s; }
.stock-item-data.expanded { white-space: pre-wrap; word-break: break-all; overflow: visible; }
.stock-item-status { flex-shrink: 0; }
.stock-item-status.available { color: var(--color-success); }
.stock-item-status.sold { color: var(--color-error); opacity: 0.7; }

/* Tiers Modal */
.tiers-modal-body { padding: 0 0.25rem; }
.tier-row { animation: slideUp 0.2s ease; }
.tier-row input { width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.6rem 0.75rem; color: var(--color-text-main); font-family: var(--font-body); font-size: 0.9rem; outline: none; transition: var(--transition-smooth); }
.tier-row input:focus { border-color: var(--primary-color); box-shadow: 0 0 8px var(--primary-glow); }

/* Spinner */
#loading-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(10,8,19,0.6); z-index: 3000; display: flex; justify-content: center; align-items: center; }
.spinner { width: 45px; height: 45px; border: 4px solid var(--border-color); border-left-color: var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; box-shadow: 0 0 20px var(--primary-glow); }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.empty-state { text-align: center; color: var(--color-text-muted); padding: 2rem 1rem; font-size: 0.9rem; }
.animate-slide { animation: slideUp 0.35s cubic-bezier(0.4,0,0.2,1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* RTL */
[dir="rtl"] .menu-item.active { border-left: none; border-right: 3px solid var(--primary-color); }
[dir="rtl"] .badge { right: auto; left: 1rem; }
[dir="rtl"] .form-group label i { margin-right: 0; margin-left: 4px; }
[dir="rtl"] .data-table { text-align: right; }
[dir="rtl"] .metric-card, [dir="rtl"] .stock-status-item, [dir="rtl"] .user-info { flex-direction: row-reverse; }
[dir="rtl"] .topbar, [dir="rtl"] .topbar-actions, [dir="rtl"] .flex-justify { flex-direction: row-reverse; }

/* Responsive */

/* Mobile menu toggle button (injected via JS) */
.mobile-menu-toggle {
    display: none;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--color-text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}
.mobile-menu-toggle:hover { background: rgba(128,128,128,0.1); color: var(--primary-color); }

/* Sidebar overlay backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
}
.sidebar-backdrop.active { display: block; }

/* ── Tablet & Small Desktop (≤ 1024px) ── */
@media (max-width: 1024px) {
    .charts-row { grid-template-columns: 1fr; }
    .dashboard-row { flex-direction: column; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }

    #app-container {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    /* Sidebar as slide-in overlay */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        height: 100vh;
        z-index: 999;
        border-radius: 0 16px 16px 0;
        transform: translateX(-110%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 1.5rem 1.2rem;
        flex-direction: column;
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-brand { display: flex !important; }
    .sidebar-footer { display: flex !important; }
    .sidebar-menu { flex-direction: column; overflow-x: visible; }
    .menu-item span { display: inline !important; }
    .menu-item { padding: 0.75rem 1rem; }

    /* Topbar */
    .topbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        top: 0; /* Remove the 1.5rem gap from desktop */
        margin-top: 0;
        border-radius: 0 0 16px 16px;
    }
    .page-title h1 { font-size: 1.15rem; }
    .topbar-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .api-status { display: none; }

    /* Metrics */
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .metric-card { padding: 1rem; }
    .metric-info h3 { font-size: 1.25rem; }
    .metric-icon { width: 38px; height: 38px; font-size: 1rem; }

    /* Charts */
    .charts-row { grid-template-columns: 1fr; gap: 0.75rem; }
    .chart-card { padding: 1rem; }
    .chart-wrapper { height: 180px; }

    /* Dashboard row */
    .dashboard-row { flex-direction: column; gap: 0.75rem; }

    /* Tables — horizontal scroll */
    .glass-panel.overflow-hidden { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }
    .data-table th, .data-table td { padding: 0.65rem 0.75rem; font-size: 0.8rem; white-space: nowrap; }

    /* Tabs / Filter buttons */
    .tabs-sub { flex-wrap: wrap; gap: 2px; }
    .sub-tab, .order-filter-btn { font-size: 0.78rem; padding: 0.4rem 0.7rem; }
    .sub-tab i, .order-filter-btn i { display: none; }

    /* Modals — full-width on mobile */
    .modal-card, .modal-card-lg {
        width: calc(100vw - 1.5rem);
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        padding: 1.25rem;
    }

    /* Form rows stack on mobile */
    .form-row { flex-direction: column; gap: 0; }
    .col-3, .col-4, .col-6, .col-9 { width: 100%; }

    /* Tickets */
    .ticket-reply-form { flex-direction: column; gap: 0.5rem; }
    .btn-send-reply { width: 100%; }

    /* Broadcast & Settings */
    .max-w-xl { max-width: 100%; }

    /* Categories grid */
    .categories-grid { grid-template-columns: 1fr; }

    /* Pagination */
    .pagination-bar { padding: 0.75rem; font-size: 0.82rem; gap: 0.75rem; }

    /* Stock modal */
    .stock-add-actions { flex-direction: column; gap: 0.5rem; align-items: stretch; }
    .stock-add-left { justify-content: space-between; }
    .stock-item-row { font-size: 0.72rem; }
    .stock-items-scroll { max-height: 160px; }

    /* Tiers modal */
    .tier-row .form-row { flex-direction: row; gap: 0.5rem; }
    .tier-row .form-row .form-group { flex: 1; }

    /* Login */
    .login-card { padding: 2rem 1.5rem; margin: 0.75rem; }
    .brand-logo { font-size: 2rem; }
    .login-header h1 { font-size: 1.6rem; }
}

/* ── Small Phone (≤ 480px) ── */
@media (max-width: 480px) {
    #app-container { padding: 0.5rem; gap: 0.5rem; }

    .metrics-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .metric-card {
        flex-direction: row;
        padding: 0.85rem 1rem;
    }

    .topbar {
        padding: 0.6rem 0.75rem;
    }
    .page-title h1 { font-size: 1rem; }

    .lang-selector { gap: 1px; padding: 2px; }
    .lang-btn { padding: 4px 6px; font-size: 1rem; }
    .btn-icon { width: 32px; height: 32px; font-size: 0.8rem; }

    .chart-wrapper { height: 150px; }

    .data-table { min-width: 500px; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; font-size: 0.75rem; }

    .modal-card, .modal-card-lg { padding: 1rem; }
    .modal-header h3 { font-size: 0.95rem; }

    .login-card { padding: 1.5rem 1.25rem; }
    .login-header h1 { font-size: 1.4rem; }
    .brand-logo { font-size: 1.75rem; }

    .flex-justify h2 { font-size: 1.1rem; }

    .ticket-card { padding: 1rem; }
    .ticket-header { flex-direction: column; gap: 0.5rem; }
}

/* RTL responsive overrides */
@media (max-width: 768px) {
    [dir="rtl"] .sidebar {
        left: auto; right: 0;
        border-radius: 16px 0 0 16px;
        transform: translateX(110%);
    }
    [dir="rtl"] .sidebar.open { transform: translateX(0); }
    [dir="rtl"] .topbar, [dir="rtl"] .topbar-actions { flex-direction: row; }
}

/* ==========================================
   TURBO MODE & DISPLAY CUSTOMIZATION
   ========================================== */

/* ── Switch Toggle styling ── */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* ── Click Particles ── */
.click-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 10px currentColor;
    transition: transform 0.8s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.8s ease;
}

/* ── Turbo Mode Body & Background ── */
body.turbo-mode {
    background: #05020c;
    position: relative;
    overflow-x: hidden;
}
body.turbo-mode::before {
    content: "";
    position: fixed;
    top: -20%;
    left: -20%;
    width: 140vw;
    height: 140vh;
    background: radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 50% 15%, rgba(167, 139, 250, 0.1) 0%, transparent 50%);
    z-index: -2;
    pointer-events: none;
    animation: bgPulse 25s ease-in-out infinite alternate;
}
@keyframes bgPulse {
    0% { transform: scale(1) translate(0, 0) rotate(0deg); }
    50% { transform: scale(1.15) translate(4%, 3%) rotate(5deg); }
    100% { transform: scale(1) translate(-2%, 5%) rotate(-5deg); }
}

/* ── Liquid Glass Panel & Spotlight ── */
body.turbo-mode .glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background-image: radial-gradient(800px circle at var(--mx, 50%) var(--my, 50%), rgba(99, 102, 241, 0.12), transparent 45%);
    position: relative;
    overflow: hidden;
}
body.turbo-mode .glass-panel::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
    pointer-events: none;
}
body.turbo-mode .glass-panel:hover::before {
    left: 150%;
    transition: 0.8s ease-in-out;
}
body.turbo-mode .glass-panel:hover {
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 15px 45px 0 rgba(0, 0, 0, 0.7), 0 0 30px rgba(167, 139, 250, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.06);
    transform: translateY(-4px) scale(1.01);
}

/* ── Tab perspective entry ── */
body.turbo-mode .tab-content {
    animation: turboTabEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top center;
}
@keyframes turboTabEnter {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateX(-15deg) translateY(40px) scale(0.95);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: perspective(1000px) rotateX(0deg) translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* ── Neon Liquid Buttons ── */
body.turbo-mode .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #ec4899 100%);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3), 0 0 20px rgba(236, 72, 153, 0.2), inset 0 0 10px rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}
body.turbo-mode .btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}
body.turbo-mode .btn-primary:hover::before {
    left: 150%;
    transition: 0.7s;
}
body.turbo-mode .btn-primary:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6), 0 0 40px rgba(236, 72, 153, 0.5), inset 0 0 15px rgba(255,255,255,0.4);
    border-color: rgba(255, 255, 255, 0.3);
}
body.turbo-mode .btn-primary:active {
    transform: scale(0.95) translateY(1px);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4), 0 0 20px rgba(236, 72, 153, 0.3);
}

/* ── Metric card custom animations ── */
body.turbo-mode .metric-card {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}
body.turbo-mode .metric-card:hover {
    transform: translateY(-5px) scale(1.02);
}
body.turbo-mode .metric-card::after {
    content: "";
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    pointer-events: none;
}
body.turbo-mode .metric-card:hover::after {
    left: 120%;
    transition: 0.8s ease-in-out;
}

/* ── Sidebar interactive enhancements ── */
body.turbo-mode .sidebar-nav li {
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.2s ease, text-shadow 0.2s ease;
}
body.turbo-mode .sidebar-nav li:hover {
    transform: translateX(8px) scale(1.02);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    border-left: 3px solid var(--primary-color);
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    color: #fff;
}
body.turbo-mode .sidebar-nav li.active {
    border-left: 3px solid #ec4899;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.15) 0%, transparent 100%);
}

/* ── Status badges neon effects ── */
body.turbo-mode .status-badge.completed {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
    animation: glowPulseGreen 2s infinite alternate;
}
body.turbo-mode .status-badge.cancelled {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}
@keyframes glowPulseGreen {
    0% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.3); }
    100% { box-shadow: 0 0 15px rgba(34, 197, 94, 0.6); }
}

/* ── Table Rows Liquid Animation ── */
body.turbo-mode tbody tr {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
}
body.turbo-mode tbody tr:hover {
    transform: scale(1.01) translateX(5px);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2), inset 0 0 10px rgba(99, 102, 241, 0.1);
    z-index: 2;
}

/* ── Modal Liquid Glass Effect ── */
body.turbo-mode .modal-content {
    background: linear-gradient(135deg, rgba(15, 10, 30, 0.85) 0%, rgba(5, 2, 12, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.05);
    animation: modalLiquidEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalLiquidEnter {
    0% { opacity: 0; transform: translateY(30px) scale(0.95) perspective(1000px) rotateX(-10deg); filter: blur(5px); }
    100% { opacity: 1; transform: translateY(0) scale(1) perspective(1000px) rotateX(0deg); filter: blur(0px); }
}

/* ── Input Fields Neon Focus ── */
body.turbo-mode input, body.turbo-mode select, body.turbo-mode textarea {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
body.turbo-mode input:focus, body.turbo-mode select:focus, body.turbo-mode textarea:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 0 15px rgba(99, 102, 241, 0.4);
    border-color: rgba(99, 102, 241, 0.8);
    transform: translateY(-1px);
}

/* ==========================================
   TURBO MODE: LIGHT THEME OVERRIDES
   ========================================== */
[data-theme="light"] body.turbo-mode {
    background: #f0f4f8;
}
[data-theme="light"] body.turbo-mode::before {
    background: radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 50% 15%, rgba(167, 139, 250, 0.05) 0%, transparent 50%);
}

[data-theme="light"] body.turbo-mode .glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.45) 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 1);
    border-left: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05), inset 0 0 20px rgba(255, 255, 255, 0.5);
}
[data-theme="light"] body.turbo-mode .glass-panel:hover {
    box-shadow: 0 15px 45px 0 rgba(0, 0, 0, 0.1), 0 0 30px rgba(167, 139, 250, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 1);
}
[data-theme="light"] body.turbo-mode .glass-panel::before {
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.7), transparent);
}

[data-theme="light"] body.turbo-mode .modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 245, 250, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15), 0 0 30px rgba(99, 102, 241, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

[data-theme="light"] body.turbo-mode tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05), inset 0 0 10px rgba(99, 102, 241, 0.05);
}

[data-theme="light"] body.turbo-mode input, 
[data-theme="light"] body.turbo-mode select, 
[data-theme="light"] body.turbo-mode textarea {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
}
[data-theme="light"] body.turbo-mode input:focus, 
[data-theme="light"] body.turbo-mode select:focus, 
[data-theme="light"] body.turbo-mode textarea:focus {
    background: rgba(255, 255, 255, 0.9);
}

/* ==========================================
   TURBO MODE: MOBILE ADAPTATION
   ========================================== */
@media (max-width: 768px) {
    body.turbo-mode .glass-panel:hover,
    body.turbo-mode .btn-primary:hover,
    body.turbo-mode .metric-card:hover,
    body.turbo-mode .sidebar-nav li:hover,
    body.turbo-mode tbody tr:hover {
        transform: none !important;
    }
    
    body.turbo-mode .tab-content {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
        filter: none !important;
    }

    body.turbo-mode .modal-card,
    body.turbo-mode .modal-content,
    body.turbo-mode .modal {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    
    body.turbo-mode::before {
        animation: none !important;
    }
}
