:root {
    --bg: #090d16;
    --card: #131b2e;
    --card-border: #1e293b;
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.15);
    --text: #f8fafc;
    --muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --nav-height: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Cairo", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 25px);
    display: flex;
    justify-content: center;
}

.app-wrapper {
    width: 100%;
    max-width: 540px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* شريط الرأس */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px 12px;
}

.brand {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* تبويبات المشاهد */
.tab-view {
    display: none;
    flex-direction: column;
    gap: 14px;
    animation: fadeIn 0.25s ease;
}

.tab-view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* بطاقات المنشورات (سؤال وجواب) */
.post-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: bold;
    font-size: 0.9rem;
}

.post-user {
    font-size: 0.9rem;
    font-weight: 700;
}

.post-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.question-bubble {
    background: #0d1424;
    border-right: 3px solid var(--primary);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.answer-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #cbd5e1;
    padding: 2px 4px;
}

/* عناصر الإدخال والأزرار */
textarea {
    width: 100%;
    min-height: 90px;
    background: #090d16;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-size: 0.95rem;
    resize: none;
    outline: none;
}

textarea:focus {
    border-color: var(--primary);
}

.btn {
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #090d16; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #090d16; }
.btn-secondary { background: #1e293b; color: #fff; }

/* شريط التنقل السفلي الاحترافي */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(19, 27, 46, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    max-width: 540px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 8px 16px;
    transition: color 0.2s;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.nav-item.active {
    color: var(--primary);
}

/* شارة عدد الرسائل */
.badge {
    position: absolute;
    top: 4px;
    right: 12px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
}

/* بانر تثبيت التطبيق */
.install-banner {
    position: fixed;
    bottom: calc(var(--nav-height) + 12px);
    left: 16px;
    right: 16px;
    max-width: 508px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--primary);
    padding: 12px 16px;
    border-radius: 14px;
    display: none;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    display: none;
    z-index: 200;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

audio { width: 100%; height: 38px; margin-top: 6px; }