/* Reset and CSS Variables */
:root {
    --bg-dark: #000000;
    --bg-light: #ffffff;
    --accent-primary: #ff3040;
    --accent-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --card-bg-dark: rgba(26, 26, 26, 0.85);
    --card-bg-light: rgba(245, 245, 245, 0.95);
    --text-primary-dark: #ffffff;
    --text-secondary-dark: #a8a8a8;
    --text-primary-light: #262626;
    --text-secondary-light: #8e8e8e;
    --border-dark: #262626;
    --border-light: #dbdbdb;
    --active-bg-dark: rgba(255, 255, 255, 0.1);
    --glass-blur: 15px;
    --reel-bg-dark: #000000;
    --reel-bg-light: #ffffff;
}

body.light-theme {
    --bg-color: var(--bg-light);
    --text-primary: #000;
    --text-secondary: var(--text-secondary-light);
    --card-bg: var(--card-bg-light);
    --border-color: var(--border-light);
    --active-bg: rgba(0, 0, 0, 0.05);
    --reel-bg: var(--reel-bg-light);
    font-weight: 500;
}

body.dark-theme {
    --bg-color: var(--bg-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --card-bg: var(--card-bg-dark);
    --border-color: var(--border-dark);
    --active-bg: var(--active-bg-dark);
    --reel-bg: var(--reel-bg-dark);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Layout */
.sidebar {
    width: 240px;
    height: 100vh;
    padding: 24px 12px;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.logo-container {
    padding: 20px 12px 40px;
}

.logo-text {
    font-family: 'Outfit';
    font-weight: 700;
    font-size: 24px;
}

.logo-icon {
    display: none;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    margin-bottom: 8px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    gap: 16px;
}

.nav-links a:hover {
    background-color: var(--active-bg);
}

.nav-links li.active a {
    font-weight: 700;
}

.nav-links i {
    width: 24px;
    height: 24px;
}

.profile-pic-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: 1px solid var(--border-color);
}

.sidebar-footer {
    padding: 12px;
}

/* Main Content Area */
.main-content {
    margin-left: 240px;
    width: calc(100% - 240px);
    display: flex;
    justify-content: center;
    padding-top: 20px;
}

.feed-wrapper {
    max-width: 630px;
    width: 100%;
}

/* Stories */
.stories-container {
    margin-bottom: 24px;
    padding: 16px 0;
}

.stories-track {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 8px;
    scrollbar-width: none;
}

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

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 2px;
    background: var(--accent-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.story-item:hover .story-ring {
    transform: scale(1.05);
}

/* Illuminated effect for active stories */
.story-ring.active-story {
    box-shadow: 0 0 15px rgba(220, 39, 67, 0.6);
    animation: story-pulse 2s infinite;
}

@keyframes story-pulse {
    0% { box-shadow: 0 0 10px rgba(220, 39, 67, 0.4); }
    50% { box-shadow: 0 0 20px rgba(220, 39, 67, 0.7); }
    100% { box-shadow: 0 0 10px rgba(220, 39, 67, 0.4); }
}

.story-ring.viewed-story {
    background: none;
    border: 1px solid #8e8e8e;
}

.story-pic {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 2px solid var(--bg-color);
    background-size: cover;
    background-position: center;
}

.story-username {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 66px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Feed Posts */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    background-color: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.post-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.post-profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
}

.post-username {
    font-size: 14px;
    font-weight: 600;
}

.post-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-image-container {
    width: 100%;
    aspect-ratio: 4/5;
    max-height: 580px;
    background-color: var(--reel-bg);
    position: relative;
    overflow: hidden;
}

.post-image-container.reel-container {
    aspect-ratio: 9/16;
    max-height: 580px;
    margin: 0 auto;
    background-color: var(--reel-bg);
}

/* Video Styles */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.post-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 10;
}

.mute-toggle {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.mute-toggle:hover {
    transform: scale(1.1);
}

.reel-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    pointer-events: none;
    opacity: 0.8;
}

.reel-icon {
    color: white;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.5));
}

/* Carousel Styles */
.carousel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    border: none;
    color: #262626;
}

.post-image-container:hover .carousel-nav {
    opacity: 1;
}

.carousel-nav.prev {
    left: 8px;
}

.carousel-nav.next {
    right: 8px;
}

.carousel-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
}

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.indicator.active {
    background: #ffffff;
    transform: scale(1.1);
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px 10px;
}

.post-actions-left {
    display: flex;
    gap: 16px;
}

.post-actions-right {
    display: flex;
}

.post-actions i {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.post-actions i:hover {
    transform: scale(1.15);
}

.like-btn.active {
    color: var(--accent-primary);
    fill: var(--accent-primary);
}

.post-likes {
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
}

.post-caption {
    padding: 8px 14px;
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
}

.caption-username {
    font-weight: 600;
    margin-right: 8px;
    cursor: pointer;
}

.caption-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.more-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    margin-left: 2px;
}

.more-btn:hover {
    color: var(--text-primary);
}

.post-comments-count {
    padding: 4px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.post-time {
    padding: 8px 14px 16px;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Suggestions Sidebar */
.suggestions-sidebar {
    width: 320px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.current-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-pic-medium {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
}

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

.username {
    font-size: 14px;
    font-weight: 600;
}

.fullname {
    font-size: 14px;
    color: var(--text-secondary);
}

.action-link {
    background: none;
    border: none;
    color: #0095f6;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.view-all {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggested-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
}

.suggested-meta {
    display: flex;
    flex-direction: column;
}

.suggested-username {
    font-size: 14px;
    font-weight: 600;
}

.suggested-reason {
    font-size: 12px;
    color: var(--text-secondary);
}

.aside-footer {
    margin-top: 24px;
    font-size: 12px;
    color: #c7c7c7;
    line-height: 1.5;
}

.copyright {
    display: block;
    margin-top: 16px;
}

/* Theme Toggle Component */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

/* Interactions */
.like-zoom {
    animation: zoom 0.4s ease;
}

@keyframes zoom {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.15); }
}

/* Story Viewer Component */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(1.1); }
    to { opacity: 1; transform: scale(1); }
}

.viewer-content {
    position: relative;
    max-width: 450px;
    height: 90vh;
    width: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

#viewer-img {
    height: 100%;
    width: 100%;
    object-fit: contain;
}

.close-viewer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 10;
}

.close-viewer i {
    width: 32px;
    height: 32px;
}
.profile-pic-mini, .profile-pic-medium {
    background-image: url('logo-nexus.jpg');
    background-size: cover;
    background-position: center;
}

.hashtag {
    color: #00376b; /* Blue for light mode links */
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

body.dark-theme .hashtag {
    color: #e0f1ff; /* Light blue for dark mode links */
}

.hashtag:hover {
    filter: brightness(1.2);
    text-decoration: underline;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 72px;
        padding: 24px 0;
        align-items: center;
    }
    .logo-text { display: none; }
    .logo-icon { display: block; font-size: 24px;}
    .nav-links span { display: none; }
    .nav-links li a { justify-content: center; padding: 12px; }
    .main-content { margin-left: 72px; width: calc(100% - 72px); }
    .sidebar-footer span { display: none; }
}
