/* ========================================
   Global Layout & Responsive Grid
   ======================================== */

/* Main Content Container */
.main-content {
    padding-top: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Standard 3-Column Feed Layout */
.feed-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 24px;
    max-width: 1440px;
    margin: 0 auto;
    align-items: start;
}

/* 2-Column Layout (No Right Sidebar) */
.feed-layout.full-width {
    grid-template-columns: 280px 1fr;
    max-width: 1100px;
}

.feed-container {
    min-width: 0; /* Prevents flex/grid blowouts */
    width: 100%;
}

/* Sidebar Widgets (Contacts, Suggestions, etc.) */
.sidebar-widget {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.sidebar-widget h3 {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sidebar Sticky Positioning */
.left-sidebar, .right-sidebar {
    position: sticky;
    top: 20px; /* Aligned with .main-content padding-top */
    height: auto;
    max-height: calc(100dvh - 40px); /* Adjusted for new top position + 20px bottom buffer */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    padding-bottom: 40px; /* Buffer to ensure the last link is fully reachable */
}

/* ========================================
   Responsive Grid System (Mobile First)
   ======================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 12px; }
[class*="col-"] {
    padding: 0 12px;
    min-height: 1px;
    width: 100%;
    box-sizing: border-box;
}

/* Extra Small (Default / Phones) */
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Small (Landscape Phones / 576px and up) */
@media (min-width: 576px) {
    .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Medium (Tablets / 768px and up) */
@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    
    .hide-md { display: none !important; }
    .show-md { display: block !important; }
}

/* Large (Desktops / 992px and up) */
@media (min-width: 992px) {
    .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    
    .hide-lg { display: none !important; }
    .show-lg { display: block !important; }
}

/* Extra Large (Large Desktops / 1200px and up) */
@media (min-width: 1200px) {
    .col-xl-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-xl-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
    .col-xl-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
    .col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Utility Helpers */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.text-center { text-align: center !important; }
.w-100 { width: 100% !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

/* ========================================
   Footer Styling
   ======================================== */
.footer {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 60px 0 30px;
    margin-top: 60px;
    position: relative;
    z-index: 10;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-section h4 {
    color: var(--white);
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 15px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    display: inline-block;
}

.footer-section ul li a:hover {
    color: var(--accent-cyan);
    transform: translateX(5px);
}

.social-links {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.footer-bottom {
    max-width: 1300px;
    margin: 50px auto 0;
    padding: 30px 24px 0;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column; /* Stack items vertically */
    justify-content: center; /* Center content vertically */
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s ease;
    font-weight: 600;
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* XL Desktop (1400px and down) */
@media (max-width: 1400px) {
    .feed-layout {
        grid-template-columns: 260px 1fr 280px;
        gap: 20px;
        padding: 0 20px;
    }
}

/* LG Desktop / Laptop (1200px and down) */
@media (max-width: 1200px) {
    .feed-layout {
        grid-template-columns: 240px 1fr 260px;
    }
    .feed-layout.full-width {
        grid-template-columns: 240px 1fr;
    }
}

/* Tablet Landscape (992px and down) */
@media (max-width: 992px) {
    .feed-layout, .feed-layout.full-width {
        grid-template-columns: 1fr; /* Stack everything */
        padding: 0 16px;
    }

    /* Sidebars hidden on tablet - moved to top/bottom navs */
    .left-sidebar, .right-sidebar {
        display: none !important;
    }

    .main-content {
        padding-top: 75px; /* Account for sticky top navbar */
    }

    .footer {
        padding-bottom: 100px; /* Space for mobile bottom nav */
    }

    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px 20px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
}

/* Mobile Portrait (768px and down) */
@media (max-width: 768px) {
    .container {
        padding: 0 !important;
    }
    
    .feed-layout {
        padding: 0 !important;
    }

    /* Content stretches edge-to-edge on mobile for better focus */
    .feed-container {
        border-radius: 0;
    }
    
    /* Added padding at bottom for the fixed mobile navbar */
    body {
        padding-bottom: 70px !important;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Sidebar & Online Friends Contacts Styling */
.sidebar-contact-item, .online-friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: background 0.2s;
}

.sidebar-contact-item:hover, .online-friend-item:hover {
    background: var(--bg-hover);
}

.sidebar-contact-item .profile-tron-rings, .online-friend-item .profile-tron-rings {
    width: 32px; /* Match avatar size */
    height: 32px;
    flex-shrink: 0;
}

.sidebar-contact-item span, .online-friend-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}