@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #050505;
    --text-secondary: #65676b;
    --border-color: #ced0d4;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

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

body.bg-gray {
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    transition: all 0.3s ease;
}

body.high-contrast {
    --primary-color: #ffff00;
    --primary-hover: #e6e600;
    --bg-color: #000000;
    --card-bg: #000000;
    --text-primary: #ffffff;
    --text-secondary: #ffff00;
    --border-color: #ffff00;
    background-image: none;
    background-color: #000;
}
body.high-contrast * {
    border-color: #ffff00 !important;
}

body.large-text {
    font-size: 1.25rem;
}
body.large-text input, body.large-text button {
    font-size: 1.25rem;
}

/* Authentication Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.auth-left {
    flex: 1;
    padding-right: 40px;
}

.auth-right {
    flex: 1;
}

.logo-text {
    font-size: 4rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-desc {
    font-size: 1.5rem;
    line-height: 1.4;
    font-weight: 300;
}

.auth-box {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* Forms & Inputs */
input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #e4e6eb;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #d8dadf;
}

.btn-success {
    background-color: #42b72a;
    color: white;
}

.btn-success:hover {
    background-color: #36a420;
    transform: translateY(-2px);
}

.forgot-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    margin-top: 15px;
    font-size: 0.9rem;
}

hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-logo {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-right: 20px;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
}

.search-bar input {
    margin-bottom: 0;
    border-radius: 20px;
    padding: 8px 16px;
    background-color: #f0f2f5;
    border: none;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    cursor: pointer;
}

/* Layout */
.main-layout {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.sidebar {
    flex: 1.2 !important; /* Slightly wider for professional feel */
    position: sticky;
    top: 80px;
    height: calc(100vh - 100px);
    padding: 10px;
}

.content {
    flex: 2.8 !important;
}

.menu-list {
    list-style: none;
}

.menu-item {
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    color: #444;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item:hover {
    background-color: rgba(24, 119, 242, 0.08);
    color: var(--primary-color);
    transform: translateX(5px);
}

.menu-item.active {
    background-color: rgba(24, 119, 242, 0.1);
    color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Posts */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.create-post-top {
    display: flex;
    align-items: center;
}

.create-post-top input {
    flex: 1;
    border: none;
    border-radius: 20px;
    background-color: #f0f2f5;
    margin-bottom: 0;
    padding: 12px 16px;
}

.create-post-bottom {
    text-align: right;
}

.create-post-bottom .btn {
    width: auto;
    padding: 8px 20px;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.post-author {
    font-weight: 600;
}

.post-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-content {
    margin-bottom: 15px;
    line-height: 1.5;
}

.post-actions {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.error-msg {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 0.9rem;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
    }
    .auth-left {
        padding-right: 0;
        text-align: center;
        margin-bottom: 30px;
    }
    .main-layout {
        flex-direction: column;
    }
    .sidebar {
        display: none;
    }
}

/* Stories */
.stories-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.stories-container::-webkit-scrollbar {
    height: 6px;
}
.stories-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.story-card {
    min-width: 110px;
    height: 190px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    overflow: hidden;
    flex-shrink: 0;
}
.story-card:hover {
    transform: scale(1.03);
}
.story-card.create-story {
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
}
.create-story-img {
    height: 130px;
    width: 100%;
    object-fit: cover;
}
.create-story-btn {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: 3px solid white;
}
.create-story-text {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
}
.story-card-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
}
.story-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    object-fit: cover;
}
.story-author {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Comments Section */
.comments-section {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.comments-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.comment-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}
.comment-bubble {
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 0.9rem;
    max-width: calc(100% - 42px);
}
.comment-author {
    font-weight: 600;
    margin-bottom: 2px;
}
.add-comment {
    display: flex;
    align-items: center;
}
.add-comment img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}
.add-comment input {
    flex: 1;
    border: none;
    border-radius: 20px;
    background-color: #f0f2f5;
    padding: 8px 12px;
    margin-bottom: 0;
    font-size: 0.9rem;
}
/* Friends Section Styles */
.friends-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.friend-tab {
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: #f0f2f5;
    transition: all 0.3s;
    border: 1px solid transparent;
}
.friend-tab:hover {
    background: #e4e6eb;
}
.friend-tab.active {
    background: var(--primary-color);
    color: white;
}
.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 15px;
}
.friend-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.friend-card .avatar {
    width: 50px;
    height: 50px;
}
.friend-card .btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    width: auto;
}
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}
/* Mobile Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 18px;
    cursor: pointer;
    margin-right: 15px;
}
.hamburger-menu span {
    width: 100%;
    height: 2.5px;
    background: var(--text-primary);
    border-radius: 5px;
    transition: 0.3s;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

@media (max-width: 1100px) {
    .left-sidebar { flex: 1.5 !important; }
}

@media (max-width: 768px) {
    .hamburger-menu { 
        display: flex !important; 
        z-index: 2002 !important;
        position: relative;
    }
    .nav-logo { 
        font-size: 15px !important; 
        margin-left: 5px;
        flex: 1;
    }
    .search-bar { display: none !important; }
    #logout-btn { display: none !important; }
    
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: white !important;
        z-index: 2001 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        padding: 80px 15px 20px 15px !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15) !important;
        display: block !important;
    }
    
    .sidebar.active {
        left: 0 !important;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.4);
        z-index: 2000 !important;
        display: none;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.active {
        display: block !important;
    }
    
    .main-layout { 
        padding: 10px; 
        flex-direction: column; 
    }
    .right-sidebar { display: none !important; }
    .content { width: 100% !important; }
}

@media (max-width: 480px) {
    .nav-logo { font-size: 13px !important; }
    .navbar { padding: 10px; }
    .friends-grid {
        grid-template-columns: 1fr;
    }
}
