@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: #F5730A;
    --primary-dark: #C4590A;
    --primary-light: #FF9A4D;
    --primary-soft: #FEF0E3;
    --dark: #10131A;
    --text-dark: #10131A;
    --text-grey: #6B7280;
    --background: #FFFFFF;
    --background-alt: #F5F7FB;
    --surface: #F5F7FB;
    --line: #E7EAF0;
    --danger: #E5342F;
    --success: #1CA361;
    --radius: 18px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    direction: rtl;
    font-family: 'Cairo', 'Tahoma', sans-serif;
    background: var(--background);
    color: var(--text-dark);
    min-height: 100%;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* -------------------- HEADER / NAVBAR -------------------- */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 19px;
    flex-shrink: 0;
}
.brand-name {
    font-weight: 900;
    font-size: 21px;
    letter-spacing: .3px;
    color: var(--dark);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: none;
    font-size: 18px;
}
.icon-btn:hover { background: var(--primary); color: #fff; }
.badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--background-alt);
    padding: 8px 14px;
    border-radius: 20px;
}
.user-chip .logout {
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
    margin-inline-start: 6px;
}

/* -------------------- HERO -------------------- */
.hero {
    background: linear-gradient(120deg, var(--primary-soft) 0%, #EFF3FE 100%);
    border-radius: var(--radius);
    padding: 44px 34px;
    margin: 22px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    overflow: hidden;
}
.hero-text h1 {
    font-size: 32px;
    font-weight: 900;
    color: var(--dark);
    line-height: 1.3;
    margin-bottom: 12px;
}
.hero-text p {
    color: var(--text-grey);
    font-size: 15px;
    margin-bottom: 22px;
    max-width: 380px;
}
.hero-btn {
    width: auto;
    display: inline-block;
    padding: 13px 34px;
    margin-top: 0;
}
.hero-badge {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 16px 32px rgba(245,115,10,0.28);
    letter-spacing: .5px;
}
@media (max-width: 620px) {
    .hero { padding: 30px 22px; }
    .hero-text h1 { font-size: 25px; }
    .hero-badge { width: 78px; height: 78px; font-size: 15px; }
}

/* -------------------- TRUST STRIP -------------------- */
.trust-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 22px 0;
}
.trust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.trust-item .trust-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.trust-item div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trust-item strong { font-size: 13px; color: var(--dark); }
.trust-item span { font-size: 11.5px; color: var(--text-grey); }
@media (max-width: 720px) {
    .trust-strip { grid-template-columns: repeat(2, 1fr); }
}

/* -------------------- SEARCH -------------------- */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--background-alt);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 12px 18px;
    gap: 10px;
    margin: 18px 0;
}
.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}
.search-bar .icon { color: var(--primary); }

/* -------------------- FLASH MESSAGES -------------------- */
.flash {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin: 14px 0;
    font-weight: 700;
    font-size: 14px;
}
.flash.error { background: #FDEAEA; color: var(--danger); }
.flash.success { background: #E7F6ED; color: var(--success); }

/* -------------------- PRODUCT GRID -------------------- */
.section-title {
    font-size: 21px;
    font-weight: 900;
    margin: 26px 0 16px;
    color: var(--dark);
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}
.product-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(16,19,26,0.09); }
.product-card .img-wrap {
    aspect-ratio: 1 / 1;
    background: var(--surface);
    overflow: hidden;
}
.product-card .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.product-card:hover .img-wrap img { transform: scale(1.05); }
.product-card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 38px;
}
.product-card .price { font-size: 16px; font-weight: 900; color: var(--primary); }
.product-card .stock-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--success);
    width: fit-content;
}
.product-card .out-tag {
    font-size: 11px;
    color: var(--danger);
    font-weight: 700;
}
.product-card .add-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 9px 0;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    margin-top: 6px;
    transition: background .15s ease;
}
.product-card .add-btn:disabled { background: #D8DBE2; }
.product-card .add-btn:hover:not(:disabled) { background: var(--primary-dark); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-grey);
}
.empty-state .icon { font-size: 48px; margin-bottom: 10px; }

/* -------------------- AUTH PAGES -------------------- */
.auth-wrap {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
}
.auth-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 34px 28px;
    border: 1px solid var(--line);
    box-shadow: 0 14px 34px rgba(16,19,26,0.08);
}
.auth-card.wide { max-width: 560px; }
.auth-logo {
    width: 78px;
    height: 78px;
    border-radius: 20px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 34px;
    color: #fff;
}
.auth-title {
    text-align: center;
    font-size: 22px;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 6px;
}
.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-grey);
    margin-bottom: 26px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-control {
    width: 100%;
    border: 1.5px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: border-color .15s ease;
}
.form-control:focus { border-color: var(--primary); }
select.form-control { appearance: none; background-image: none; }

