/* ======================================================== */
/* IQ Uruk User Dashboard - Main Stylesheet (SaaS Edition)  */
/* ======================================================== */

:root { 
    --primary: #0ea5e9;   
    --primary-hover: #0284c7;
    --bg-base: #020617;   
    --card-bg: rgba(15, 23, 42, 0.6); 
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

/* --------------------------------------------------- */
/* 1. حماية الشاشة (iOS Anti-Zoom & Anti-Scroll) */
/* --------------------------------------------------- */
html, body.user-body { 
    font-family: 'Cairo', sans-serif; 
    background-color: var(--bg-base);
    color: var(--text-main); 
    margin: 0; 
    padding: 0;
    width: 100vw;
    overflow-x: hidden;
    overscroll-behavior-x: none; /* يمنع السحب الأفقي في الآيفون */
    -webkit-tap-highlight-color: transparent;
}

/* حماية التداخل مع شريط التنقل السفلي في الآيفون */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* --------------------------------------------------- */
/* 2. الخلفية الفضائية المضيئة (Ambient Orbs) */
/* --------------------------------------------------- */
.bg-ambient {
    position: fixed; 
    top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
    background-color: var(--bg-base);
    overflow: hidden;
}
.bg-ambient::before, .bg-ambient::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.35;
    animation: floatOrb 20s infinite alternate ease-in-out;
}
.bg-ambient::before {
    width: 50vw; height: 50vw; background: #0ea5e9; top: -10%; left: -10%;
}
.bg-ambient::after {
    width: 40vw; height: 40vw; background: #3b82f6; bottom: -10%; right: -10%; animation-delay: -10s;
}
@keyframes floatOrb {
    100% { transform: translate(100px, 50px) scale(1.1); }
}

/* --------------------------------------------------- */
/* 3. العناصر الزجاجية (Glassmorphism) */
/* --------------------------------------------------- */
.glass-card {
    background: var(--card-bg); 
    backdrop-filter: blur(24px); 
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border); 
    border-radius: 24px; 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}

.glass-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* --------------------------------------------------- */
/* 4. الحقول والإدخالات (Inputs & Forms) */
/* --------------------------------------------------- */
input[type="text"], 
input[type="tel"], 
input[type="number"], 
input[type="email"], 
input[type="password"], 
textarea { 
    background: var(--input-bg) !important; 
    border: 1px solid rgba(255,255,255,0.1) !important; 
    color: var(--text-main) !important; 
    border-radius: 16px !important; 
    padding: 16px !important;
    transition: 0.3s ease; 
    width: 100%; 
}
input::placeholder, textarea::placeholder { 
    color: var(--text-muted) !important; 
    font-weight: 600; 
}
input:focus, textarea:focus { 
    border-color: var(--primary) !important; 
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25) !important; 
    outline: none; 
}

/* فحص المعرف اللحظي */
.id-input-wrapper { position: relative; }
.id-status-icon { 
    display: none; 
}

/* Toggle Switch (زر التفعيل والإيقاف السريع) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #10b981;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* --------------------------------------------------- */
/* 5. القائمة المنسدلة للملفات (Profile Dropdown) */
/* --------------------------------------------------- */
.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    transition: 0.3s;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.profile-dropdown-item:hover {
    background: rgba(255,255,255,0.05);
}
.profile-dropdown-item.active {
    background: rgba(14, 165, 233, 0.1);
    border-left: 3px solid var(--primary);
}

/* --------------------------------------------------- */
/* 6. تأثير رفع الصورة (الماء الصافي) */
/* --------------------------------------------------- */
.img-preview-wrapper { 
    position: relative; width: 100%; border-radius: 16px; overflow: hidden; 
    border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.4); display: none; 
}
.water-overlay { 
    position: absolute; bottom: 0; left: 0; width: 100%; height: 0%; 
    background: rgba(14, 165, 233, 0.3); backdrop-filter: blur(3px); z-index: 10; 
    transition: height 1s ease-in-out, opacity 0.5s ease-out; 
}
.water-overlay::before, .water-overlay::after { 
    content: ""; position: absolute; width: 200vw; height: 200vw; bottom: 95%; left: -50vw; 
    border-radius: 40%; animation: spin-wave 5s linear infinite; 
}
.water-overlay::before { background: rgba(56, 189, 248, 0.4); }
.water-overlay::after { background: rgba(2, 132, 199, 0.3); border-radius: 45%; animation: spin-wave 7s linear infinite; }
@keyframes spin-wave { 100% { transform: rotate(360deg); } }

