/* style.css — تصميم "One Million" الفاخر: كحلي داكن + ذهبي، RTL بالكامل
   مقتبس من التصميم المرجعي اللي بعته (كحلي #0b0e1c + ذهبي #f5c400) */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Playfair+Display:wght@700;900&display=swap');

:root {
    --gold: #f5c400;
    --gold-soft: rgba(245,196,0,0.1);
    --gold-glow: rgba(245,196,0,0.18);
    --bg: #0b0e1c;
    --panel: #0d1120;
    --card: #111629;
    --border: rgba(255,255,255,0.07);
    --border-strong: rgba(255,255,255,0.14);
    --text: #ffffff;
    --muted: rgba(255,255,255,0.45);
    --muted-soft: rgba(255,255,255,0.28);
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f97316;
    --radius: 12px;
    --shadow-gold: 0 4px 20px -4px rgba(245,196,0,0.15);
}

/* الوضع الفاتح — نفس نظام الألوان بس مقلوب، لسه ذهبي كلون أساسي */
[data-theme="light"] {
    --gold: #b8860b;
    --gold-soft: rgba(184,134,11,0.08);
    --gold-glow: rgba(184,134,11,0.15);
    --bg: #f4f5f7;
    --panel: #ffffff;
    --card: #ffffff;
    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.15);
    --text: #14161f;
    --muted: rgba(20,22,31,0.5);
    --muted-soft: rgba(20,22,31,0.32);
    --shadow-gold: 0 4px 20px -4px rgba(184,134,11,0.18);
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .sidebar, [data-theme="light"] .topbar { background: #ffffff; box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
[data-theme="light"] .stat-card, [data-theme="light"] .data-table-wrap, [data-theme="light"] .product-card,
[data-theme="light"] .auth-card { box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
[data-theme="light"] .sidebar nav a { color: rgba(20,22,31,0.6); }
[data-theme="light"] .badge-logo svg path { fill: #fff; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}
a { color: inherit; text-decoration: none; }
input, select, button { font-family: 'Cairo', sans-serif; }
input::placeholder { color: rgba(255,255,255,0.3); }
select option { background: var(--panel); color: #fff; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(245,196,0,0.25); border-radius: 3px; }

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    padding: 11px 22px; border-radius: 8px; font-weight: 800; font-size: 14px;
    cursor: pointer; border: none; transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gold); color: #000; box-shadow: 0 2px 10px -2px rgba(245,196,0,0.3); }
.btn-primary:hover { background: #ffd633; box-shadow: 0 4px 16px -2px rgba(245,196,0,0.5); }
.btn-outline { background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-strong); font-weight: 600; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; }

/* ---------- Landing ---------- */
.landing-hero {
    min-height: 100vh; position: relative; overflow: hidden;
    background: radial-gradient(ellipse at 50% 22%, #1b2d4f 0%, #0d1224 55%, #080b14 100%);
}
.landing-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 48px; position: relative; z-index: 10;
}
.landing-brand { color: var(--gold); font-weight: 900; font-size: 20px; letter-spacing: -0.5px; }
.landing-actions { display: flex; gap: 10px; }
.landing-center {
    display: flex; flex-direction: column; align-items: center;
    padding: 64px 40px 48px; text-align: center; position: relative; z-index: 5;
}
.landing-title {
    font-family: 'Playfair Display', serif; font-weight: 900; line-height: 0.9; letter-spacing: -3px;
}
.landing-title .line1 { font-size: clamp(64px, 11vw, 140px); color: var(--gold); }
.landing-title .line2 { font-size: clamp(64px, 11vw, 140px); color: #fff; }
.landing-divider { width: 80px; height: 2px; background: var(--gold); margin: 28px auto; }
.landing-sub1 { color: rgba(255,255,255,0.8); font-size: 17px; margin-bottom: 8px; }
.landing-sub2 { color: var(--gold); font-size: 16px; font-weight: 700; margin-bottom: 42px; }
.landing-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.landing-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    padding: 0 48px 60px; max-width: 1200px; margin: 0 auto;
}
.landing-stat {
    background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 12px;
    padding: 26px 16px; text-align: center;
}
.landing-stat .num { color: var(--gold); font-size: 26px; font-weight: 900; margin-top: 8px; }
.landing-stat .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
@media (max-width: 720px) { .landing-stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: radial-gradient(ellipse at 50% 15%, #1b2d4f 0%, #0d1224 55%, #080b14 100%); }
.auth-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    padding: 34px; width: 100%; max-width: 420px;
    position: relative; overflow: hidden; animation: fadeIn 0.4s ease;
    box-shadow: 0 20px 60px -20px rgba(0,0,0,0.5);
}
.auth-card::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.auth-card h2 { text-align: center; margin-bottom: 8px; color: var(--gold); font-weight: 900; }
label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="file"], select, textarea {
    width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: rgba(255,255,255,0.04); color: var(--text); font-size: 15px; font-family: 'Cairo', sans-serif;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
.auth-card label { margin: 14px 0 6px; }
.auth-card .btn { width: 100%; margin-top: 22px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-links a { color: var(--gold); font-weight: 700; }
.alert-error {
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.35); color: #ff9ca3;
    padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 13px;
}
.setup-icon { text-align: center; font-size: 30px; color: var(--gold); margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }

.sidebar { width: 210px; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand {
    padding: 16px 14px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.sidebar-brand .badge-logo {
    width: 38px; height: 38px; border-radius: 50%; background: var(--gold);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #000; font-weight: 900;
    box-shadow: 0 0 0 3px rgba(245,196,0,0.12);
}
.sidebar-brand .brand-text { text-align: right; }
.sidebar-brand .brand-text .name { color: var(--gold); font-weight: 900; font-size: 15px; letter-spacing: -0.3px; }
.sidebar-brand .brand-text .sub { color: rgba(255,255,255,0.35); font-size: 11px; margin-top: 1px; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px;
    color: rgba(255,255,255,0.65); font-size: 13.5px; font-weight: 600; transition: background 0.15s ease, color 0.15s ease, padding-right 0.15s ease;
    position: relative;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.04); color: #fff; padding-right: 16px; }
.sidebar nav a.active { background: var(--gold-soft); color: var(--gold); font-weight: 800; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-logout {
    margin: 10px 8px; padding: 9px 12px; border-top: 1px solid var(--border); padding-top: 14px;
    color: rgba(255,255,255,0.35); font-size: 13px; display: block;
}

.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
    height: 58px; background: var(--panel); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
    position: relative;
}
.topbar::after { content: ''; position: absolute; bottom: -1px; right: 0; width: 140px; height: 1px; background: linear-gradient(to left, var(--gold), transparent); opacity: 0.5; }
.topbar .brand { display: flex; align-items: center; gap: 8px; color: var(--gold); font-weight: 900; font-size: 16px; }
.topbar .user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; transition: background 0.15s ease; }
.topbar .user:hover { background: rgba(255,255,255,0.04); }
.topbar .user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; color: #000; font-weight: 800; transition: box-shadow 0.15s ease; }
.topbar .user:hover .avatar { box-shadow: 0 0 0 3px rgba(245,196,0,0.2); }

.content { flex: 1; overflow-y: auto; padding: 24px 26px; animation: fadeIn 0.3s ease; }
.content h1 { margin-bottom: 20px; font-size: 21px; font-weight: 800; letter-spacing: -0.3px; position: relative; padding-right: 12px; }
.content h1::before { content: ''; position: absolute; right: 0; top: 3px; bottom: 3px; width: 3px; background: var(--gold); border-radius: 2px; }

/* ---------- Stats / Cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-grid .stat-card { animation: fadeIn 0.35s ease backwards; }
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.06s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.10s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.14s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.18s; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; right: 0; width: 3px; height: 100%;
    background: var(--gold); opacity: 0; transition: opacity 0.2s ease;
}
.stat-card:hover { border-color: rgba(245,196,0,0.35); transform: translateY(-3px); box-shadow: var(--shadow-gold); }
.stat-card:hover::before { opacity: 1; }
.stat-card.wide { grid-column: 1 / -1; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-num { color: #fff; font-size: 28px; font-weight: 900; line-height: 1.1; }
.stat-card .stat-icon {
    width: 42px; height: 42px; background: var(--gold-soft); border-radius: 10px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--gold); font-size: 18px;
}

/* ---------- Tables ---------- */
.data-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 18px; text-align: right; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 14px; }
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: rgba(245,196,0,0.03); }
.data-table th { color: var(--gold); font-weight: 800; font-size: 11.5px; letter-spacing: 0.3px; background: rgba(245,196,0,0.03); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .empty { text-align: center; color: var(--muted); padding: 34px; }

.badge { display: inline-flex; align-items: center; padding: 4px 13px; border-radius: 20px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.2px; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.badge-active { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.badge-pending { background: rgba(245,196,0,0.12); color: var(--gold); border: 1px solid rgba(245,196,0,0.3); }
.badge-suspended { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.product-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.product-card:hover { border-color: rgba(245,196,0,0.35); transform: translateY(-3px); box-shadow: var(--shadow-gold); }
.product-card h3 { margin-bottom: 8px; font-size: 15px; font-weight: 800; }
.product-card p { color: var(--muted); font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.product-card .price { color: var(--gold); font-weight: 900; font-size: 16px; }

/* ---------- Search / filter bar ---------- */
.filter-bar {
    display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border-strong);
    border-radius: 10px; padding: 11px 16px; margin-bottom: 16px; transition: border-color 0.15s ease;
}
.filter-bar:focus-within { border-color: var(--gold); }
.filter-bar input, .filter-bar select {
    background: transparent !important; border: none !important; color: #fff; font-size: 14px; outline: none;
    padding: 0; width: auto; border-radius: 0;
}
.filter-bar input { flex: 1; }
.filter-bar select { padding: 6px 4px !important; background: rgba(255,255,255,0.05) !important; border-radius: 6px !important; }

/* ---------- Forms / misc ---------- */
.inline-form { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.inline-form input, .inline-form select {
    padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: rgba(255,255,255,0.04); color: var(--text);
}

.activity-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.activity-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px; }
.activity-item strong { color: var(--gold); font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }

.pill-list { list-style: none; display: flex; gap: 10px; flex-wrap: wrap; }
.pill-list li { border: 1px solid var(--border); border-right: 3px solid var(--gold); padding: 7px 16px; border-radius: 20px; background: var(--card); font-size: 13px; }

.page-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.page-actions .actions-left { display: flex; gap: 10px; }

/* ---------- Quick-view Modal ---------- */
.qv-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.qv-overlay.open { display: flex; }
.qv-box {
    background: var(--card); border: 1px solid var(--border-strong); border-radius: 16px;
    padding: 28px; width: 100%; max-width: 440px; position: relative; animation: fadeIn 0.2s ease;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}
.qv-box::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); border-radius: 16px 16px 0 0; }
.qv-close { position: absolute; top: 14px; left: 14px; background: rgba(255,255,255,0.06); border: none; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.qv-close:hover { background: rgba(255,255,255,0.12); }
.qv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; }
.qv-row:last-child { border-bottom: none; }
.qv-loading { text-align: center; padding: 30px; color: rgba(255,255,255,0.4); }

/* ---------- Mobile Responsive ---------- */
.mobile-menu-btn { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
    .app-shell { position: relative; }
    .sidebar {
        position: fixed; top: 0; right: 0; height: 100vh; width: 240px; z-index: 1001;
        transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -10px 0 30px rgba(0,0,0,0.4);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    }
    .sidebar-overlay.open { display: block; }
    .mobile-menu-btn { display: inline-flex; align-items: center; }
    .topbar { padding: 0 14px; }
    .topbar .brand span, .topbar .brand { font-size: 14px; }
    .content { padding: 16px 14px; }
    .content h1 { font-size: 18px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cards-grid { grid-template-columns: 1fr; }
    .page-actions { flex-direction: column; align-items: stretch; }
    .page-actions h1 { text-align: center; }
    .page-actions .actions-left { flex-wrap: wrap; justify-content: center; }
    .filter-bar { flex-wrap: wrap; }
    .filter-bar form { flex-wrap: wrap; }
    /* الجداول: سكرول أفقي بدل ما تتقطع أو تكسر التصميم */
    .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 640px; }
    /* الفورمات ذات العمودين تتحول لعمود واحد */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:2fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .auth-card { padding: 24px 20px; }
    .landing-title .line1, .landing-title .line2 { font-size: clamp(48px, 16vw, 90px); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .btn { padding: 10px 16px; font-size: 13px; }
}
