/* ===== Header ===== */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 56px;
    background-color: var(--bg-card);
    box-shadow: var(--box-shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 320px;
}

.logo {
    font-size: 40px;
    color: var(--primary-color);
    line-height: 1;
}

.logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border-radius: 50px;
    padding: 10px 15px;
    width: 240px;
    transition: var(--transition);
}

.search-bar:focus-within {
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.3);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 10px;
    color: var(--text-main);
    width: 100%;
    font-size: 0.95rem;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.header-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.top-nav {
    display: flex;
    gap: 4px;
}

.top-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 48px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    position: relative;
    transition: var(--transition);
}

.top-nav a:hover {
    background-color: var(--secondary-hover);
    text-decoration: none;
}

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

.top-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 320px;
    justify-content: flex-end;
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 18px;
    color: var(--text-main);
    font-weight: 600;
    transition: var(--transition);
}

.profile-link:hover {
    background-color: var(--secondary-hover);
    text-decoration: none;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    color: var(--text-main);
    transition: var(--transition);
    text-decoration: none;
}

.icon-btn:hover {
    background-color: var(--secondary-hover);
    text-decoration: none;
}

/* ===== Dropdown ===== */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    width: 300px;
    padding: 8px;
    animation: dropdownFade 0.15s ease;
    z-index: 200;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-main);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-menu a:hover {
    background-color: var(--secondary-hover);
    text-decoration: none;
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

/* ===== Layout ===== */
.main-layout {
    display: flex;
    justify-content: space-between;
    padding-top: 56px;
    min-height: 100vh;
}

.sidebar-left, .sidebar-right {
    width: 360px;
    padding: 16px;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.content-area {
    flex-grow: 1;
    max-width: 680px;
    padding: 24px 16px;
    margin: 0 auto;
}

/* ===== Sidebar Menu ===== */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu li a:hover {
    background-color: var(--secondary-hover);
    text-decoration: none;
}

.sidebar-menu li a i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ===== Contacts ===== */
.sponsored-section h4, .contacts-header h4 {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
}

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.contacts-actions {
    display: flex;
    gap: 8px;
    cursor: pointer;
}

.contacts-list {
    list-style: none;
    padding: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

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

.avatar-container {
    position: relative;
    flex-shrink: 0;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: var(--success-color);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.divider {
    border-bottom: 1px solid var(--border-color);
    margin: 12px 0;
}

/* ===== Post Card ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.post {
    transition: var(--transition);
}

.post:hover {
    box-shadow: var(--box-shadow-md);
}

/* ===== Stories ===== */
.stories-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}
.stories-container::-webkit-scrollbar { display: none; }
.story-card {
    min-width: 110px;
    height: 200px;
    border-radius: 12px;
    background: var(--bg-card);
    position: relative;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--transition);
}
.story-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-md);
}
.story-card img, .story-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.story-create-btn {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
}
.story-plus {
    background: var(--primary-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-card);
    margin-top: -16px;
}
.story-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 6px;
    color: var(--text-main);
}
.story-avatar {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    overflow: hidden;
    z-index: 2;
}
.story-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.story-name {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    z-index: 2;
}
.story-gradient {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(transparent 70%, rgba(0,0,0,0.6));
    pointer-events: none;
}

/* ===== Create Post Trigger ===== */
.create-post-trigger {
    flex-grow: 1;
    background: var(--bg-main);
    padding: 10px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.create-post-trigger:hover { background: var(--secondary-color); }

/* ===== Post Actions ===== */
.post-action {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}
.post-action:hover {
    background: var(--secondary-hover);
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}
.action-btn:hover {
    background: var(--secondary-hover);
}

/* ===== Profile Page ===== */
.profile-cover {
    height: 350px;
    position: relative;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}
.cover-edit-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255,255,255,0.9);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    z-index: 2;
}
.cover-edit-btn:hover { background: white; }
.profile-info-row {
    padding: 0 32px 16px;
    display: flex;
    align-items: flex-end;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}
