/* Base styles */
:root {
    --primary-color: #1877f2;
    --secondary-color: #42b72a;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --divider: #ced0d4;
    --hover-bg: #f2f2f2;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode variables */
[data-theme="dark"] {
    --bg-color: #18191a;
    --card-bg: #242526;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --divider: #3e4042;
    --hover-bg: #3a3b3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

/* Header styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--card-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    z-index: 100;
    padding: 0 16px;
}

.nav-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-logo {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.fb-logo svg {
    height: 40px;
    width: 40px;
}

.search-container {
    position: relative;
    flex: 0 1 680px;
    margin: 0 8px;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-container input {
    width: 100%;
    height: 40px;
    border-radius: 20px;
    border: none;
    background-color: var(--hover-bg);
    padding: 0 16px 0 40px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

.search-container input:focus {
    background-color: var(--card-bg);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.main-nav {
    display: flex;
    height: 100%;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-width: 80px;
    padding: 0 4px;
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-item:hover {
    background-color: var(--hover-bg);
    border-radius: 8px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-btn, .messenger-btn, .notifications-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--hover-bg);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.menu-btn:hover, .messenger-btn:hover, .notifications-btn:hover {
    background-color: var(--divider);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #e41e3f;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Main content layout */
.main-content {
    display: grid;
    grid-template-columns: minmax(200px, 360px) minmax(500px, 680px) minmax(200px, 360px);
    gap: 16px;
    padding: 20px 16px;
    max-width: 1400px;
    margin: 56px auto 0;
}

.left-sidebar, .right-sidebar {
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
    padding-bottom: 20px;
}

.left-sidebar::-webkit-scrollbar, .right-sidebar::-webkit-scrollbar {
    width: 6px;
}

.left-sidebar::-webkit-scrollbar-thumb, .right-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--divider);
    border-radius: 3px;
}

/* Left sidebar styles */
.shortcuts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.shortcut-item:hover {
    background-color: var(--hover-bg);
}

.shortcut-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.shortcut-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--hover-bg);
    border-radius: 50%;
    margin-right: 12px;
    font-size: 18px;
    color: var(--primary-color);
}

.profile-link img {
    border: 2px solid var(--primary-color);
}

.sidebar-footer {
    padding: 16px 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Main feed styles */
.main-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stories-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    scrollbar-width: none;
}

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

.story {
    position: relative;
    min-width: 110px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.story::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.story-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
}

.story:hover .story-bg {
    transform: scale(1.03);
}

.story-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    z-index: 1;
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.create-story .story-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding-bottom: 16px;
}

.create-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border: 4px solid var(--card-bg);
}

.story-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    margin-bottom: 8px;
    object-fit: cover;
}

.create-post {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 12px 16px;
}

.post-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
}

.post-input img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-input input {
    flex: 1;
    height: 40px;
    border-radius: 20px;
    border: none;
    background-color: var(--hover-bg);
    padding: 0 16px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

.post-input input:hover {
    background-color: var(--divider);
}

.post-input input:focus {
    background-color: var(--card-bg);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.post-options {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--divider);
}

.post-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.post-option:hover {
    background-color: var(--hover-bg);
}

.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.author-name:hover {
    text-decoration: underline;
}

.post-time {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-menu {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.post-menu:hover {
    background-color: var(--hover-bg);
}

.post-content {
    padding: 0 16px 12px;
}

.post-image {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
}

.post-footer {
    padding: 0 16px 12px;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 15px;
    color: var(--text-secondary);
}

.reactions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reaction-icons {
    display: flex;
}

.reaction-icons i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    background-color: #1877f2;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-icons i:last-child {
    background-color: #f33e58;
    margin-left: -6px;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.post-action:hover {
    background-color: var(--hover-bg);
}

.post-comment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
}

.post-comment img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-input {
    flex: 1;
    position: relative;
}

.comment-input input {
    width: 100%;
    height: 36px;
    border-radius: 18px;
    border: none;
    background-color: var(--hover-bg);
    padding: 0 36px 0 12px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

.comment-options {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.comment-options button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-options button:hover {
    background-color: var(--divider);
}

.loader-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--divider);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Right sidebar styles */
.contacts-container, .groups-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 16px;
}

.contacts-header, .groups-container h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 17px;
}

.contact-actions {
    display: flex;
    gap: 8px;
}

.contact-actions button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--hover-bg);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.contact-actions button:hover {
    background-color: var(--divider);
}

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact:hover {
    background-color: var(--hover-bg);
}

.contact img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.contact.online::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #31a24c;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    position: absolute;
    bottom: 0;
    right: 0;
}

.create-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.create-group:hover {
    background-color: var(--hover-bg);
}

.group-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

/* Dark mode toggle */
.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Mobile navigation (hidden on desktop) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 100;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

/* Responsive styles */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: minmax(200px, 280px) minmax(300px, 680px) minmax(200px, 280px);
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 80px minmax(300px, 680px) minmax(200px, 280px);
    }
    
    .left-sidebar .shortcut-item span {
        display: none;
    }
    
    .left-sidebar .shortcut-item i {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 0 minmax(300px, 1fr) 0;
        padding: 20px 0;
    }
    
    .left-sidebar, .right-sidebar {
        display: none;
    }
    
    .search-container {
        display: none;
    }
    
    .main-nav {
        display: none;
    }
    
    .mobile-nav {
        display: flex;
    }
}

@media (max-width: 576px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .post-option span {
        display: none;
    }
    
    .post-action span {
        display: none;
    }
}