/* --------------------------------------------------- */
/* 7. السحب والإفلات وتحديد الأوسمة/اللوجو */
/* --------------------------------------------------- */
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; color: var(--primary); }
.sortable-ghost { opacity: 0.3; background: rgba(14, 165, 233, 0.2); border-radius: 16px; }

/* بطاقات اختيار الوسام أو اللوجو */
.badge-selector-item, .logo-selector-item { 
    cursor: pointer; border: 2px solid transparent; transition: 0.2s; 
    background: rgba(255,255,255,0.05); border-radius: 12px; padding: 6px; 
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; 
}
.badge-selector-item.selected, .logo-selector-item:hover { 
    border-color: var(--primary); background: rgba(14, 165, 233, 0.1); transform: scale(1.1); 
}

/* --------------------------------------------------- */
/* 8. التبويبات وشريط التنقل (Tabs & Bottom Nav) */
/* --------------------------------------------------- */
.tab-item {
    transition: 0.3s;
    cursor: pointer;
}
.tab-item.active {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary) !important;
    box-shadow: inset 0 -2px 0 var(--primary);
}

@media (min-width: 1024px) {
    .tab-item.active {
        box-shadow: inset 3px 0 0 var(--primary);
        background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
    }
}

/* --------------------------------------------------- */
/* 9. كبسولات الروابط المطورة (Vertical Pill Card) */
/* --------------------------------------------------- */
.link-pill-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    transition: 0.3s;
}
.link-pill-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 12px;
    transition: 0.3s;
}
.link-pill-header.inactive {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* --------------------------------------------------- */
/* 10. بطاقات الثيمات المستطيلة (SaaS Theme Selector) */
/* --------------------------------------------------- */
.theme-btn-selector {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(30, 41, 59, 0.5);
}
.theme-btn-selector .theme-img-wrapper {
    position: relative;
    width: 100%;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.theme-btn-selector .theme-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
}
.theme-btn-selector img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    transition: transform 0.5s ease;
}
.theme-btn-selector:hover img {
    transform: scale(1.1);
}
.theme-btn-selector.selected {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.1);
}

/* --------------------------------------------------- */
/* 11. إطار الهاتف للمعاينة المدمجة (Inline Engine Mockup) */
/* --------------------------------------------------- */
.smartphone-mockup {
    border: 10px solid #0f172a; 
    border-radius: 40px; width: 100%; max-width: 340px; aspect-ratio: 9/19;
    margin: 0 auto; position: relative; background: #000; 
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), inset 0 0 0 2px rgba(255,255,255,0.1);
}
.mockup-layer-bg { position: absolute; inset: 0; z-index: 1; }
.mockup-layer-canvas { position: absolute; inset: 0; z-index: 2; display: none; pointer-events: none; }
.mockup-layer-content { position: absolute; inset: 0; z-index: 3; overflow-y: auto; scrollbar-width: none; }
.mockup-layer-content::-webkit-scrollbar { display: none; }
.mockup-notch { 
    position: absolute; top: 0; left: 50%; transform: translateX(-50%); 
    width: 120px; height: 25px; background: #0f172a; 
    border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; z-index: 50; 
}

/* --------------------------------------------------- */
/* 12. الستايلات الافتراضية داخل المعاينة */
/* --------------------------------------------------- */
#live-preview-content, #mobile-live-preview-content { 
    padding: 40px 20px 20px; text-align: center; min-height: 100%; display: flex; flex-direction: column; align-items: center; 
}
.theme-profile-img { width: 100px; height: 100px; object-fit: cover; margin: 0 auto 12px auto; display: block; border-radius: 50%; border: 2px solid rgba(255,255,255,0.1); }
.theme-name { font-size: 18px; font-weight: 900; color: white; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.theme-bio { font-size: 12px; color: rgba(255,255,255,0.7); margin-bottom: 24px; line-height: 1.5; padding: 0 10px; }
.theme-links-container { width: 100%; display: flex; flex-direction: column; gap: 12px; }

/* الروابط القابلة للنقر داخل المعاينة */
.theme-link-btn { 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    padding: 12px; 
    border-radius: 12px; 
    color: white; 
    text-decoration: none; 
    font-size: 13px; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    transition: 0.2s; 
    width: 100%;
    cursor: pointer;
}
.theme-link-btn:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }
.theme-link-logo { width: 20px; height: 20px; object-fit: contain; }

/* --------------------------------------------------- */
/* 13. شريط التمرير المخصص والأدوات المساعدة */
/* --------------------------------------------------- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.custom-scrollbar::-webkit-scrollbar { height: 6px; width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, 0.5); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(14, 165, 233, 0.8); }

/* Animations */
.fade-in-up { animation: fadeInUp 0.5s ease-out forwards; }
@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}