/* ═══════════════════════════════════════════ */
/* 🎨 APP SHELL - Unified Design System        */
/* ═══════════════════════════════════════════ */

* { -webkit-tap-highlight-color: transparent; }

html, body {
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
    background: #F7F8FA;
    margin: 0;
    padding: 0;
}

/* ═══ CSS Variables ═══ */
:root {
    --fp-bg: #F7F8FA;
    --fp-surface: #FFFFFF;
    --fp-surface-2: #F2F4F7;
    --fp-border: #EAECEF;
    --fp-border-dark: #E0E3E8;
    --fp-primary: #FF5A1F;
    --fp-primary-dark: #E04A15;
    --fp-primary-light: #FFF4EE;
    --fp-primary-soft: #FFE8DC;
    --fp-text: #1A1F2E;
    --fp-text-2: #6B7280;
    --fp-text-3: #9CA3AF;
    --fp-text-light: #D1D5DB;
    --fp-success: #10B981;
    --fp-success-bg: #ECFDF5;
    --fp-warning: #F59E0B;
    --fp-warning-bg: #FFFBEB;
    --fp-danger: #EF4444;
    --fp-danger-bg: #FEF2F2;
    --fp-info: #3B82F6;
    --fp-info-bg: #EFF6FF;
    --fp-radius: 16px;
    --fp-radius-lg: 24px;
    --fp-radius-sm: 12px;
    --fp-radius-full: 100px;
    --fp-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --fp-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
    --fp-shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
    --fp-shadow-lg: 0 8px 32px rgba(16, 24, 40, 0.12);
    --fp-safe-bottom: env(safe-area-inset-bottom, 0px);
    --fp-safe-top: env(safe-area-inset-top, 0px);
    --fp-header-height: 64px;
    --fp-bottom-nav-height: 72px;
}

/* ═══ Base App Layout ═══ */
.fp-app {
    min-height: 100vh;
    background: var(--fp-bg);
    color: var(--fp-text);
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    direction: rtl;
    position: relative;
    overflow-x: hidden;
    padding-top: calc(var(--fp-header-height) + var(--fp-safe-top));
    padding-bottom: calc(var(--fp-bottom-nav-height) + var(--fp-safe-bottom) + 20px);
    -webkit-font-smoothing: antialiased;
}

.fp-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ═══ Typography ═══ */
.fp-h1 { font-size: 24px; font-weight: 900; color: var(--fp-text); letter-spacing: -0.5px; margin: 0 0 4px; }
.fp-h2 { font-size: 20px; font-weight: 900; color: var(--fp-text); letter-spacing: -0.3px; margin: 0 0 4px; }
.fp-h3 { font-size: 17px; font-weight: 800; color: var(--fp-text); margin: 0 0 4px; }
.fp-h4 { font-size: 15px; font-weight: 800; color: var(--fp-text); margin: 0 0 4px; }
.fp-text { font-size: 14px; color: var(--fp-text); line-height: 1.6; }
.fp-text-2 { font-size: 13px; color: var(--fp-text-2); line-height: 1.6; }
.fp-text-3 { font-size: 12px; color: var(--fp-text-3); line-height: 1.5; }
.fp-label { font-size: 12px; font-weight: 700; color: var(--fp-text-2); margin-bottom: 6px; display: block; }

/* ═══ Page Header ═══ */
.fp-page-header {
    position: sticky;
    top: calc(var(--fp-safe-top));
    z-index: 100;
    background: rgba(247, 248, 250, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--fp-border);
    padding: 12px 0;
    margin-bottom: 16px;
}

.fp-page-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fp-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    color: var(--fp-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: var(--fp-shadow-sm);
}
.fp-back-btn:active { transform: scale(0.9); background: var(--fp-primary-light); color: var(--fp-primary); border-color: var(--fp-primary); }

.fp-page-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--fp-text);
    margin: 0;
    letter-spacing: -0.3px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ═══ Cards ═══ */
.fp-card {
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    padding: 16px;
    box-shadow: var(--fp-shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-card-lg {
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-lg);
    padding: 20px;
    box-shadow: var(--fp-shadow-sm);
}

/* ═══ Buttons ═══ */
.fp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--fp-primary);
    color: #fff;
    border: none;
    border-radius: var(--fp-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 90, 31, 0.3);
    -webkit-tap-highlight-color: transparent;
}
.fp-btn:active { transform: scale(0.96); }
.fp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.fp-btn-block { width: 100%; }
.fp-btn-lg { padding: 14px 24px; font-size: 15px; }
.fp-btn-sm { padding: 8px 14px; font-size: 12.5px; }

