/* ==============================================================================
   منصة مَدار 🪐 — ملف التصميم الموحد (static/style.css)
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --bg-deep: #05080d;
    --bg-card: rgba(12, 19, 29, 0.94);
    --bg-card-border: rgba(0, 255, 204, 0.18);
    --neon-green: #00ffcc;
    --neon-glow: rgba(0, 255, 204, 0.35);
    --accent-gold: #ffd700;
    --text-primary: #f0f6fc;
    --text-muted: #8b949e;
    --danger: #ff4757;
    --dock-bg: rgba(8, 13, 21, 0.96);
    --radius-pill: 50px;
    --radius-card: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    line-height: 1.5;
}

/* ==================== أساسيات العزل والإخفاء الحاسم ==================== */
.hidden {
    display: none !important;
}

.page {
    display: none;
    width: 100%;
    animation: fadeIn 0.25s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== خلفية النجوم المدارية ==================== */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at 50% 10%, rgba(0, 255, 204, 0.07), transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(0, 119, 255, 0.06), transparent 50%);
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 95px;
    position: relative;
    z-index: 1;
}

/* ==================== شاشة تسجيل الدخول ==================== */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 25%, #0b1826 0%, var(--bg-deep) 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    overflow-y: auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 255, 204, 0.08);
    text-align: center;
}

.brand-icon {
    font-size: 42px;
    filter: drop-shadow(0 0 14px var(--neon-glow));
}

.brand-title {
    color: var(--neon-green);
    font-size: 26px;
    font-weight: 900;
    margin: 4px 0;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.3);
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 18px;
}

.avatar-picker-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px dashed var(--neon-green);
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
    box-shadow: 0 0 16px rgba(0, 255, 204, 0.15);
}

.avatar-camera-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--neon-green);
    color: #06090e;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.input-group {
    position: relative;
    margin-bottom: 10px;
}

.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    background: rgba(7, 12, 20, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: 0.25s;
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-glow);
}

.dob-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.dob-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0 6px;
}

/* ==================== الشريط العلوي الذكي ==================== */
.top-bar {
    position: sticky;
    top: 10px;
    margin: 0 12px 14px;
    background: rgba(11, 18, 28, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
}

.user-avatar {
    background: linear-gradient(135deg, #162436, #09101a);
    border: 1.5px solid var(--neon-green);
    color: var(--neon-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 12px var(--neon-glow);
}

.top-avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.top-camera-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--neon-green);
    color: #06090e;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    border: 1.5px solid #0d1623;
}

.search-bar-box {
    flex: 1;
    position: relative;
    margin: 0 10px;
}

.search-bar-box input {
    width: 100%;
    background: rgba(7, 12, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 7px 32px 7px 12px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: 0.2s;
}

.search-bar-box input:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.18);
}

.search-bar-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neon-green);
    font-size: 12px;
    opacity: 0.85;
}

.search-dropdown {
    position: absolute;
    top: 110%;
    right: 0;
    left: 0;
    background: rgba(9, 14, 22, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: 14px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.85);
}

/* أزرار الأيقونات الدائرية الزجاجية المضيئة */
.icon-btn, .icon-btn-light {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(0, 255, 204, 0.22);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

.icon-btn:hover, .icon-btn-light:hover {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 12px var(--neon-glow);
}

.icon-btn:active, .icon-btn-light:active {
    transform: scale(0.92);
    background: rgba(0, 255, 204, 0.15);
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.notif-badge {
    position: absolute;
    top: -3px;
    left: -3px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
}

/* ==================== قائمة الإشعارات ==================== */
.notif-dropdown {
    position: fixed;
    top: 65px;
    left: 16px;
    right: 16px;
    max-width: 380px;
    margin: 0 auto;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(9, 14, 22, 0.98);
    border: 1px solid var(--neon-green);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.9);
    z-index: 2500;
    padding: 8px 0;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}

.notif-item.unread {
    background: rgba(0, 255, 204, 0.08);
    border-right: 3px solid var(--neon-green);
}

/* ==================== شريط القصص (Stories) ==================== */
.sticky-stories-bar {
    padding: 4px 12px 10px;
}

.stories-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 62px;
    cursor: pointer;
}