.profile-avatar-large {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    border: 4px solid var(--bg-card);
    overflow: hidden;
    margin-top: -84px;
    position: relative;
    background: white;
    z-index: 2;
    flex-shrink: 0;
}
.profile-tabs {
    padding: 0 16px;
    display: flex;
    gap: 0;
    overflow-x: auto;
}
.tab-item {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: 0.95rem;
}
.tab-item:hover {
    background: var(--secondary-hover);
    border-radius: 8px 8px 0 0;
}
.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.profile-layout { flex-direction: row; }
.profile-intro-card {
    width: 360px;
    padding: 16px;
    height: fit-content;
    flex-shrink: 0;
}
@media (max-width: 900px) {
    .profile-layout { flex-direction: column; }
    .profile-intro-card { width: 100%; }
    .profile-info-row { flex-direction: column; align-items: center; text-align: center; padding: 0 16px 16px; }
    .profile-avatar-large { margin-top: -60px; width: 120px; height: 120px; }
    .profile-info-row > div:nth-child(2) { padding-left: 0; padding-top: 12px; }
    .profile-info-row > div:nth-child(3) { padding-top: 8px; }
}

/* ===== Mobile Menu Button ===== */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    border: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--secondary-hover);
}

/* ===== Mobile Overlay ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== Loading Spinner ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 20px auto;
}

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--border-color);
    display: block;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 8px;
}

/* ===== Profile Page ===== */
.profile-container .tab-item {
    padding: 15px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.profile-container .tab-item:hover {
    background: var(--secondary-hover);
}

.profile-container .tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ===== Messages Page ===== */
.messages-layout {
    display: flex;
    height: calc(100vh - 120px);
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-top: -10px;
}

.chat-list {
    width: 350px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    background: var(--bg-card);
    transition: var(--transition);
}

.chat-item:hover {
    background: var(--secondary-hover);
}

.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* ===== Notification Item ===== */
.notification-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: var(--secondary-hover);
}

.notification-item.unread {
    background: rgba(24, 119, 242, 0.05);
}

.notification-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

/* ===== Friend Card ===== */
.friend-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.friend-card:hover {
    box-shadow: var(--box-shadow-md);
}

.friend-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.friend-card .card-body {
    padding: 12px;
}

.friend-card h4 {
    margin: 0 0 10px;
    color: var(--text-main);
}

/* ===== Settings ===== */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item strong {
    display: block;
    color: var(--text-main);
}

.settings-item span {
    color: var(--text-secondary);
}

.settings-edit-btn {
    background: transparent;
    color: var(--primary-color);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.settings-edit-btn:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar-left {
        display: none;
    }

    .sidebar-left.active {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 300px;
        background: var(--bg-card);
        z-index: 50;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
        animation: slideInLeft 0.25s ease;
    }

    @keyframes slideInLeft {
        from { transform: translateX(-100%); }
        to { transform: translateX(0); }
    }

    .header-center {
        display: none;
    }

    .header-left {
        width: auto;
    }

    .header-right {
        width: auto;
    }

    .profile-link span {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .content-area {
        padding: 16px 8px;
    }

    .messages-layout {
        flex-direction: column;
        height: auto;
    }

    .chat-list {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 40vh;
    }

    .chat-window {
        min-height: 60vh;
    }

    .top-nav {
        gap: 2px;
    }

    .top-nav a {
        width: 60px;
        font-size: 20px;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .search-bar {
        width: 180px;
    }

    .login-layout {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .search-bar {
        display: none;
    }

    .header-right .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .auth-box {
        padding: 20px;
    }

    .profile-container .intro-sidebar {
        width: 100% !important;
    }

    .profile-container .profile-content {
        flex-direction: column !important;
    }
}

/* ===== Login Layout ===== */
.login-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    gap: 50px;
}

.login-left {
    max-width: 500px;
}

.login-logo {
    color: var(--primary-color);
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: -10px;
}

.login-tagline {
    font-size: 1.6rem;
    color: var(--text-main);
    line-height: 1.2;
}
