/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #fafafa;
    color: #262626;
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 935px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #dbdbdb;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo a {
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    color: #262626;
}

.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav a {
    text-decoration: none;
    color: #262626;
    font-size: 22px;
    transition: transform 0.2s;
}

.nav a:active {
    transform: scale(0.95);
}

.nav-avatar {
    display: flex;
    align-items: center;
}

/* Posts */
.post {
    background: white;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
    margin-bottom: 30px;
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.post-header-left {
    display: flex;
    align-items: center;
}

.post-header-left img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.post-header-left a {
    font-weight: bold;
    text-decoration: none;
    color: #262626;
}

.post-header-time {
    font-size: 11px;
    color: #8e8e8e;
    margin-top: 2px;
}

.post-image img,
.post-image video {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    display: block;
}

.post-actions {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.like-btn {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.2s;
}

.like-btn:active {
    transform: scale(1.1);
}

.post-caption {
    padding: 0 16px 8px;
    word-break: break-word;
}

.post-comments {
    padding: 0 16px 16px;
    color: #8e8e8e;
}

/* Profile Page */
.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.profile-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #dbdbdb;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    font-size: 28px;
    font-weight: 300;
    margin: 0;
}

.profile-stats {
    display: flex;
    gap: 40px;
    margin: 15px 0;
}

.profile-stats a {
    text-decoration: none;
    color: #262626;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.post-grid-item {
    position: relative;
    background: #fafafa;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.post-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
}

.post-grid-item:hover .post-overlay {
    opacity: 1;
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 30px;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dbdbdb;
    border-radius: 4px;
    font-family: inherit;
}

.btn {
    width: 100%;
    padding: 10px;
    background: #0095f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.8;
}

.error {
    color: red;
    margin-bottom: 15px;
    padding: 10px;
    background: #ffefef;
    border-radius: 4px;
}

/* Video slider */
#timeSlider {
    -webkit-appearance: none;
    background: #dbdbdb;
    border-radius: 5px;
    height: 4px;
    width: 100%;
}

#timeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0095f6;
    cursor: pointer;
}

/* ======================================== */
/* Responsive Styles (Mobile First)        */
/* ======================================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar img {
        width: 100px;
        height: 100px;
    }
    
    .profile-stats {
        justify-content: center;
        gap: 30px;
    }
    
    .posts-grid {
        gap: 3px;
    }
    
    .form-container {
        margin: 30px auto;
        padding: 20px;
    }
}

/* Mobile (600px and below) */
@media (max-width: 600px) {
    /* Header */
    .header .container {
        padding: 0 12px;
    }
    
    .logo a {
        font-size: 18px;
    }
    
    .nav {
        gap: 15px;
    }
    
    .nav a {
        font-size: 24px;
    }
    
    /* Profile */
    .profile-avatar img {
        width: 80px;
        height: 80px;
    }
    
    .profile-info h2 {
        font-size: 20px;
    }
    
    .profile-stats {
        gap: 20px;
        font-size: 12px;
    }
    
    .profile-stats div {
        text-align: center;
    }
    
    /* Posts */
    .post {
        margin-bottom: 15px;
        border-radius: 0;
    }
    
    .post-header {
        padding: 10px 12px;
    }
    
    .post-actions {
        padding: 8px 12px;
    }
    
    .like-btn {
        font-size: 24px;
    }
    
    .post-caption {
        font-size: 13px;
    }
    
    /* Form */
    .form-container {
        margin: 15px;
        padding: 20px;
    }
    
    /* Messages */
    .post-card {
        flex-direction: column;
    }
    
    .post-container {
        margin: 20px auto;
        padding: 10px;
    }
}

/* Small Mobile (450px and below) */
@media (max-width: 450px) {
    .logo a {
        font-size: 16px;
    }
    
    .nav {
        gap: 12px;
    }
    
    .nav a {
        font-size: 22px;
    }
    
    .profile-stats {
        gap: 15px;
    }
    
    .profile-stats div {
        font-size: 11px;
    }
    
    .posts-grid {
        gap: 2px;
    }
    
    .hero-section h1 {
        font-size: 24px;
    }
    
    .hero-section {
        padding: 30px 15px;
    }
    
    .feature-section {
        flex-direction: column;
        gap: 25px;
    }
    
    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary {
        padding: 8px 20px;
        font-size: 13px;
    }
}

/* Very Small Mobile (380px and below) */
@media (max-width: 380px) {
    .logo a {
        font-size: 14px;
    }
    
    .nav {
        gap: 10px;
    }
    
    .nav a {
        font-size: 20px;
    }
}

/* Landscape mode */
@media (max-width: 900px) and (orientation: landscape) {
    .post-image img,
    .post-image video {
        max-height: 300px;
    }
    
    #messages-container {
        max-height: 200px;
    }
}

/* ======================================== */
/* Mobile Footer Styles                    */
/* ======================================== */

.mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #dbdbdb;
    padding: 8px 0;
    z-index: 100;
    display: none;
}

.mobile-footer-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: #8e8e8e;
    transition: color 0.2s;
    padding: 4px 12px;
    border-radius: 8px;
}

.mobile-footer-item.active {
    color: #0095f6;
}

.mobile-footer-icon {
    font-size: 24px;
}

.mobile-footer-label {
    font-size: 10px;
    font-weight: 500;
}

.mobile-footer-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid #dbdbdb;
}

.mobile-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: #ed4956;
    color: white;
    font-size: 9px;
    border-radius: 50%;
    padding: 2px 5px;
    min-width: 16px;
    text-align: center;
}

/* نمایش فوتر فقط در موبایل و اضافه کردن padding-bottom به body */
@media (max-width: 600px) {
    .mobile-footer {
        display: block;
    }
    
    body {
        padding-bottom: 70px;
    }
    
    .mobile-footer-item:active {
        transform: scale(0.95);
    }
}

/* ======================================== */
/* Search Results Styles                   */
/* ======================================== */

#quick-results-desktop,
#quick-results-mobile {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#quick-results-desktop::-webkit-scrollbar,
#quick-results-mobile::-webkit-scrollbar {
    width: 6px;
}

#quick-results-desktop::-webkit-scrollbar-track,
#quick-results-mobile::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#quick-results-desktop::-webkit-scrollbar-thumb,
#quick-results-mobile::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

/* ======================================== */
/* Post Show Page Styles                   */
/* ======================================== */

.post-card {
    display: flex;
    flex-wrap: wrap;
    background: white;
    border: 1px solid #dbdbdb;
    border-radius: 12px;
    overflow: hidden;
}

.post-media {
    flex: 1;
    min-width: 300px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-media img,
.post-media video {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
}

.post-info {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

/* Responsive for post page */
@media (max-width: 700px) {
    .post-card {
        flex-direction: column;
    }
    
    .post-container {
        margin: 20px auto;
        padding: 10px;
    }
}

/* ======================================== */
/* Dark mode support (optional)            */
/* ======================================== */

@media (prefers-color-scheme: dark) {
    body {
        background: #000;
        color: #fff;
    }
    
    .post,
    .header,
    .form-container,
    .post-card,
    .feature-section,
    .empty-state,
    .hero-section {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .nav a,
    .logo a,
    .post-header-left a,
    .profile-info h2,
    .profile-stats a,
    .post-caption,
    .mobile-footer {
        color: #fff;
        background: #1a1a1a;
    }
    
    .post-caption,
    .post-comments {
        color: #ccc;
    }
    
    .form-group input,
    .form-group textarea {
        background: #333;
        border-color: #444;
        color: #fff;
    }
    
    .mobile-footer {
        border-top-color: #333;
    }
}