:root {
    --bg-primary: #0b0e14;
    --bg-secondary: #111827;
    --bg-card: #161f2e;
    --bg-elevated: #1a2332;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --gradient-1: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --gradient-2: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --gradient-3: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --radius: 16px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

:focus-visible {
    outline: 2px solid var(--accent-purple);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    inset-inline-start: -9999px;
    top: 8px;
    background: var(--accent-purple);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    z-index: 300;
}
.skip-link:focus { inset-inline-start: 8px; }

/* ===== Layout ===== */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-inline-end: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    inset-inline-start: 0; top: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header { padding: 0 12px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }

.logo { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; text-decoration: none; }
.logo-icon {
    width: 40px; height: 40px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.nav-item a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px; font-weight: 500;
    transition: var(--transition);
}
.nav-item a:hover, .nav-item a.active { background: var(--bg-card); color: var(--text-primary); }
.nav-item a.active {
    background: linear-gradient(90deg, rgba(168,85,247,0.15) 0%, transparent 100%);
    border-inline-start: 2px solid var(--accent-purple);
}
.nav-icon { width: 20px; height: 20px; opacity: 0.75; flex-shrink: 0; }

.sidebar-footer { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--border); }
.sidebar-footer p { font-size: 12px; color: var(--text-muted); text-align: center; }

.main-content {
    flex: 1;
    margin-inline-start: 260px;
    padding: 32px 40px;
    max-width: calc(100% - 260px);
}

.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-title {
    font-size: 28px; font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-box { position: relative; width: 320px; }
.search-box input {
    width: 100%;
    padding: 12px 16px;
    padding-inline-start: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit; font-size: 14px;
    outline: none; transition: var(--transition);
}
.search-box input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(168,85,247,0.1); }
.search-box input::placeholder { color: var(--text-muted); }
.search-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 18px; height: 18px; }

/* ===== Breadcrumb ===== */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-purple); }
.breadcrumb span { margin: 0 6px; opacity: 0.5; }

/* ===== Hero ===== */
.hero {
    background:
        radial-gradient(700px 260px at 90% -10%, rgba(168,85,247,0.20), transparent 70%),
        radial-gradient(600px 240px at 10% 110%, rgba(6,182,212,0.14), transparent 70%),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 36px;
    margin-bottom: 40px;
}
.hero h2 { font-size: 32px; font-weight: 800; line-height: 1.35; margin-bottom: 14px; }
.hero p { color: var(--text-secondary); font-size: 16px; max-width: 640px; margin-bottom: 12px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 15px; font-weight: 700;
    text-decoration: none; cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-elevated); color: var(--text-primary);
    transition: var(--transition);
}
.btn:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.btn-primary { background: var(--gradient-1); border-color: transparent; color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(168,85,247,0.3); }

/* ===== Sections ===== */
.section-header { margin-bottom: 22px; }
.section-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.section-header p { color: var(--text-secondary); font-size: 15px; }
.block { margin-bottom: 48px; }

/* ===== Cards grid ===== */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.apps-grid.featured { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
}
.app-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient-1); opacity: 0; transition: var(--transition);
}
.app-card:hover { transform: translateY(-6px); border-color: var(--border-hover); box-shadow: var(--shadow-lg); }
.app-card:hover::before { opacity: 1; }

.app-card-image {
    width: 100%; height: 150px;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.app-icon-placeholder {
    width: 64px; height: 64px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; color: #fff;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}
.app-card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.app-card-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.app-card-desc {
    font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.app-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }

.platform-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.platform-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.platform-badge.android { color: var(--accent-green); border-color: rgba(16,185,129,0.3); }
.platform-badge.huawei { color: var(--accent-pink); border-color: rgba(236,72,153,0.3); }
.platform-badge.amazon { color: var(--accent-orange); border-color: rgba(245,158,11,0.3); }
.platform-badge.web { color: var(--accent-cyan); border-color: rgba(6,182,212,0.3); }

.status-tag { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.status-tag.live { color: var(--accent-green); }
.status-tag.soon { color: var(--accent-orange); }

/* ===== Filters ===== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-btn {
    padding: 8px 18px; border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    font-family: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active { background: var(--gradient-1); color: #fff; border-color: transparent; }

.empty-state { color: var(--text-muted); padding: 30px 0; font-size: 15px; }

/* ===== App detail ===== */
.app-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 30px; }
.app-hero-icon {
    width: 96px; height: 96px; border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 42px; box-shadow: var(--shadow-lg); flex-shrink: 0;
}
.app-hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.app-hero .tagline { color: var(--text-secondary); font-size: 16px; margin-bottom: 12px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 28px 0; }
.info-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.info-item strong { display: block; font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.info-item span { font-size: 15px; font-weight: 600; }

.feature-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.feature-list li {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
    font-size: 15px; color: var(--text-secondary);
    display: flex; gap: 10px; align-items: flex-start;
}
.feature-list li::before { content: '◆'; color: var(--accent-purple); font-size: 12px; margin-top: 5px; }

/* ===== Prose / articles ===== */
.prose { max-width: 780px; }
.prose h2 { font-size: 22px; font-weight: 700; margin: 34px 0 12px; color: var(--text-primary); }
.prose h3 { font-size: 18px; font-weight: 700; margin: 26px 0 10px; color: var(--accent-purple); }
.prose p { color: var(--text-secondary); margin-bottom: 16px; font-size: 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-inline-start: 22px; color: var(--text-secondary); }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text-primary); }
.prose a { color: var(--accent-cyan); }
.prose blockquote {
    border-inline-start: 3px solid var(--accent-purple);
    background: var(--bg-card);
    padding: 14px 18px; border-radius: var(--radius-sm);
    color: var(--text-secondary); margin-bottom: 18px;
}
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: start; }
.prose th { background: var(--bg-card); color: var(--text-primary); }
.prose td { color: var(--text-secondary); }

