/* /root/anifehras/frontend/css/components.css */
.icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--glass-bg); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; color: var(--text-sub); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

/* ===== HERO ===== */
.hero { text-align: center; padding: 50px 20px 40px; position: relative; }
.hero::before, .hero::after {
    content: ''; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
    filter: blur(70px); opacity: 0.32;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}
.hero::before { width: 340px; height: 340px; top: -80px; right: 6%; animation: aurora-a 16s ease-in-out infinite alternate; }
.hero::after  { width: 260px; height: 260px; bottom: -60px; left: 8%; animation: aurora-b 20s ease-in-out infinite alternate; }
@keyframes aurora-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(-40px, 30px) scale(1.12); } }
@keyframes aurora-b { from { transform: translate(0, 0) scale(1); } to { transform: translate(35px, -25px) scale(0.92); } }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; color: var(--text-main);
    margin-bottom: 24px; line-height: 1.35;
    background: linear-gradient(135deg, #ffffff 0%, color-mix(in srgb, var(--accent) 40%, #c0d0e0) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-stats { font-size: 14px; color: var(--text-sub); font-weight: 600; margin: -8px auto 22px; }
.hero-stats b { font-family: var(--font-display); color: var(--accent); font-weight: 700; font-size: 16px; }

.search-box { max-width: 600px; margin: 0 auto 24px; display: flex; align-items: center; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 50px; padding: 6px 8px 6px 6px; transition: border-color 0.3s, box-shadow 0.3s; }
.search-box:focus-within { border-color: var(--accent-border); box-shadow: 0 0 25px var(--accent-glow); }
.search-box input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text-main); font-family: var(--font-body); font-size: 16px; padding: 12px 18px; }
.search-box input::placeholder { color: var(--text-sub); opacity: 0.7; }
.search-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
.search-btn svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2.5; }
.search-btn:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
#search-clear-btn { background: none; border: none; cursor: pointer; padding: 4px 8px; color: var(--text-sub); font-size: 20px; line-height: 1; display: none; }
#search-clear-btn.visible { display: inline-block; }

/* ===== CHIPS (أزرار حقيقية) ===== */
.category-chips { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.chips-start { justify-content: flex-start; gap: 8px; margin-bottom: 15px; }
.chip { padding: 10px 22px; border-radius: 50px; background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-sub); font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 18px var(--accent-glow); }
.chip-tool { display: inline-flex; align-items: center; gap: 6px; }
#filter-badge { background: rgba(255,255,255,0.25); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 800; }
.chip:not(.active) #filter-badge { background: var(--accent); }

.category-bar { display: flex; gap: 10px; max-width: 600px; margin: 0 auto; justify-content: flex-start; padding: 4px 15px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.category-bar::-webkit-scrollbar { display: none; }
.cat-btn { flex: 0 0 auto; scroll-snap-align: start; padding: 10px 20px; border-radius: 50px; background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-sub); font-family: var(--font-body); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: all 0.25s ease; }
.cat-btn:hover { color: var(--text-main); border-color: var(--accent); }
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 22px var(--accent-glow); }