.fp-btn-outline {
    background: transparent;
    color: var(--fp-primary);
    border: 1.5px solid var(--fp-primary);
    box-shadow: none;
}
.fp-btn-outline:active { background: var(--fp-primary-light); }

.fp-btn-ghost {
    background: var(--fp-surface);
    color: var(--fp-text);
    border: 1px solid var(--fp-border);
    box-shadow: var(--fp-shadow-sm);
}
.fp-btn-ghost:active { background: var(--fp-surface-2); }

.fp-btn-danger {
    background: var(--fp-danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ═══ Form Inputs ═══ */
.fp-input,
.fp-textarea,
.fp-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--fp-surface);
    border: 1.5px solid var(--fp-border);
    border-radius: var(--fp-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--fp-text);
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.fp-input::placeholder,
.fp-textarea::placeholder {
    color: var(--fp-text-3);
    font-weight: 500;
}

.fp-input:focus,
.fp-textarea:focus,
.fp-select:focus {
    border-color: var(--fp-primary);
    box-shadow: 0 0 0 4px var(--fp-primary-light);
}

.fp-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

.fp-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

.fp-form-group { margin-bottom: 16px; }

/* ═══ Badge ═══ */
.fp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
}

.fp-badge-primary { background: var(--fp-primary-light); color: var(--fp-primary); }
.fp-badge-success { background: var(--fp-success-bg); color: var(--fp-success); }
.fp-badge-warning { background: var(--fp-warning-bg); color: var(--fp-warning); }
.fp-badge-danger { background: var(--fp-danger-bg); color: var(--fp-danger); }
.fp-badge-info { background: var(--fp-info-bg); color: var(--fp-info); }

/* ═══ Divider ═══ */
.fp-divider {
    height: 1px;
    background: var(--fp-border);
    margin: 16px 0;
    border: none;
}

/* ═══ Empty State ═══ */
.fp-empty {
    text-align: center;
    padding: 50px 20px;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-lg);
}

.fp-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: var(--fp-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--fp-text-3);
}

.fp-empty-text { font-size: 15px; font-weight: 800; color: var(--fp-text); margin: 0 0 4px; }
.fp-empty-sub { font-size: 13px; color: var(--fp-text-2); margin: 0; font-weight: 500; }

/* ═══ Loading State ═══ */
.fp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--fp-text-3);
}

.fp-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--fp-primary-soft);
    border-top-color: var(--fp-primary);
    border-radius: 50%;
    animation: fp-spin 0.7s linear infinite;
}

@keyframes fp-spin { to { transform: rotate(360deg); } }

/* ═══ Skeleton ═══ */
.fp-skeleton {
    background: linear-gradient(90deg, var(--fp-surface-2) 25%, #E5E7EB 50%, var(--fp-surface-2) 75%);
    background-size: 200% 100%;
    animation: fp-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes fp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══ App Header (Top) ═══ */
.fp-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--fp-border);
    padding-top: var(--fp-safe-top);
    height: calc(var(--fp-header-height) + var(--fp-safe-top));
    display: flex;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-header.hidden { transform: translateY(-100%); }

.fp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0 16px;
}

.fp-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.fp-header-logo-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--fp-primary) 0%, #FF8C42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(255, 90, 31, 0.3);
}

.fp-header-logo-text {
    font-size: 19px;
    font-weight: 900;
    color: var(--fp-text);
    letter-spacing: -0.3px;
}

.fp-header-logo-text span { color: var(--fp-primary); }

.fp-header-spacer { flex: 1; }

.fp-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fp-header-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--fp-surface-2);
    border: 1px solid var(--fp-border);
    color: var(--fp-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    text-decoration: none;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}
.fp-header-btn:active {
    transform: scale(0.9);
    background: var(--fp-primary-light);
    border-color: var(--fp-primary);
    color: var(--fp-primary);
}

.fp-header-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--fp-primary);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 100px;
    min-width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(255, 90, 31, 0.4);
}

/* ═══ Bottom Navigation ═══ */
.fp-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--fp-bottom-nav-height) + var(--fp-safe-bottom));
    padding-bottom: var(--fp-safe-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-top: 1px solid var(--fp-border);
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.05);
}

.fp-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--fp-bottom-nav-height);
    padding: 4px 8px;
}

.fp-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--fp-text-3);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
}