.btn-primary {
    width: 100%;
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 14px 0;
    border-radius: 999px;
    font-weight: 800;
    font-size: 16px;
    margin-top: 6px;
    letter-spacing: .2px;
    box-shadow: 0 8px 18px rgba(245,115,10,0.25);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #D8DBE2; box-shadow: none; }
.btn-secondary {
    width: 100%;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--dark);
    padding: 12px 0;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-grey);
}
.auth-switch a { color: var(--primary); font-weight: 700; }

/* -------------------- PRODUCT DETAIL -------------------- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 26px;
}
@media (max-width: 720px) {
    .product-detail { grid-template-columns: 1fr; }
}
.gallery-main {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1/1;
    border: 1px solid var(--line);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.gallery-thumbs img {
    width: 64px; height: 64px; object-fit: cover; border-radius: 10px;
    border: 2px solid var(--line); cursor: pointer;
}
.gallery-thumbs img.active { border-color: var(--primary); }
.detail-name { font-size: 23px; font-weight: 900; margin-bottom: 8px; color: var(--dark); }
.detail-price { font-size: 27px; font-weight: 900; color: var(--primary); margin-bottom: 12px; }
.detail-desc { color: var(--text-grey); line-height: 1.85; margin-bottom: 18px; font-size: 15px;}
.qty-selector {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--background-alt);
    border-radius: 999px;
    padding: 8px 12px;
    width: fit-content;
    margin-bottom: 22px;
}
.qty-selector button {
    width: 34px; height: 34px; border-radius: 50%; border: none;
    background: var(--primary); font-size: 18px; font-weight: 700; color: #fff;
}
.qty-selector button:hover { background: var(--primary-dark); }
.qty-selector span { min-width: 24px; text-align: center; font-weight: 800; }

/* -------------------- CART -------------------- */
.cart-item {
    display: flex;
    gap: 14px;
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    align-items: center;
}
.cart-item .thumb {
    width: 80px; height: 80px; border-radius: 12px; overflow: hidden; flex-shrink: 0; background: var(--surface);
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .name { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.cart-item .unit-price { color: var(--text-grey); font-size: 13px; }
.cart-item .actions { display: flex; align-items: center; gap: 10px; }
.cart-item .qty-mini {
    display: flex; align-items: center; gap: 8px; background: var(--background-alt);
    border-radius: 999px; padding: 4px 8px;
}
.cart-item .qty-mini button { border: none; background: var(--primary); width: 26px; height: 26px; border-radius: 50%; font-weight: 700; color: #fff; }
.cart-item .qty-mini button:hover:not(:disabled) { background: var(--primary-dark); }
.cart-item .qty-mini button:disabled { background: #D8DBE2; }
.cart-item .remove-btn {
    border: 1.5px solid var(--danger);
    background: none;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    cursor: pointer;
}
.cart-item .remove-btn:hover { background: var(--danger); color: #fff; }
.cart-item .line-total { font-weight: 900; color: var(--dark); min-width: 80px; text-align: left; }

.cart-summary {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-top: 18px;
}
.cart-summary .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; color: var(--text-grey); }
.cart-summary .total-row { font-weight: 900; font-size: 19px; color: var(--dark); border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 12px; }

/* -------------------- CHECKOUT -------------------- */
.checkout-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; margin-top: 20px; }
@media (max-width: 800px) { .checkout-grid { grid-template-columns: 1fr; } }
.checkout-box, .order-review {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--line);
}
.order-review .item-row {
    display: flex; justify-content: space-between; font-size: 14px; padding: 9px 0; border-bottom: 1px solid var(--line);
}

/* -------------------- SUCCESS PAGE -------------------- */
.success-wrap {
    text-align: center;
    padding: 70px 16px;
}
.success-icon {
    width: 92px; height: 92px; border-radius: 50%; background: var(--primary); color: #fff;
    font-size: 42px; display: flex; align-items: center; justify-content: center; margin: 0 auto 22px;
    box-shadow: 0 12px 26px rgba(245,115,10,0.28);
}

footer.site-footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-grey);
    font-size: 13px;
    border-top: 1px solid var(--line);
    margin-top: 40px;
}

/* -------------------- طلباتي (MY ORDERS) -------------------- */
.order-card {
    display: block;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s, border-color .15s;
}
.order-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.06); border-color: var(--primary); }
.order-card-top {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.order-card-mid {
    display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--text-grey);
}
.order-total { font-weight: 900; color: var(--dark); }
.order-card-hint { margin-top: 8px; font-size: 12.5px; color: var(--primary); }
.order-date { font-size: 12.5px; color: var(--text-grey); }

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 800;
}

.order-detail-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px;
}