/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background-color: #ffffff;
    color: #262626;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 100;
    border-bottom: none;
    padding-bottom: 0;
}

.header-inner {
    max-width: 935px;
    margin: 0 auto;
    padding: 8px 20px 0 20px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 8px;
    border-bottom: none !important;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    font-style: italic;
}

.header-icons {
    display: none;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 50px;
    padding: 10px 16px;
    margin-top: 6px;
    gap: 10px;
    border: none;
    box-shadow: none;
}

.search-bar i {
    color: #8e8e8e;
    font-size: 0.95rem;
}

.search-bar input {
    background: none;
    border: none;
    color: #262626;
    outline: none;
    font-size: 0.9rem;
    width: 100%;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

.search-bar input::placeholder {
    color: #8e8e8e;
}

/* ============================================================
   VIEW CONTROLS
   ============================================================ */
.view-controls {
    max-width: 935px;
    margin: 0 auto;
    padding: 12px 20px 0;
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.view-toggle button {
    background: none;
    border: none;
    color: #8e8e8e;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px 12px;
    transition: all 0.2s;
    border-radius: 4px;
}

.view-toggle button.active {
    color: #0095f6;
}

.view-toggle button:hover {
    color: #262626;
}

/* ============================================================
   EXPLORE GRID
   ============================================================ */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    max-width: 935px;
    margin: 0 auto;
    padding: 10px 20px;
    grid-auto-flow: dense;
    background-color: #ffffff;
}

.grid-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background-color: #fafafa;
    transition: transform 0.2s;
}

.grid-item:hover {
    transform: scale(1.03);
}

.grid-item img,
.grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.grid-item:hover img,
.grid-item:hover video {
    transform: scale(1.05);
}

/* آیتم عمودی - هر ۵ پست */
.grid-item.tall {
    grid-row: span 2;
    aspect-ratio: 1 / 2;
}

/* پست متنی بدون تصویر */
.text-only-post {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
}

.text-only-post h3 {
    color: white;
    font-size: 14px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* نشانگر ویدیو و اسلاید */
.post-type-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    z-index: 2;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Overlay و post-details مخفی */
.explore-grid .overlay,
.explore-grid .post-details {
    display: none;
}

/* ============================================================
   LIST VIEW
   ============================================================ */
.explore-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-width: 600px;
}

.explore-grid.list-view .grid-item {
    display: flex;
    flex-direction: column;
    aspect-ratio: auto;
    height: auto;
    border-bottom: 1px solid #efefef;
    background-color: #ffffff;
    padding: 0;
    margin-bottom: 20px;
    border-radius: 0;
}

.explore-grid.list-view .grid-item.tall {
    grid-row: auto;
    aspect-ratio: auto;
}

/* هدر پست */
.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
}

.post-header .avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: #ffffff;
}

.post-header .username {
    font-weight: 600;
    font-size: 0.9rem;
}

/* مدیا در لیست */
.explore-grid.list-view .grid-item .media-wrapper {
    width: 100%;
    position: relative;
    background-color: #000000;
}

.explore-grid.list-view .grid-item .media-wrapper img,
.explore-grid.list-view .grid-item .media-wrapper video {
    width: 100%;
    display: block;
    object-fit: contain;
    max-height: 500px;
}

/* اکشن‌ها */
.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    font-size: 1.3rem;
}

.post-actions .left-actions {
    display: flex;
    gap: 15px;
}