.fp-nav-item i { font-size: 19px; transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.fp-nav-item span { font-size: 10px; font-weight: 700; transition: all 0.2s; }
.fp-nav-item:active { transform: scale(0.92); }
.fp-nav-item.active { color: var(--fp-primary); }
.fp-nav-item.active i { transform: scale(1.1); }
.fp-nav-item.active span { color: var(--fp-primary); font-weight: 800; }

.fp-nav-cart { position: relative; }

.fp-nav-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--fp-primary);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 100px;
    min-width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(255, 90, 31, 0.4);
}

/* ═══ Toast ═══ */
.fp-toast {
    position: fixed;
    bottom: calc(var(--fp-bottom-nav-height) + var(--fp-safe-bottom) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.9);
    background: var(--fp-text);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--fp-radius-full);
    font-weight: 700;
    font-size: 13px;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    max-width: 90vw;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.fp-toast.success { background: var(--fp-success); }
.fp-toast.error { background: var(--fp-danger); }

/* ═══ Ripple ═══ */
.fp-ripple { position: relative; overflow: hidden; }
.fp-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}
.fp-ripple.rippling::after { animation: fp-ripple-effect 0.6s ease-out; }
@keyframes fp-ripple-effect {
    0% { transform: scale(0) translate(-50%, -50%); opacity: 0.6; }
    100% { transform: scale(60) translate(-50%, -50%); opacity: 0; }
}

/* ═══ Splash ═══ */
.fp-splash {
    position: fixed;
    inset: 0;
    background: #FFFFFF;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.fp-splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.fp-splash-logo {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--fp-primary) 0%, #FF8C42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: 26px;
    box-shadow: 0 20px 40px rgba(255, 90, 31, 0.3);
    animation: fp-splash-bounce 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}
@keyframes fp-splash-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

.fp-splash-text { font-size: 22px; font-weight: 900; color: var(--fp-text); letter-spacing: -0.5px; }
.fp-splash-text span { color: var(--fp-primary); }

.fp-splash-loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--fp-primary-soft);
    border-top-color: var(--fp-primary);
    border-radius: 50%;
    animation: fp-spin 0.7s linear infinite;
}

/* ═══ Utilities ═══ */
.fp-hidden { display: none !important; }
.fp-flex { display: flex; }
.fp-flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fp-flex-center { display: flex; align-items: center; justify-content: center; }
.fp-flex-col { display: flex; flex-direction: column; }
.fp-gap-2 { gap: 8px; }
.fp-gap-3 { gap: 12px; }
.fp-gap-4 { gap: 16px; }
.fp-mt-2 { margin-top: 8px; }
.fp-mt-3 { margin-top: 12px; }
.fp-mt-4 { margin-top: 16px; }
.fp-mb-2 { margin-bottom: 8px; }
.fp-mb-3 { margin-bottom: 12px; }
.fp-mb-4 { margin-bottom: 16px; }

/* ═══ Dark Mode ═══ */
@media (prefers-color-scheme: dark) {
    :root {
        --fp-bg: #0F1115;
        --fp-surface: #1A1D23;
        --fp-surface-2: #232830;
        --fp-border: #2A2F38;
        --fp-border-dark: #353B45;
        --fp-text: #F9FAFB;
        --fp-text-2: #9CA3AF;
        --fp-text-3: #6B7280;
        --fp-text-light: #4B5563;
        --fp-primary-light: rgba(255, 90, 31, 0.15);
        --fp-primary-soft: rgba(255, 90, 31, 0.25);
        --fp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --fp-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        --fp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
        --fp-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
    
    html, body { background: #0F1115; }
    .fp-header, .fp-bottom-nav { background: rgba(15, 17, 21, 0.96); border-color: #2A2F38; }
    .fp-nav-badge, .fp-header-badge { border-color: #0F1115; }
    .fp-splash { background: #0F1115; }
    .fp-skeleton { background: linear-gradient(90deg, #232830 25%, #2A2F38 50%, #232830 75%); background-size: 200% 100%; }
}

/* ═══ Responsive ═══ */
@media (max-width: 380px) {
    .fp-container { padding: 0 14px; }
    .fp-header-inner { padding: 0 14px; }
}
/* ═══════════════════════════════════════════════════════════
   إجبار الوضع الليلي (Obsidian) على كل الصفحات
   ═══════════════════════════════════════════════════════════ */
body {
    background-color: #0A0B10 !important;
    color: #F5F1E8 !important;
}

.card, .section, .container-box, .box {
    background-color: #151824 !important;
    border-color: rgba(233, 211, 160, 0.12) !important;
}