:root {
    --bg-color: #fafafa;
    --box-bg: #ffffff;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --border-color: #dbdbdb;
    --btn-primary: #0095f6;
    --btn-primary-hover: #1877f2;
    --error-color: #ed4956;
    --msg-received-bg: #efefef;
}

/* اضافه کردن متغیرهای حالت تاریک با کنتراست بالا */
body.dark-mode {
    --bg-color: #000000;
    --box-bg: #121212;
    --text-primary: #ffffff; /* متن کاملا سفید برای خوانایی */
    --text-secondary: #cccccc; /* خاکستری روشن */
    --border-color: #333333;
    --msg-received-bg: #2a2a2a;
}

@font-face { font-family: 'Vazirmatn'; src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'Vazirmatn'; src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: bold; font-style: normal; }

body { background-color: var(--bg-color); color: var(--text-primary); font-family: 'Vazirmatn', Tahoma, sans-serif; direction: rtl; margin: 0; padding: 0; transition: background-color 0.3s, color 0.3s; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
.d-none { display: none; }

.auth-container { width: 100%; max-width: 350px; padding: 15px; margin: 100px auto; }
.auth-box { background-color: var(--box-bg); border: 1px solid var(--border-color); border-radius: 1px; padding: 30px 40px; margin-bottom: 15px; text-align: center; }
.auth-logo { font-family: 'Arial', sans-serif; font-size: 2.5rem; font-weight: bold; margin-bottom: 30px; letter-spacing: -1px; }
.auth-input { width: 100%; background-color: var(--bg-color); border: 1px solid var(--border-color); border-radius: 3px; padding: 9px 8px; margin-bottom: 10px; font-size: 12px; color: var(--text-primary); outline: none; box-sizing: border-box; }
.auth-input:focus { border-color: var(--text-secondary); }
.auth-btn { width: 100%; background-color: var(--btn-primary); color: white; border: none; border-radius: 8px; padding: 8px; font-weight: bold; font-size: 14px; cursor: pointer; margin-top: 10px; }
.auth-btn:hover { background-color: var(--btn-primary-hover); }
.auth-switch { background-color: var(--box-bg); border: 1px solid var(--border-color); padding: 20px; text-align: center; font-size: 14px; }
.auth-switch a { color: var(--btn-primary); font-weight: bold; }

.app-container { display: flex; width: 100%; max-width: 1200px; margin: 0 auto; min-height: 100vh; }
.sidebar { width: 244px; border-left: 1px solid var(--border-color); padding: 20px 12px; position: fixed; height: 100vh; display: flex; flex-direction: column; background-color: var(--bg-color); z-index: 1000; box-sizing: border-box; transition: background-color 0.3s; }
.sidebar-logo { padding: 10px 12px; margin-bottom: 20px; font-size: 1.5rem; font-weight: bold; }
.nav-item { display: flex; align-items: center; padding: 12px; margin-bottom: 5px; border-radius: 8px; color: var(--text-primary); transition: background-color 0.2s; font-size: 16px; cursor: pointer; }
.nav-item:hover { background-color: var(--border-color); }
.nav-item svg { margin-left: 15px; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.nav-item:hover svg { transform: scale(1.05); }
.nav-item.active { font-weight: bold; }
.nav-item.active svg { stroke-width: 3; }
.nav-profile-pic { width: 24px; height: 24px; border-radius: 50%; margin-left: 15px; object-fit: cover; border: 1px solid var(--border-color); }
.main-content { flex-grow: 1; margin-right: 244px; display: flex; justify-content: center; }
.feed-container { width: 100%; max-width: 630px; padding-top: 30px; }

.top-nav-mobile, .bottom-nav { display: none; }
.top-nav-mobile { position: fixed; top: 0; right: 0; width: 100%; background-color: var(--box-bg); border-bottom: 1px solid var(--border-color); justify-content: space-between; align-items: center; padding: 10px 15px; z-index: 1000; height: 60px; box-sizing: border-box; }
.bottom-nav { position: fixed; bottom: 0; right: 0; width: 100%; background-color: var(--box-bg); border-top: 1px solid var(--border-color); justify-content: space-around; align-items: center; padding: 5px 0; z-index: 1000; height: 60px; box-sizing: border-box; }
.bottom-nav .nav-item { padding: 10px; margin-bottom: 0; }
.bottom-nav .nav-item svg { margin-left: 0; width: 26px; height: 26px; }
.bottom-nav .nav-text { display: none; }

.stories-container { display: flex; gap: 15px; overflow-x: auto; padding: 15px 0; margin-bottom: 20px; scrollbar-width: none; }
.stories-container::-webkit-scrollbar { display: none; }
.story-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; flex-shrink: 0; }
.story-ring { width: 66px; height: 66px; border-radius: 50%; background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); padding: 2.5px; display: flex; justify-content: center; align-items: center; }
.story-ring.seen { background: var(--border-color); }
.story-ring img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--bg-color); object-fit: cover; }
.story-username { font-size: 12px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }

.post-card { background-color: var(--box-bg); border-bottom: 1px solid var(--border-color); margin-bottom: 20px; transition: background-color 0.3s; }
.post-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; }
.post-user-info { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 14px; color: var(--text-primary); }
.post-user-info img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.post-media { width: 100%; max-height: 600px; object-fit: cover; display: block; background-color: #000; }
.post-actions { display: flex; justify-content: space-between; padding: 10px 15px 5px 15px; }
.post-actions-left { display: flex; gap: 15px; }
.action-icon { cursor: pointer; width: 24px; height: 24px; fill: transparent; stroke: var(--text-primary); stroke-width: 2; transition: transform 0.1s; }
.action-icon:active { transform: scale(0.85); }
.action-icon.liked { fill: var(--error-color); stroke: var(--error-color); }
.post-likes { font-weight: bold; padding: 0 15px; font-size: 14px; margin-bottom: 5px; color: var(--text-primary); }
.post-caption { padding: 0 15px; font-size: 14px; margin-bottom: 5px; line-height: 1.5; color: var(--text-primary); }
.post-date { font-size: 12px; color: var(--text-secondary); padding: 0 15px; margin-bottom: 10px; }
.post-add-comment { display: flex; padding: 10px 15px; border-top: 1px solid var(--border-color); }
.post-add-comment input { flex-grow: 1; border: none; background: transparent; outline: none; color: var(--text-primary); font-family: inherit; font-size: 14px; }
.post-add-comment button { background: transparent; border: none; color: var(--btn-primary); font-weight: bold; cursor: pointer; padding: 0; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-right: 0; padding-bottom: 60px; padding-top: 60px; }
    .feed-container { max-width: 100%; padding: 0; }
    .bottom-nav, .top-nav-mobile { display: flex; }
    .post-card { border-left: none; border-right: none; border-radius: 0; }
}
@media (min-width: 768px) {
    .post-card { border: 1px solid var(--border-color); border-radius: 8px; padding-bottom: 5px; }
}