/* === المتغيرات والإعدادات الأساسية === */
:root {
    --primary: #C17817;
    --primary-dark: #8B4513;
    --primary-light: #D4A574;
    --secondary: #E8883C;
    --accent: #4ECDC4;
    --bg: #FAF6F1;
    --bg-card: #FFFFFF;
    --text: #2D2016;
    --text-light: #8B7355;
    --text-muted: #B8A692;
    --border: #E8DDD0;
    --success: #27AE60;
    --danger: #E74C3C;
    --shadow: 0 2px 12px rgba(139, 69, 19, 0.08);
    --shadow-lg: 0 8px 32px rgba(139, 69, 19, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xl: 24px;
    --phone-width: 390px;
    --phone-height: 844px;
    --nav-height: 70px;
    --header-height: 56px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    direction: rtl;
    overflow: hidden;
}

/* === إطار الجوال === */
.phone-container {
    position: relative;
    width: calc(var(--phone-width) + 24px);
    height: calc(var(--phone-height) + 24px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.phone-frame {
    position: relative;
    width: var(--phone-width);
    height: var(--phone-height);
    background: var(--bg);
    border-radius: 50px;
    overflow: hidden;
    box-shadow:
        0 0 0 3px #2D2016,
        0 0 0 6px #4a3728,
        0 0 0 8px #2D2016,
        0 20px 60px rgba(0, 0, 0, 0.5);
}

/* النوتش */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 34px;
    background: #2D2016;
    border-radius: 0 0 24px 24px;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.phone-notch::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    border-radius: 50%;
    border: 2px solid #333;
}

.phone-notch::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #1a1a1a;
    border-radius: 50%;
}

/* شريط الحالة */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 28px 6px;
    z-index: 99;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.status-bar .time {
    font-size: 14px;
    font-weight: 700;
}

.status-bar .icons {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* === محتوى التطبيق === */
.app-content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: clip;
    background: var(--bg);
}

/* === الصفحات === */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-30px);
    transition: var(--transition);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.page::-webkit-scrollbar {
    display: none;
}

.page.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.page.slide-out {
    opacity: 0;
    transform: translateX(30px);
}

/* padding للصفحات اللي فيها nav */
.page-with-nav {
    padding-bottom: calc(var(--nav-height) + 20px);
}

.page-with-header {
    padding-top: calc(var(--header-height) + 50px);
}

/* === شريط التنقل السفلي === */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 90;
    border-top: 1px solid var(--border);
    padding-bottom: 8px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.nav-item i {
    font-size: 20px;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-item span {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item.active i {
    color: var(--primary);
}

.nav-item.active span {
    color: var(--primary);
    font-weight: 700;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* بادج السلة */
.cart-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    display: none;
}

.cart-badge.show {
    display: flex;
    animation: popIn 0.3s ease;
}

/* === هيدر الصفحات الداخلية === */
.page-header {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    width: var(--phone-width);
    margin: 0 auto;
    height: var(--header-height);
    background: var(--bg);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 80;
    gap: 12px;
}

.page-header .back-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
    font-size: 16px;
}

.page-header .back-btn:active {
    transform: scale(0.92);
    background: var(--border);
}

.page-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

/* === أنيميشن === */
@keyframes popIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

/* === التكيف مع الشاشات === */
@media (max-width: 500px) {
    body {
        background: var(--bg);
        align-items: flex-start;
    }

    .phone-container {
        width: 100%;
        height: 100vh;
    }

    .phone-frame {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .phone-notch {
        width: 120px;
        height: 30px;
    }

    .page-header {
        width: 100%;
    }
}

/* === الخلفية المزخرفة === */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-decoration::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(193, 120, 23, 0.08) 0%, transparent 60%);
    border-radius: 50%;
}

.bg-decoration::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -30%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.06) 0%, transparent 60%);
    border-radius: 50%;
}