/* ===== SECTIONS ===== */
.section { margin: 30px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.section-title { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--text-main); }
.section-link { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; transition: opacity 0.2s; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.section-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.section-link:hover { opacity: 0.8; }

.app-scroll-container { overflow-x: auto; white-space: nowrap; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
.app-scroll-container::-webkit-scrollbar { height: 5px; }
.app-scroll-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.app-cards { display: inline-flex; gap: 16px; }
.app-card { display: inline-flex; align-items: center; gap: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 20px; padding: 16px 20px; min-width: 210px; white-space: normal; cursor: pointer; transition: all 0.25s; }
.app-card:hover { border-color: var(--accent-border); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,0.3); }
.app-icon { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, #1a2a40, #0f1a2e); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.06); overflow: hidden; }
.app-icon img { width: 100%; height: 100%; border-radius: 14px; object-fit: cover; }
.app-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.app-name { font-size: 14px; font-weight: 700; color: var(--text-main); }
.app-meta { font-size: 11px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; }

/* ===== ANIME CARDS ===== */
.anime-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.anime-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 20px; overflow: hidden; cursor: pointer; transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s; }
.anime-card:active { transform: scale(0.98); }
.anime-card.mini { min-width: 140px; max-width: 160px; flex: 0 0 auto; white-space: normal; }
.anime-poster { aspect-ratio: 3/4; background: linear-gradient(145deg, #131e30, #0a101e); position: relative; overflow: hidden; }
.anime-poster::after { content: 'ف'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 56px; color: rgba(255,255,255,0.07); z-index: 0; pointer-events: none; }
.anime-poster img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.fav-btn-card { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; color: #fff; transition: all 0.2s; }
.fav-btn-card:hover { background: rgba(0,0,0,0.8); transform: scale(1.1); }
.fav-btn-card.active { color: #ef4444; }
.fav-btn-card svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; pointer-events: none; }
.fav-btn-card:not(.active) svg { fill: none; }
.fav-btn-card.pop svg, .fav-btn-detail.pop svg { animation: fav-pop 0.35s ease; }
@keyframes fav-pop { 0% { transform: scale(1); } 45% { transform: scale(1.45); } 100% { transform: scale(1); } }
.anime-badge { position: absolute; top: 10px; right: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; z-index: 2; }
.relation-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; z-index: 2; backdrop-filter: blur(4px); }
.anime-details { padding: 14px 16px; }
.anime-title { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anime-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-sub); font-weight: 500; }
.anime-meta .dot { width: 4px; height: 4px; background: var(--text-sub); border-radius: 50%; align-self: center; }

.btn-open { background: var(--accent); border: none; color: #fff; font-family: var(--font-body); font-weight: 700; font-size: 13px; padding: 8px 18px; border-radius: 30px; cursor: pointer; transition: all 0.2s; letter-spacing: 0.3px; }
.btn-open:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); box-shadow: 0 4px 14px var(--accent-glow); }
.btn-pill { padding: 10px 35px; font-size: 15px; border-radius: 50px; }
.btn-ghost { background: rgba(255,255,255,0.08); margin-right: 10px; }
.btn-ghost:hover { background: rgba(255,255,255,0.14); box-shadow: none; }

/* ===== SKELETONS ===== */
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; border-radius: 12px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { border-radius: 18px; overflow: hidden; background: var(--glass-bg); border: 1px solid var(--glass-border); }
.skeleton-card.mini { min-width: 140px; max-width: 160px; flex-shrink: 0; }
.skeleton-poster { aspect-ratio: 3/4; width: 100%; }
.skeleton-title { height: 14px; margin: 10px 10px 6px; border-radius: 6px; }
.skeleton-meta { height: 10px; margin: 0 10px 10px; width: 60%; border-radius: 6px; }

/* ===== حالات فارغة ===== */
.empty-state { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { font-size: 42px; opacity: 0.8; }
.empty-title { font-size: 16px; font-weight: 800; color: var(--text-main); }
.empty-hint { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.grid-span { grid-column: 1 / -1; }

/* ===== خطأ فادح (فشل الاتصال) ===== */
.fatal-error { position: fixed; inset: 0; background: var(--bg-deep); z-index: 9998; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.fatal-error .empty-icon { font-size: 52px; }
.fatal-error h2 { font-family: var(--font-display); font-size: 22px; color: var(--text-main); }
.fatal-error p { font-size: 14px; color: var(--text-sub); max-width: 420px; line-height: 1.8; }

/* ===== TOAST ===== */
#toast-root { position: fixed; bottom: calc(var(--bottom-nav-height) + 20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: rgba(15, 25, 42, 0.95); border: 1px solid var(--accent-border); color: var(--text-main); font-size: 13.5px; font-weight: 700; padding: 11px 22px; border-radius: 50px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: toast-in 0.25s ease; max-width: 100%; text-align: center; }
.toast.hide { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ===== MODALS ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); z-index: 999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal { background: var(--glass-bg); backdrop-filter: blur(var(--blur-amount)); border: 1px solid var(--glass-border); border-radius: 24px; width: 90%; max-width: 580px; max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6); transform: translateY(20px); opacity: 0; transition: all 0.3s ease; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; overscroll-behavior: contain; }
.modal.show { transform: translateY(0); opacity: 1; }
.modal-close { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: var(--text-sub); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: all 0.2s; }
.modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.app-modal-header { display: flex; flex-direction: column; align-items: center; padding: 30px 24px 20px; text-align: center; position: relative; }
.app-modal-icon-wrapper { width: 80px; height: 80px; border-radius: 20px; background: linear-gradient(135deg, #1a2a40, #0f1a2e); display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); overflow: hidden; }
.app-modal-icon-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.app-modal-title { font-family: var(--font-display); font-size: 23px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.app-modal-platform { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 20px; }
.app-modal-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 4px; }
.app-modal-section { background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%); border: 1px solid rgba(255,255,255,0.05); border-top: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 14px 18px; margin: 0 24px 16px; box-shadow: 0 8px 20px rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 12px; }
.app-modal-section:not(#app-modal-lib-section) { flex-direction: row; align-items: center; justify-content: space-between; }
.app-modal-section-title { font-size: 13.5px; font-weight: 700; color: var(--text-sub); margin: 0; }
.app-content-types { display: flex; flex-wrap: wrap; gap: 8px; }
.app-content-chip { background: rgba(255, 255, 255, 0.05); padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text-main); border: 1px solid var(--glass-border); }
.app-modal-action { padding: 0 24px 30px; text-align: center; }
.app-modal-btn { display: inline-block; width: 100%; background: var(--accent); color: #fff; text-decoration: none; padding: 14px; border-radius: 16px; font-weight: 800; font-size: 16px; transition: all 0.2s; border: none; cursor: pointer; }
.app-modal-btn:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); transform: translateY(-2px); box-shadow: 0 8px 20px var(--accent-glow); }
.app-modal-btn.disabled { background: rgba(255,255,255,0.08); color: var(--text-sub); pointer-events: none; }

/* ===== قائمة التطبيقات (صفحة التطبيقات) ===== */
.apps-search { margin: 0 0 16px; max-width: 500px; }
.apps-list { display: flex; flex-direction: column; gap: 14px; }
.app-card-full { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: all 0.2s; cursor: pointer; }
.app-card-full:hover { border-color: var(--accent-border); background: rgba(255, 255, 255, 0.03); }
.app-card-left { display: flex; align-items: center; gap: 14px; }
.app-card-icon { width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, #1a2a40, #0f1a2e); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.06); overflow: hidden; }
.app-card-icon img { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; }
.app-card-details { flex: 1; }
.app-card-name { font-size: 18px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.app-card-type { font-size: 13px; color: var(--accent); font-weight: 600; }
.app-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-meta { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge-free { background: rgba(74, 222, 128, 0.15); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.badge-paid { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border-color: var(--accent-border); }
.ads-low   { background: rgba(74,222,128,0.15);  color: #4ade80; border-color: rgba(74,222,128,0.30); }
.ads-mid   { background: rgba(250,204,21,0.15);  color: #facc15; border-color: rgba(250,204,21,0.30); }
.ads-high  { background: rgba(248,113,113,0.15); color: #f87171; border-color: rgba(248,113,113,0.30); }
.offline-yes { background: rgba(56,189,248,0.15); color: #38bdf8; border-color: rgba(56,189,248,0.30); }
.kind-channel { background: rgba(56,189,248,0.15); color: #38bdf8; border-color: rgba(56,189,248,0.30); }
.kind-group   { background: rgba(168,85,247,0.15); color: #c084fc; border-color: rgba(168,85,247,0.30); }
.kind-members { background: rgba(255,255,255,0.06); color: var(--text-sub); border-color: var(--glass-border); }
.badge-abandoned { background: rgba(239, 68, 68, 0.15); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.community-description { font-size: 13px; color: var(--text-sub); line-height: 1.7; }
.community-list { display: flex; flex-direction: column; gap: 14px; }
.community-join-btn { align-self: flex-start; padding: 9px 26px; }

/* ===== الإحصائيات وصفحة "حول" ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.stat-card { padding: 18px 12px; text-align: center; transition: all 0.2s; }
.stat-card:hover { border-color: var(--accent-border); background: rgba(255, 255, 255, 0.03); }
.stat-icon { font-size: 22px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.settings-heading { font-size: 15px; font-weight: 700; color: var(--text-sub); margin-bottom: 12px; }
.settings-section { margin-bottom: 26px; }
.settings-list { display: flex; flex-direction: column; padding: 6px; }
.about-row { padding: 16px 14px; }
.about-text { font-size: 14px; line-height: 1.9; color: var(--text-sub); }
.sources-row { display: flex; flex-direction: column; gap: 12px; }
.source-line { display: flex; align-items: center; gap: 12px; }
.source-badge { color: #fff; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 8px; }
.source-name { color: var(--text-sub); font-size: 14px; }
.site-footer { text-align: center; font-size: 12px; color: var(--text-sub); opacity: 0.7; padding: 10px 0 30px; }

/* تأثير التحويم على الأجهزة التي تدعمه فقط */
@media (hover: hover) {
    .anime-card:hover { border-color: var(--accent-border); transform: translateY(-4px); box-shadow: 0 18px 35px rgba(0,0,0,0.4); }
}


.app-modal-btn.secondary { background: rgba(255,255,255,0.06); color: var(--text-main); border: 1px solid var(--glass-border); margin-top: 8px; }
.app-modal-btn.secondary:hover { background: rgba(255,255,255,0.1); box-shadow: none; }



/* v8: kart altindaki Arapca baslik */
/* v16: Arapca baslik ARTIK KISALTILMIYOR (Kisayaro karari).
   Eskiden nowrap+ellipsis ile tek satira sikistirilip "..." ile kesiliyordu. */
.anime-title-ar { font-size: 12px; color: var(--text-sub); margin-top: 2px;
    white-space: normal; word-break: break-word; line-height: 1.5; }
.anime-card.mini .anime-title-ar { font-size: 11px; }
/* v9: kategori gecisinde yukleniyor cizgisi */
.discovery-loading { height: 150px; border-radius: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,.04) 25%,
        rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%);
    background-size: 200% 100%; animation: disc-shimmer 1.2s infinite; }
@keyframes disc-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }