/* ============================================================
   متجر الريان | Al-Rayan Store
   لوحة الألوان: أخضر زمردي عميق + ذهبي دافئ + كريمي فاتح
   خط العرض: Cairo (متعدد الأوزان، يدعم العربية والإنجليزية)
   ============================================================ */

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

:root {
    --emerald-950: #0B3B2E;
    --emerald-800: #114F3E;
    --emerald-700: #16614C;
    --gold: #C9A24B;
    --gold-light: #E4C976;
    --cream: #FBF7EF;
    --cream-deep: #F3EBD8;
    --ink: #1E1C16;
    --ink-soft: #57534A;
    --line: #E4DAC4;
    --danger: #B23A3A;
    --success: #2F7D5A;
    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-soft: 0 1px 2px rgba(30,28,22,.06);
    --container: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background: var(--cream);
    color: var(--ink);
    line-height: 1.7;
    font-size: 16px;
}

[dir="rtl"] body { letter-spacing: 0; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== الأزرار | Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    font-weight: 700;
    font-size: 15px;
    transition: all .18s ease;
    cursor: pointer;
}
.btn-primary { background: var(--emerald-800); color: #fff; }
.btn-primary:hover { background: var(--emerald-950); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border-color: var(--emerald-800); color: var(--emerald-800); }
.btn-outline:hover { background: var(--emerald-800); color: #fff; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* ==================== الهيدر | Header ==================== */
.topbar {
    background: var(--emerald-950);
    color: #E9E2CC;
    font-size: 13px;
}
.topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
}
.topbar a { opacity: .9; }
.topbar a:hover { color: var(--gold-light); }
.lang-switch { display: flex; gap: 10px; align-items: center; }
.lang-switch a.active { color: var(--gold-light); font-weight: 700; }

.main-header {
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.main-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 20px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 800;
    font-size: 26px;
    color: var(--emerald-950);
}
.brand .mark {
    color: var(--gold);
    font-size: 30px;
    line-height: 1;
}
.brand small { font-size: 12px; color: var(--ink-soft); font-weight: 500; }

.search-form {
    flex: 1;
    max-width: 460px;
    display: flex;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}
.search-form input {
    flex: 1;
    border: none;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    outline: none;
}
.search-form button {
    border: none;
    background: var(--emerald-800);
    color: #fff;
    padding: 0 18px;
}
.search-form button:hover { background: var(--emerald-950); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}
.header-actions .icon-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    gap: 3px;
    color: var(--ink);
}
.header-actions .icon-link:hover { color: var(--emerald-800); }
.header-actions svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.cart-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -10px;
    background: var(--gold);
    color: var(--ink);
    font-size: 10px;
    font-weight: 800;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-nav {
    background: var(--emerald-800);
}
.main-nav ul {
    display: flex;
    gap: 4px;
    padding: 0 20px;
    overflow-x: auto;
}
.main-nav a {
    display: block;
    color: #EFEADA;
    padding: 12px 16px;
    font-size: 14.5px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.main-nav a:hover, .main-nav a.active {
    color: #fff;
    border-bottom-color: var(--gold);
    background: rgba(255,255,255,.04);
}

/* ==================== قائمة الجوال | Mobile menu toggle ==================== */
.mobile-toggle { display: none; background: none; border: none; padding: 6px; }
.mobile-toggle svg { width: 26px; height: 26px; stroke: var(--emerald-950); fill: none; stroke-width: 1.8; }

/* ==================== الهيرو | Hero ==================== */
.hero {
    background: linear-gradient(135deg, var(--emerald-950), var(--emerald-700));
    color: #fff;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 20%, rgba(201,162,75,.28), transparent 55%);
}
.hero .container {
    position: relative;
    padding: 64px 20px;
    text-align: center;
    max-width: 680px;
}
.hero h1 {
    font-size: 38px;
    font-weight: 800;
    margin: 0 0 14px;
}
.hero p {
    font-size: 17px;
    color: #DCE5DD;
    margin: 0 0 28px;
}

/* ==================== عناوين الأقسام | Section titles ==================== */
.section { padding: 46px 0; }
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.section-head h2 {
    font-size: 23px;
    font-weight: 800;
    color: var(--emerald-950);
    margin: 0;
    position: relative;
    padding-inline-start: 14px;
    border-inline-start: 4px solid var(--gold);
}
.section-head a { font-size: 14px; font-weight: 700; color: var(--emerald-800); }
.section-head a:hover { color: var(--gold); }

/* ==================== الأقسام (كاردات) | Category cards ==================== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.cat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 22px 14px;
    text-align: center;
    transition: transform .15s ease, border-color .15s ease;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.cat-card .ic {
    width: 50px; height: 50px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--cream-deep);
    display: flex; align-items: center; justify-content: center;
    color: var(--emerald-800);
}
.cat-card .ic svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.cat-card span { font-weight: 700; font-size: 14.5px; }

/* ==================== شبكة المنتجات | Product grid ==================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.product-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s ease, border-color .18s ease;
}
.product-card:hover { border-color: var(--gold); box-shadow: 0 8px 20px rgba(11,59,46,.08); }
.product-card .thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--cream-deep);
    overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .badge-sale {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    background: var(--gold);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 20px;
}
.product-card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; flex: 1; }
.product-card .cat-label { font-size: 11.5px; color: var(--ink-soft); margin-bottom: 4px; }
.product-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px;
    min-height: 42px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-card h3 a:hover { color: var(--emerald-800); }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.price-now { font-weight: 800; color: var(--emerald-800); font-size: 16px; }
.price-old { text-decoration: line-through; color: #A79E86; font-size: 13px; }
.product-card .add-form { margin-top: auto; }
.add-btn {
    width: 100%;
    background: var(--emerald-800);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.add-btn:hover { background: var(--emerald-950); }
.add-btn:disabled { background: #C9C2AD; cursor: not-allowed; }

/* ==================== صفحة المنتج | Product page ==================== */
.product-view { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; padding: 40px 0; }
.product-view .gallery img {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    aspect-ratio: 1/1;
    object-fit: cover;
}
.product-view h1 { font-size: 26px; font-weight: 800; margin: 0 0 10px; color: var(--emerald-950); }
.product-view .stock-tag { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; margin-bottom: 16px; }
.stock-tag.in { background: #E4F2E9; color: var(--success); }
.stock-tag.out { background: #F6E6E6; color: var(--danger); }
.product-view .price-block { font-size: 28px; font-weight: 800; color: var(--emerald-800); margin-bottom: 18px; display: flex; gap: 12px; align-items: baseline; }
.product-view .desc { color: var(--ink-soft); margin-bottom: 26px; }
.qty-box { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; width: fit-content; }
.qty-box button { background: var(--cream-deep); border: none; width: 38px; height: 40px; font-size: 18px; font-weight: 700; }
.qty-box input { width: 54px; text-align: center; border: none; border-inline: 1px solid var(--line); height: 40px; font-family: inherit; font-weight: 700; }
.buy-actions { display: flex; gap: 12px; margin-top: 22px; }

/* ==================== الفوتر | Footer ==================== */
.site-footer { background: var(--emerald-950); color: #CFE0D6; margin-top: 60px; }
.site-footer .container { padding: 44px 20px 20px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.site-footer ul li { margin-bottom: 8px; }
.site-footer a { font-size: 13.5px; color: #B7C9BE; }
.site-footer a:hover { color: var(--gold-light); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); text-align: center; padding: 16px 20px; font-size: 12.5px; color: #93A99B; }

/* ==================== نماذج عامة | Forms ==================== */
.auth-wrap { max-width: 440px; margin: 50px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 34px; }
.auth-wrap h1 { font-size: 22px; font-weight: 800; margin: 0 0 4px; color: var(--emerald-950); }
.auth-wrap .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14.5px;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--emerald-700); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-soft); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; }
.alert-error { background: #F9E9E9; color: var(--danger); border: 1px solid #EFC9C9; }
.alert-success { background: #E4F2E9; color: var(--success); border: 1px solid #BFE0CD; }

/* ==================== جدول السلة | Cart table ==================== */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px; text-align: start; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.cart-table th { background: var(--cream-deep); font-weight: 700; color: var(--ink); }
.cart-row-product { display: flex; align-items: center; gap: 12px; }
.cart-row-product img { width: 58px; height: 58px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.cart-summary { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px; }
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 14.5px; }
.cart-summary .row.grand { font-weight: 800; font-size: 18px; color: var(--emerald-950); border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 6px; }
.cart-layout { display: grid; grid-template-columns: 2.1fr 1fr; gap: 24px; align-items: start; }

/* ==================== الدفع | Checkout ==================== */
.checkout-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; align-items: start; }
.checkout-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 24px; margin-bottom: 20px; }
.checkout-box h3 { margin: 0 0 18px; font-size: 16.5px; font-weight: 800; color: var(--emerald-950); display: flex; align-items: center; gap: 8px; }
.pay-options { display: flex; gap: 12px; margin-bottom: 18px; }
.pay-option { flex: 1; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 14px; }
.pay-option.selected { border-color: var(--emerald-700); background: #F1F7F3; }
.order-line { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.notice-box { background: var(--cream-deep); border: 1px dashed var(--gold); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }

/* ==================== الملف الشخصي | Profile ==================== */
.profile-layout { display: grid; grid-template-columns: 230px 1fr; gap: 26px; }
.profile-menu { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; height: fit-content; }
.profile-menu a { display: block; padding: 14px 18px; font-weight: 700; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.profile-menu a:last-child { border-bottom: none; }
.profile-menu a.active, .profile-menu a:hover { background: var(--emerald-800); color: #fff; }
.profile-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 26px; }
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th, .orders-table td { padding: 12px; text-align: start; border-bottom: 1px solid var(--line); font-size: 14px; }
.status-pill { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.status-processing { background: #FFF3D6; color: #9A6B00; }
.status-shipped { background: #DCEBFB; color: #1D5C9C; }
.status-delivered { background: #E4F2E9; color: var(--success); }
.status-cancelled { background: #F9E9E9; color: var(--danger); }

/* ==================== لوحة التحكم | Admin panel ==================== */
.admin-body { background: #F4F1E9; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--emerald-950); color: #E9E2CC; flex-shrink: 0; }
.admin-sidebar .brand-a { padding: 22px 20px; font-size: 20px; font-weight: 800; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 8px; }
.admin-sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 13px 20px; font-size: 14.5px; font-weight: 600; color: #C9D6CD; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.06); color: #fff; border-inline-start: 3px solid var(--gold); }
.admin-main { flex: 1; padding: 26px 30px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-topbar h1 { font-size: 22px; font-weight: 800; color: var(--emerald-950); margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; }
.stat-card .label { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.stat-card .value { font-size: 24px; font-weight: 800; color: var(--emerald-950); }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px; margin-bottom: 22px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; text-align: start; border-bottom: 1px solid var(--line); font-size: 13.8px; vertical-align: middle; }
.admin-table th { background: var(--cream-deep); font-weight: 700; }
.admin-table img.thumb-sm { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.table-actions { display: flex; gap: 8px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill-yes { background: #E4F2E9; color: var(--success); }
.pill-no { background: #F1F1EA; color: #8A8371; }

/* ==================== تنبيه سعة الشاشة | Responsive ==================== */
@media (max-width: 980px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .product-view { grid-template-columns: 1fr; }
    .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .site-footer .container { grid-template-columns: 1fr 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-sidebar { position: fixed; inset-inline-start: -260px; top: 0; bottom: 0; z-index: 100; transition: inset-inline-start .2s; }
    .admin-sidebar.open { inset-inline-start: 0; }
    .admin-main { width: 100%; }
}

@media (max-width: 640px) {
    .hero h1 { font-size: 27px; }
    .search-form { display: none; }
    .main-nav ul { justify-content: flex-start; }
    .mobile-toggle { display: block; }
    .header-actions .label { display: none; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .form-row { grid-template-columns: 1fr; }
    .site-footer .container { grid-template-columns: 1fr; text-align: center; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .checkout-layout { grid-template-columns: 1fr; }
    .pay-options { flex-direction: column; }
    table { font-size: 12.5px; }
}