.article-meta { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.article-title { font-size: 30px; font-weight: 800; line-height: 1.4; margin-bottom: 14px; }
.article-lead { font-size: 17px; color: var(--text-secondary); margin-bottom: 26px; }

.post-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px;
    text-decoration: none; color: inherit;
    transition: var(--transition); display: block;
}
.post-card:hover { transform: translateY(-4px); border-color: var(--border-hover); box-shadow: var(--shadow-lg); }
.post-card h3 { font-size: 18px; font-weight: 700; margin: 8px 0 8px; }
.post-card p { color: var(--text-secondary); font-size: 14px; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.tag {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    background: rgba(168,85,247,0.12); color: var(--accent-purple);
}

/* ===== About / stats ===== */
.about-container { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.about-image {
    width: 100%; height: 340px;
    background: linear-gradient(135deg, rgba(168,85,247,0.1) 0%, rgba(236,72,153,0.1) 100%);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); font-size: 80px;
}
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.stat-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; text-align: center; }
.stat-number {
    font-size: 26px; font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== Contact ===== */
.contact-container { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.contact-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 12px; transition: var(--transition);
    text-decoration: none; color: inherit;
}
.contact-item:hover { border-color: var(--accent-purple); transform: translateX(-4px); }
.contact-icon {
    width: 44px; height: 44px; background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.contact-item div strong { display: block; font-size: 14px; margin-bottom: 2px; }
.contact-item div span { font-size: 14px; color: var(--text-secondary); word-break: break-all; }

.contact-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 13px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: inherit; font-size: 15px;
    outline: none; transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(168,85,247,0.1);
}
.form-group textarea { min-height: 120px; resize: vertical; }
.btn-block { width: 100%; justify-content: center; }
.form-note { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* ===== Footer ===== */
.site-footer { margin-top: 60px; padding: 30px 0; border-top: 1px solid var(--border); text-align: center; }
.site-footer p { color: var(--text-muted); font-size: 14px; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 14px; transition: var(--transition); }
.footer-links a:hover { color: var(--accent-purple); }

/* ===== Mobile ===== */
.mobile-toggle {
    display: none; position: fixed; top: 16px; inset-inline-start: 16px; z-index: 200;
    width: 44px; height: 44px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 20px; cursor: pointer;
    align-items: center; justify-content: center;
}
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; backdrop-filter: blur(4px); }
.overlay.active { display: block; }

/* ===== Cookie banner ===== */
.cookie-banner {
    position: fixed; bottom: 0; right: 0; left: 0; z-index: 250;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-hover);
    padding: 18px 24px;
    display: none;
    gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}
.cookie-banner.show { display: flex; }
.cookie-banner p { font-size: 14px; color: var(--text-secondary); max-width: 620px; }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cookie-banner .btn { padding: 9px 18px; font-size: 14px; }

@media (max-width: 1024px) {
    .about-container, .contact-container { grid-template-columns: 1fr; }
    .about-image { height: 240px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-inline-start: 0; max-width: 100%; padding: 76px 18px 20px; }
    .mobile-toggle { display: flex; }
    .top-bar { flex-direction: column; align-items: stretch; gap: 14px; }
    .search-box { width: 100%; }
    .apps-grid, .apps-grid.featured, .posts-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .page-title, .hero h2 { font-size: 22px; }
    .article-title { font-size: 24px; }
    .hero { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .app-card:hover, .post-card:hover, .btn:hover { transform: none; }
}


/* ===== Direction-specific tweaks ===== */
[dir="rtl"] .nav-item a.active { background: linear-gradient(90deg, rgba(168,85,247,0.15) 0%, transparent 100%); }
[dir="ltr"] .nav-item a.active { background: linear-gradient(270deg, rgba(168,85,247,0.15) 0%, transparent 100%); }
[dir="rtl"] .contact-item:hover { transform: translateX(-4px); }
[dir="ltr"] .contact-item:hover { transform: translateX(4px); }

@media (max-width: 768px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0) !important; }
}

/* ===== Fonts per language ===== */
:root { --font-body: 'Inter', system-ui, -apple-system, sans-serif; }
html[lang="ar"] { --font-body: 'Tajawal', system-ui, sans-serif; }
html[lang="ko"] { --font-body: 'Noto Sans KR', system-ui, sans-serif; }
body { font-family: var(--font-body); }
html[lang="en"] body, html[lang="fr"] body, html[lang="es"] body { line-height: 1.65; }

/* ===== Language switcher ===== */
.lang-switch {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 14px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.lang-switch a {
    font-size: 12px; font-weight: 600;
    padding: 5px 10px; border-radius: 20px;
    text-decoration: none; color: var(--text-muted);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.lang-switch a:hover { color: var(--text-primary); border-color: var(--border-hover); }
.lang-switch a.current { background: var(--gradient-1); color: #fff; border-color: transparent; }
