/* ============================================================
   PhoneX - ملف التنسيقات المشتركة
   الثيم: داكن نيلي + ذهبي — Option B
   ============================================================ */

:root {
    /* ===== Palette الألوان الأساسية (4 بس) ===== */
    --navy:       #1a1a2e;   /* هيدر / فوتر / خلفية داكنة   */
    --navy-mid:   #16213e;   /* ظلال / hover داكن            */
    --gold:       #e8a923;   /* أزرار / تمييز / لوجو         */
    --gold-dark:  #c8891a;   /* hover على الذهبي             */
    --bg:         #f4f4f4;   /* خلفية الصفحة                 */
    --img-bg:     #f0ece4;   /* خلفية بوكس الصورة (بيج فاتح) */
    --green:      #28a745;   /* متوفر / نجاح                 */
    --red:        #dc3545;   /* خطأ / نفذت                   */
    --text:       #1a1a2e;
    --text-muted: #666;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

/* ============ الهيدر ============ */
.site-header {
    background-color: var(--navy);
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    color: var(--gold);
    font-size: 21px;
    font-weight: bold;
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.search-container {
    flex: 1 1 200px;
    min-width: 140px;
    order: 2;
}

.search-container input {
    width: 100%;
    padding: 9px 15px;
    font-size: 14px;
    border: 1px solid #2e2e4a;
    background-color: #16213e;
    color: white;
    border-radius: 20px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s;
}

.search-container input::placeholder { color: #888; }

.search-container input:focus {
    border-color: var(--gold) !important;
    background-color: #1e2a45 !important;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    order: 3;
    margin-right: auto;
    flex-shrink: 0;
}

.main-nav a {
    color: #aaa;
    text-decoration: none;
    font-size: 14.5px;
    white-space: nowrap;
    transition: color 0.2s;
}

.main-nav a:hover,
.main-nav a.active { color: var(--gold); }

.main-nav a.cart-link { color: white; font-weight: bold; }

.cart-count {
    background: var(--gold);
    color: var(--navy);
    padding: 2px 7px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    margin-right: 3px;
}

.categories-bar {
    display: flex;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding: 8px 16px 10px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 1200px;
    margin: 0 auto;
}

.categories-bar::-webkit-scrollbar { height: 3px; }
.categories-bar::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 10px; }

.cat-btn {
    padding: 6px 16px;
    font-size: 13px;
    border: 1px solid #2e2e4a;
    background-color: #16213e;
    color: #aaa;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.25s;
    flex-shrink: 0;
}

.cat-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.cat-btn.active-cat {
    background-color: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}

/* موبايل */
@media (max-width: 600px) {
    .navbar { justify-content: center; }
    .search-container { order: 4; flex: 1 1 100%; }
    .main-nav { order: 3; width: 100%; justify-content: center; margin-right: 0; gap: 14px; }
    .main-nav a { font-size: 13.5px; }
    .logo { font-size: 19px; }
}

/* ============ شبكة المنتجات ============ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 18px;
    padding: 18px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== ألوان الأقسام — كلها من عائلة الذهبي/الدافئ ===== */
:root {
    --color-cases:      #e8a923;   /* ذهبي */
    --color-headphones: #c0762a;   /* نحاسي */
    --color-watches:    #b8860b;   /* ذهبي داكن */
    --color-chargers:   #d4a853;   /* ذهبي فاتح */
    --color-default:    #e8a923;
}

.product-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(26,26,46,0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid #ede8de;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(26,26,46,0.14);
}

/* شريط ذهبي أعلى كل كارت */
.product-card::before {
    content: '';
    display: block;
    height: 4px;
    width: 100%;
    background: var(--card-accent, var(--color-default));
    flex-shrink: 0;
}

/* بوكس الصورة ببيج فاتح يلائم صور البيج والأبيض */
.product-card .img-wrap {
    background: var(--img-bg);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 170px;
    overflow: hidden;
}

.product-card .img-wrap img {
    max-width: 100%;
    max-height: 138px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .img-wrap img { transform: scale(1.06); }

.product-card .card-body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.product-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
    line-height: 1.45;
    min-height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* تاق القسم */
.category-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    width: fit-content;
}

.price-tag {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}

.price-tag span {
    font-size: 12px;
    font-weight: 500;
    color: #888;
}

.stock-badge { font-size: 12px; font-weight: 600; }
.stock-badge.in  { color: var(--green); }
.stock-badge.out { color: var(--red); }

/* زرار ذهبي */
.add-to-cart-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    border: none;
    padding: 11px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 800;
    font-size: 13.5px;
    width: 100%;
    transition: opacity 0.2s, transform 0.15s;
}

.add-to-cart-btn:hover:not(:disabled) {
    opacity: 0.88;
    transform: scale(1.02);
}

.add-to-cart-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.detail-link {
    display: block;
    text-align: center;
    font-size: 12.5px;
    color: var(--gold-dark);
    text-decoration: none;
    padding: 3px 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.detail-link:hover { opacity: 1; text-decoration: underline; }

@media (min-width: 480px) {
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .product-card .img-wrap { height: 185px; }
}

@media (min-width: 900px) {
    .product-card .img-wrap { height: 200px; }
}

/* ============ الفوتر ============ */
.site-footer {
    background: var(--navy);
    color: #888;
    text-align: center;
    padding: 22px 20px;
    margin-top: 30px;
    font-size: 13px;
    border-top: 2px solid var(--gold-dark);
}

.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ============ التوست ============ */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 12px 22px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 2000;
    font-weight: bold;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    max-width: 90vw;
    text-align: center;
}

.toast.show { opacity: 1; bottom: 30px; }
.toast.toast-success { background-color: var(--navy); border: 2px solid var(--gold); color: var(--gold); }
.toast.toast-error   { background-color: var(--red); }