.story-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 2.5px;
    background: linear-gradient(135deg, var(--neon-green), var(--accent-gold));
    box-shadow: 0 0 12px var(--neon-glow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-ring.add-story {
    background: rgba(0, 255, 204, 0.05);
    border: 2px dashed rgba(0, 255, 204, 0.65);
    box-shadow: none;
}

.story-username {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== صندوق النشر ==================== */
.composer {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin: 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.composer textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ==================== كروت المنشورات المتناسقة ==================== */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.post-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.post-user-info-group {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.post-author {
    font-weight: 800;
    font-size: 14px;
    color: #fff;
}

.post-time {
    font-size: 11px;
    color: var(--text-muted);
}

.post-content {
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 8px;
    word-break: break-word;
}

.post-media {
    width: 100%;
    max-height: 460px;
    border-radius: 14px;
    background: #000;
    object-fit: cover;
    margin: 8px 0;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* أزرار التفاعل داخل المنشورات بتصميم كبسولات زجاجية ناعمة */
.action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-family: inherit;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: rgba(0, 255, 204, 0.3);
    color: var(--neon-green);
}

.action-btn.liked {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.12);
    border-color: rgba(255, 71, 87, 0.35);
}

.action-btn.saved {
    color: var(--neon-green);
    background: rgba(0, 255, 204, 0.1);
    border-color: rgba(0, 255, 204, 0.35);
}

/* ==================== الرأس الفرعي داخل الصفحات الداخلية ==================== */
.subpage-top-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: rgba(13, 20, 29, 0.85);
    border-radius: var(--radius-pill);
    border: 1px solid var(--bg-card-border);
}

.btn-back-nav {
    background: radial-gradient(circle, rgba(0, 255, 204, 0.15), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(0, 255, 204, 0.35);
    color: var(--neon-green);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.15);
}

.single-search-bar {
    flex: 1;
    background: rgba(8, 14, 22, 0.9);
    border: 1px solid var(--bg-card-border);
    border-radius: 20px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.single-search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

/* ==================== الدردشة والنجمة الفضائية ★ ==================== */
.chat-list {
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.chat-item:hover {
    border-color: var(--neon-green);
}

.chat-room-container {
    padding: 0 12px;
}

.chat-messages-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 55vh;
    max-height: 68vh;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    position: relative;
    word-break: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.chat-bubble.mine {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.22), rgba(0, 119, 255, 0.15));
    border: 1px solid rgba(0, 255, 204, 0.4);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.chat-bubble-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: left;
}

.chat-star-unread {
    color: #8696a0;
    font-size: 11px;
    margin-right: 4px;
}

.chat-star-read {
    color: var(--accent-gold);
    font-size: 11px;
    margin-right: 4px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

.chat-input-bar {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 616px;
    background: var(--dock-bg);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.chat-input-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

/* ==================== الرصيف السفلي العائم مع توهج الأزرار الدائري ==================== */
nav.bottom-nav.floating-dock {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 28px);
    max-width: 500px;
    background: var(--dock-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 255, 204, 0.28);
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 12px;
    z-index: 1000;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(0, 255, 204, 0.08);
}

nav.bottom-nav.floating-dock .nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
}

/* حلقة دائرية زجاجية للأيقونات في الشريط السفلي */
nav.bottom-nav.floating-dock .nav-btn .nav-3d-icon,
nav.bottom-nav.floating-dock .nav-btn i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

nav.bottom-nav.floating-dock .nav-btn.active {
    color: var(--neon-green);
}

nav.bottom-nav.floating-dock .nav-btn.active .nav-3d-icon,
nav.bottom-nav.floating-dock .nav-btn.active i {
    background: radial-gradient(circle, rgba(0, 255, 204, 0.28), rgba(0, 119, 255, 0.1));
    border-color: var(--neon-green);
    box-shadow: 0 0 14px var(--neon-glow), inset 0 0 6px rgba(0, 255, 204, 0.25);
    transform: translateY(-2px);
}

/* زر الكتب المركزي 📚 */
.dock-center-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-green), #0077ff);
    color: #06090e;
    font-size: 20px;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 18px var(--neon-glow);
    transform: translateY(-8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.dock-center-action-btn:active {
    transform: translateY(-4px) scale(0.92);
}

/* ==================== النوافذ المنبثقة ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 7, 11, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-card {
    background: rgba(12, 19, 29, 0.97);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 20px rgba(0, 255, 204, 0.08);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-green), #00b4d8);
    color: #05080c;
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 0 16px var(--neon-glow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    box-shadow: 0 0 22px rgba(0, 255, 204, 0.5);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-primary.full-width, .btn-danger.full-width {
    width: 100%;
}

.btn-danger {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
}

/* إشعار التوست */
.toast {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(13, 20, 29, 0.96);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 30px rgba(0, 255, 204, 0.35);
    z-index: 3000;
    opacity: 0;
    transition: 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}