.post-actions i {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.post-actions i:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.post-actions .fa-heart {
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.post-actions .fa-heart.liked {
    color: #ed4956;
    animation: heartPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.post-actions .fa-heart:active {
    transform: scale(1.3);
}

.post-actions .fa-bookmark {
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.post-actions .fa-bookmark.fas {
    color: #262626;
}

.post-likes {
    padding: 0 15px 8px;
    font-weight: 600;
    font-size: 0.9rem;
    min-height: 20px;
    transition: all 0.2s ease;
    color: #262626;
}

.post-caption {
    padding: 0 15px 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.post-caption .username {
    font-weight: 600;
    margin-left: 5px;
}

.post-comments {
    padding: 0 15px 8px;
    color: #8e8e8e;
    font-size: 0.85rem;
    cursor: pointer;
}

.post-time {
    padding: 0 15px 15px;
    color: #8e8e8e;
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* ============================================================
   LOAD MORE
   ============================================================ */
.load-more {
    text-align: center;
    padding: 40px 20px;
    max-width: 935px;
    margin: 0 auto;
}

.load-more button {
    background-color: #0095f6;
    color: #ffffff;
    border: none;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

.load-more button:hover {
    background-color: #1877f2;
}

.load-more button:disabled {
    background-color: #b2dffc;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    text-align: center;
    padding: 25px 20px;
    color: #8e8e8e;
    font-size: 0.75rem;
    border-top: 1px solid #efefef;
    max-width: 935px;
    margin: 0 auto;
    background: #ffffff;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.footer-links a {
    color: #8e8e8e;
    text-decoration: none;
    font-size: 0.75rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #efefef;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 999;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.bottom-nav a {
    color: #262626;
    text-decoration: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.bottom-nav a i {
    transition: transform 0.2s ease;
}

.bottom-nav a:hover {
    opacity: 0.7;
}

.bottom-nav a:active i {
    transform: scale(0.9);
}

.bottom-nav a.active {
    color: #0095f6;
}

.bottom-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #0095f6;
    border-radius: 50%;
}

/* انیمیشن Tap */
.bottom-nav a.tap-animation i {
    animation: navTap 0.3s ease;
}

@keyframes navTap {
    0% { transform: scale(1); }
    50% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

/* ============================================================
   POST DETAIL OVERLAY
   ============================================================ */
.post-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 1000;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.post-detail-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 1px solid #efefef;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.detail-header .back-btn {
    color: #262626;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 8px;
}

.detail-header .back-btn:hover {
    opacity: 0.7;
}

.detail-header .logo-text {
    color: #262626;
    font-size: 1.1rem;
    font-weight: 600;
}

.detail-header .logo-text img {
    height: 30px;
    vertical-align: middle;
}

.detail-header .header-placeholder {
    width: 40px;
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: auto;
}

.detail-body::-webkit-scrollbar {
    display: none;
}

.detail-slide {
    min-height: 100vh;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.detail-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    flex-shrink: 0;
    background: #ffffff;
    z-index: 2;
}

.detail-post-header .avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    flex-shrink: 0;
}

.detail-post-header .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-post-header .username {
    font-weight: 600;
    font-size: 0.9rem;
    color: #262626;
}

.detail-post-header a {
    color: #262626;
    text-decoration: none;
}

/* ============================================================
   DETAIL MEDIA
   ============================================================ */
/* اصلاح شده */
.detail-media {
    background: #000000;
    display: flex;
    flex-direction: column; /* مهم‌ترین تغییر: اینکار باعث می‌شود ویدیو عرض را پر کند */
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.detail-media img,
.detail-media video {
    width: 100%;
    /*max-height: 100%;*/
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 2;
}

/* Placeholder */
.detail-media .media-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background: #000000;
}

.detail-media .media-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(30px) brightness(0.6);
    transform: scale(1.1);
}

.detail-media .media-placeholder .loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 2rem;
    z-index: 3;
    animation: spin 1s linear infinite;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.detail-media .media-placeholder.hidden {
    display: none;
}

.detail-media .text-only-post {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
    color: #fff;
    position: relative;
    z-index: 2;
}

.detail-media .text-only-post h3 {
    font-size: 14px;
    line-height: 1.6;
}

/* Video Overlay Layer */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    cursor: pointer;
    background: transparent;
}

/* Like Ripple */
.detail-media .like-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 48, 64, 0.25), transparent 70%);
    pointer-events: none;
    animation: rippleEffect 0.7s ease forwards;
    z-index: 10;
}

@keyframes rippleEffect {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* ============================================================
   DETAIL INFO
   ============================================================ */
.detail-info {
    background: #ffffff;
    padding: 0 15px;
    flex-shrink: 0;
    border-top: 1px solid #efefef;
    padding-bottom: 10px;
}

.detail-info > div {
    animation: contentFadeIn 0.3s ease;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 8px;
    flex-shrink: 0;
}

.detail-actions .left-actions {
    display: flex;
    gap: 15px;
}

.detail-actions i {
    font-size: 1.4rem;
    color: #262626;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-actions i:hover {
    transform: scale(1.1);
}

.detail-actions .fa-heart.liked {
    color: #ed4956;
}

.detail-actions .fa-heart:active {
    transform: scale(1.3);
}

.detail-actions .fa-bookmark.fas {
    color: #262626;
}

.detail-likes {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 2px 0 6px;
    flex-shrink: 0;
    min-height: 24px;
    color: #262626;
}

.detail-caption {
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 4px 0;
    flex-shrink: 0;
    max-height: 60px;
    overflow-y: auto;
    color: #262626;
}

.detail-caption .username {
    font-weight: 600;
    margin-left: 5px;
}

.detail-time {
    color: #8e8e8e;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 4px 0 8px;
    flex-shrink: 0;
}

.detail-comments-preview {
    padding: 4px 0;
    color: #8e8e8e;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
}

.detail-comments-preview:hover {
    color: #262626;
}

/* ============================================================
   COMMENT MODAL
   ============================================================ */
.comment-modal-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    animation: fadeInModal 0.3s ease;
}

.comment-modal-overlay.active {
    display: flex;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.comment-modal {
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.3s ease;
    padding: 0 16px 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

@keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.comment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #dbdbdb;
    flex-shrink: 0;
}

.comment-modal-header h3 {
    color: #262626;
    font-size: 1rem;
    margin: 0;
}

.comment-modal-header .close-btn {
    color: #262626;
    font-size: 1.3rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 8px;
}

.comment-modal-header .close-btn:hover {
    opacity: 0.7;
}

.comment-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.comment-modal-body .comment-item {
    padding: 8px 0;
    border-bottom: 1px solid #efefef;
}

.comment-modal-body .comment-item:last-child {
    border-bottom: none;
}

.comment-modal-body .comment-user {
    color: #262626;
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-modal-body .comment-text {
    color: #262626;
    font-size: 0.85rem;
    margin-top: 2px;
}

.comment-modal-body .comment-time {
    color: #8e8e8e;
    font-size: 0.65rem;
}

.comment-modal-body .no-comments {
    color: #8e8e8e;
    text-align: center;
    padding: 30px 0;
    font-size: 0.9rem;
}

.comment-modal-input {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid #dbdbdb;
    flex-shrink: 0;
}

.comment-modal-input input {
    flex: 1;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #efefef;
    background: #f5f5f5;
    color: #262626;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

.comment-modal-input input::placeholder {
    color: #8e8e8e;
}

.comment-modal-input input:focus {
    border-color: #dbdbdb;
    background: #ffffff;
}

.comment-modal-input button {
    padding: 8px 18px;
    border-radius: 20px;
    border: none;
    background: #0095f6;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    white-space: nowrap;
}

.comment-modal-input button:hover {
    background: #1877f2;
}

.comment-modal-input button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================
   HEART ANIMATIONS
   ============================================================ */
.heart-animation {
    position: fixed;
    font-size: 120px;
    color: #ff3040;
    z-index: 99999;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: heartPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 0 0 40px rgba(255, 48, 64, 0.4);
    user-select: none;
    -webkit-user-select: none;
}

.heart-animation .fa-heart {
    display: block;
    animation: heartPulse 0.8s ease forwards;
}

@keyframes heartPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-15deg);
        opacity: 1;
    }
    25% {
        transform: translate(-50%, -50%) scale(1.5) rotate(8deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(0.95) rotate(-5deg);
        opacity: 1;
    }
    75% {
        transform: translate(-50%, -50%) scale(1.2) rotate(3deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

@keyframes heartPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    20% {
        transform: scale(1.4);
        opacity: 1;
    }
    40% {
        transform: scale(0.85);
        opacity: 1;
    }
    60% {
        transform: scale(1.15);
        opacity: 1;
    }
    80% {
        transform: scale(0.95);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.heart-small {
    position: fixed;
    font-size: 60px;
    color: #ff3040;
    z-index: 99999;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: heartPopSmall 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 0 0 30px rgba(255, 48, 64, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

.heart-small .fa-heart {
    display: block;
    animation: heartPulseSmall 0.6s ease forwards;
}

@keyframes heartPopSmall {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-10deg);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(0.9) rotate(-3deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

@keyframes heartPulseSmall {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
    60% {
        transform: scale(0.85);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.heart-rain {
    position: fixed;
    pointer-events: none;
    z-index: 99998;
    font-size: 20px;
    color: #ff3040;
    animation: heartRain 1.5s ease forwards;
    user-select: none;
    -webkit-user-select: none;
}

@keyframes heartRain {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-250px) scale(1.8) rotate(720deg);
        opacity: 0;
    }
}

.fa-heart.liked {
    color: #ff3040;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.detail-slide.placeholder-slide .detail-post-header .avatar {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 50%;
    overflow: hidden;
}

.detail-slide.placeholder-slide .detail-post-header .avatar img {
    opacity: 0.3;
}

.detail-slide.placeholder-slide .detail-post-header .username {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    color: transparent !important;
    border-radius: 8px;
    display: inline-block;
    min-width: 120px;
    height: 1.2rem;
}

.detail-slide.placeholder-slide .detail-caption {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    color: transparent !important;
    border-radius: 8px;
    min-width: 200px;
    height: 2rem;
    margin-top: 8px;
}

.detail-slide.placeholder-slide .detail-likes {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    color: transparent !important;
    border-radius: 8px;
    display: inline-block;
    min-width: 80px;
    height: 1rem;
}

.detail-slide.placeholder-slide .detail-time {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    color: transparent !important;
    border-radius: 8px;
    display: inline-block;
    min-width: 100px;
    height: 0.9rem;
}

.detail-slide.placeholder-slide .detail-comments-preview {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    color: transparent !important;
    border-radius: 8px;
    display: inline-block;
    min-width: 120px;
    height: 1rem;
}

.detail-slide.placeholder-slide .detail-actions i {
    opacity: 0.3;
}

.temp-loading-spinner {
    animation: fadeInSpinner 0.2s ease;
}

@keyframes fadeInSpinner {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast-message {
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    width: 100%;
    pointer-events: auto;
    animation: slideDown 0.3s ease forwards;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.toast-error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast-success { background: linear-gradient(135deg, #059669, #047857); }
.toast-info { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.toast-warning { background: linear-gradient(135deg, #d97706, #b45309); }

.toast-message.removing {
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideUp {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-30px) scale(0.95); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Mobile */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

    .header-inner {
        padding: 6px 16px 0 16px !important;
    }

    .search-bar {
        padding: 8px 14px !important;
        border-radius: 50px !important;
        margin-top: 4px !important;
    }

    .explore-grid {
        padding: 8px 2px !important;
        gap: 2px !important;
    }

    .explore-grid.list-view .grid-item {
        margin-bottom: 15px;
    }

    .explore-grid.list-view .grid-item .media-wrapper img,
    .explore-grid.list-view .grid-item .media-wrapper video {
        max-height: 400px;
    }

    .detail-slide {
        max-width: 100%;
    }

    .detail-info {
        padding: 0 12px;
    }

    .detail-actions i {
        font-size: 1.2rem;
    }

    .detail-post-header {
        padding: 8px 12px;
    }

    .detail-post-header .avatar {
        width: 30px;
        height: 30px;
    }

    .comment-modal {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }

    .detail-header .logo-text {
        font-size: 0.9rem;
    }

    .detail-header .logo-text img {
        height: 24px;
    }

    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        padding: 6px 0;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        border-radius: 0;
        box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.05);
    }

    .bottom-nav a {
        font-size: 1.3rem;
        padding: 6px 10px;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .header-inner {
        padding: 10px 20px 0 20px !important;
    }

    .search-bar {
        padding: 12px 18px !important;
        border-radius: 50px !important;
        margin-top: 8px !important;
    }

    .explore-grid:not(.list-view) {
        gap: 4px;
    }

    .detail-body {
        padding: 0 20px;
    }

    .detail-slide {
        max-width: 600px;
        border-radius: 8px;
        margin: 0 auto;
    }

    /* Bottom Nav as Sidebar */
    body {
        padding-bottom: 0;
        padding-left: 80px;
    }

    .bottom-nav {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 75px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 0;
        padding-top: 80px;
        border-top: none;
        border-right: 1px solid #dbdbdb;
        border-radius: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
        transition: transform 0.3s ease;
    }

    .bottom-nav a {
        font-size: 1.4rem;
        padding: 15px;
        width: 100%;
        margin: 2px 0;
    }

    .bottom-nav a:hover {
        background-color: #fafafa;
        border-radius: 0;
    }

    .bottom-nav a.active::after {
        bottom: auto;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 20px;
        border-radius: 0 4px 4px 0;
    }

    .bottom-nav a:last-child {
        margin-top: auto;
        margin-bottom: 20px;
    }

    .post-detail-overlay {
        padding-left: 80px;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .explore-grid {
        gap: 1px;
        padding: 4px 1px !important;
    }

    .logo {
        font-size: 1.2rem;
    }
}
/* نوار ناوبری در حالت overlay */
.bottom-nav.overlay-nav {
    position: fixed;
    z-index: 1001; /* بالاتر از overlay */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* تنظیم فاصله پایین detail-body برای جا دادن نوار */
.overlay.active ~ .bottom-nav.overlay-nav {
    /* اینجا نوار نشون داده می‌شه */
}

/* اضافه کردن padding-bottom به detail-body */
.detail-body {
    padding-bottom: 70px; /* فضای کافی برای نوار */
}