/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1877f2;
    --secondary-color: #42b72a;
    --danger-color: #dc3545;
    --warning-color: #f7b928;
    --dark-color: #1c1e21;
    --light-color: #f0f2f5;
    --gray-color: #65676b;
    --border-color: #dddfe2;
    --white-color: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Top Navigation */
.top-nav {
    background-color: var(--white-color);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.search-box {
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .search-box {
        display: block;
    }
}

.search-box input {
    width: 250px;
    padding: 8px 12px 8px 35px;
    border: none;
    background-color: var(--light-color);
    border-radius: 20px;
    font-size: 14px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-item {
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    color: var(--gray-color);
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background-color: var(--light-color);
}

.nav-item.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-dropdown {
    position: relative;
    cursor: pointer;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
}

.profile-trigger:hover {
    background-color: var(--light-color);
}

.profile-trigger img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--white-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--dark-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--light-color);
}

/* Main Layout */
.main-content {
    margin-top: 60px;
    padding: 20px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

@media (min-width: 992px) {
    .content-wrapper {
        grid-template-columns: 300px 1fr 300px;
    }
}

/* Left Sidebar */
.left-sidebar {
    display: none;
}

@media (min-width: 992px) {
    .left-sidebar {
        display: block;
    }
}

.sidebar-menu {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 10px 0;
    box-shadow: var(--shadow);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--dark-color);
    text-decoration: none;
}

.sidebar-item:hover {
    background-color: var(--light-color);
}

.sidebar-item i {
    width: 24px;
    color: var(--primary-color);
}

/* Center Content */
.center-content {
    min-height: 100vh;
}

/* Create Post Box */
.create-post {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.create-post-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.create-post-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.create-post-header input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: var(--light-color);
    cursor: pointer;
}

.create-post-header input:hover {
    background-color: #e4e6e9;
}

.create-post-actions {
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: var(--gray-color);
}

.post-action:hover {
    background-color: var(--light-color);
}

.post-action.live-video i {
    color: #f02849;
}

.post-action.photo-video i {
    color: #45bd62;
}

.post-action.feeling i {
    color: #f7b928;
}

/* Stories Section */
.stories-wrapper {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.stories-container {
    display: flex;
    gap: 10px;
}

.story {
    flex: 0 0 120px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.story.create-story {
    background: linear-gradient(180deg, #fff 50%, #f0f2f5 50%);
}

.story.create-story .story-avatar {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white-color);
    border: 4px solid var(--white-color);
}

.story.create-story .story-text {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 100%);
}

.story-avatar {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    object-fit: cover;
}

.story-username {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: var(--white-color);
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Post Card */
.post-card {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.post-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-user-info h4 {
    font-size: 14px;
    margin-bottom: 2px;
}

.post-user-info span {
    font-size: 12px;
    color: var(--gray-color);
}

.post-menu {
    position: relative;
}

.post-menu-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
}

.post-menu-btn:hover {
    background-color: var(--light-color);
}

.post-content {
    margin-bottom: 10px;
}

.post-text {
    margin-bottom: 10px;
}

.post-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background-color: #000;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--gray-color);
}

.post-actions {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.post-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: var(--gray-color);
}

.post-action-btn:hover {
    background-color: var(--light-color);
}

.post-action-btn.liked {
    color: var(--primary-color);
}

/* Comments Section */
.comments-section {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.comment img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
    background-color: var(--light-color);
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
}

.comment-content h5 {
    margin-bottom: 2px;
    font-size: 12px;
}

.comment-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--gray-color);
}

.comment-actions span {
    cursor: pointer;
}

.comment-actions span:hover {
    text-decoration: underline;
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.comment-form img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-form input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background-color: var(--light-color);
    border-radius: 20px;
}

/* Right Sidebar */
.right-sidebar {
    display: none;
}

@media (min-width: 992px) {
    .right-sidebar {
        display: block;
    }
}

.sidebar-card {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.sidebar-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
}

.friend-request-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.friend-request-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.friend-request-info h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.friend-request-actions {
    display: flex;
    gap: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--white-color);
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background-color: #166fe5;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white-color);
}

.btn-secondary:hover {
    background-color: #36a420;
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white-color);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alert Styles */
.alert {
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Auth Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--light-color);
}

.auth-box {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.auth-box h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.auth-box h2 {
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--gray-color);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Profile Page */
.profile-header {
    background-color: var(--white-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.profile-cover {
    height: 300px;
    position: relative;
}

.profile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    padding: 20px;
    position: relative;
}

.profile-picture {
    position: absolute;
    top: -80px;
    left: 20px;
}

.profile-picture img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--white-color);
    object-fit: cover;
}

.profile-details {
    margin-left: 180px;
}

.profile-details h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.profile-bio {
    color: var(--gray-color);
    margin-bottom: 10px;
}

.profile-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.profile-stat {
    text-align: center;
}

.profile-stat span:first-child {
    font-weight: bold;
    font-size: 18px;
    display: block;
}

.profile-stat span:last-child {
    color: var(--gray-color);
    font-size: 14px;
}

.profile-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

/* Messages Page */
.messages-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 80px);
    background-color: var(--white-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.chat-list {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.chat-item:hover {
    background-color: var(--light-color);
}

.chat-item.active {
    background-color: var(--light-color);
}

.chat-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-info h4 {
    font-size: 14px;
    margin-bottom: 3px;
}

.chat-info p {
    font-size: 12px;
    color: var(--gray-color);
}

.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--light-color);
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.message.sent {
    flex-direction: row-reverse;
}

.message img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    padding: 10px;
    border-radius: 18px;
    background-color: var(--white-color);
}

.message.sent .message-content {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.message-time {
    font-size: 10px;
    color: var(--gray-color);
    margin-top: 5px;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

/* Reels Page */
.reels-container {
    height: calc(100vh - 80px);
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

.reel-item {
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    background-color: #000;
}

.reel-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.reel-info {
    position: absolute;
    bottom: 50px;
    left: 20px;
    color: var(--white-color);
}

.reel-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.reel-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--white-color);
}

.reel-actions {
    position: absolute;
    bottom: 100px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reel-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--white-color);
    cursor: pointer;
}

.reel-action i {
    font-size: 24px;
    margin-bottom: 3px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .profile-picture {
        position: static;
        text-align: center;
    }
    
    .profile-details {
        margin-left: 0;
        text-align: center;
    }
    
    .profile-actions {
        position: static;
        margin-top: 15px;
        justify-content: center;
    }
    
    .messages-container {
        grid-template-columns: 1fr;
    }
    
    .chat-list {
        display: none;
    }
    
    .chat-list.show {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--white-color);
        z-index: 900;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
.visible { display: block; }