:root { 
    --yt-bg: #0f172a; 
    --text: #f8fafc; 
    --accent: #38bdf8; 
    --text-soft: #9ca3af;
}

body {
    margin: 0;
    padding: 0;
    background: var(--yt-bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow-x: hidden;
}

/* ==========================================================================
   HEADER / BRAND
   ========================================================================== */
.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.logo-circle {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 0%, #38bdf8, transparent 55%),
        radial-gradient(circle at 70% 100%, #0ea5e9, transparent 55%),
        linear-gradient(145deg, #020617, #0b1120);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6), 0 18px 45px rgba(15, 23, 42, 0.95);
}

.logo-circle span {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #e5f2ff;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-soft);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

/* ==========================================================================
   FEED / NEWS ACTIONS (from index.php JS injection)
   ========================================================================== */
.card-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .card-actions {
        justify-content: space-between;
    }
}

.spinner {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.45);
    border-top-color: var(--accent);
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   SIDEBAR & MORE MENU 
   ========================================================================== */
.yt-sidebar {
    width: 300px !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible !important;
    z-index: 1000;
    border-right: 1px solid #2f3336;
}

.sidebar-main-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 0;
    padding-bottom: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.sidebar-main-nav a, #moreBtn {
    padding: 12px 15px;
    text-decoration: none;
    color: #e7e9ea;
    display: flex;
    align-items: left;
    gap: 15px;
    border-radius: 9999px;
    transition: background-color 0.2s;
    font-size: 1.1rem;
}

.sidebar-main-nav a:hover, #moreBtn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-main-nav a.active {
    font-weight: 700;
}

#moreModal {
    position: fixed;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: rgba(101, 119, 134, 0.2) 0px 0px 15px, rgba(101, 119, 134, 0.15) 0px 0px 3px 1px;
    width: 260px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    flex-direction: column;
    padding: 8px 0;
    left: 15px;
}

#moreModal.active {
    display: flex;
}

#moreModal a {
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f1419;
    text-decoration: none;
    transition: background-color 0.2s;
    display: block;
}

#moreModal a:hover {
    background-color: rgba(15, 20, 25, 0.1);
}

#moreBtn {
    font-weight: 700;
    cursor: pointer;
    margin-top: 5px;
    border: none;
    background: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

/* Fallback for Dark Mode Environments */
@media (prefers-color-scheme: dark) {
    .yt-sidebar, #moreModal {
        background-color: #000000;
        border-color: #2f3336;
    }
    .sidebar-main-nav a, #moreBtn, #moreModal a {
        color: #e7e9ea;
    }
    .sidebar-main-nav a:hover, #moreBtn:hover, #moreModal a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    #moreModal {
        box-shadow: rgba(255, 255, 255, 0.2) 0px 0px 15px, rgba(255, 255, 255, 0.15) 0px 0px 3px 1px;
    }
}




/* ==========================================================================
   1. BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    color: #e5e7eb;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   2. HEADER & NAVIGATION (Loaded via headertop.php)
   ========================================================================== */
.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex: 1;
}

.logo-circle {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 0%, #38bdf8, transparent 55%),
                radial-gradient(circle at 70% 100%, #0ea5e9, transparent 55%),
                linear-gradient(145deg, #020617, #0b1120);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6), 0 18px 45px rgba(15, 23, 42, 0.95);
    flex-shrink: 0;
}

.logo-circle span {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #e5f2ff;
}

.brand-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 200px;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Search */
.yt-search {
    display: flex;
    width: 100%;
    max-width: 520px;
}

.yt-search-input {
    flex: 1;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.65);
    border-right: none;
    padding: 0.45rem 0.8rem;
    border-radius: 999px 0 0 999px;
    color: #e5e7eb;
    font-size: 0.88rem;
}

.yt-search-input::placeholder {
    color: #6b7280;
}

.yt-search-button {
    border-radius: 0 999px 999px 0;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(56, 189, 248, 0.15);
    color: #e5e7eb;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.yt-search-button:hover {
    background: #0ea5e9;
    color: #0b1120;
}

/* Top Actions */
.top-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 500px;
}

.yt-user-name {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-right: 0.15rem;
}

.auth-link {
    font-size: 0.82rem;
    color: #38bdf8;
}

/* ==========================================================================
   3. MAIN FEED & DISCOVER CARDS
   ========================================================================== */
.main-content-wrapper {
    padding: 10px;
    margin-left: 0;
}

.section-heading {
    font-size: 24px;
    font-weight: 800;
    padding: 20px 16px 0;
    max-width: 1000px;
    margin: 0; 
    color: #1e293b;
}

.discover-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
    max-width: 1000px;
    margin: 0; 
    padding-bottom: 80px;
}

.discover-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
    animation: fadeIn 0.5s ease;
}

.discover-card:hover {
    transform: translateY(-2px);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.discover-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #e2e8f0;
}

.discover-body {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.discover-label {
    color: #3498db;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.discover-card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: #1e293b;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.discover-summary {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Actions */
.card-actions {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: auto;
}

.card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    font-size: 14px;
    transition: color 0.2s;
    color: #000;
    font-weight: 600;
}

.card-actions button:hover {
    background-color: #f1f5f9;
    border-radius: 4px;
}

.card-actions button.liked,
.card-actions button.liked .count {
    color: #ef4444 !important;
}

/* ==========================================================================
   4. MODAL & COMMENTS
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: pop 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
}

.comment-input-area {
    margin-bottom: 20px;
}

.comment-input {
    width: 100%;
    height: 80px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    font-family: inherit;
    resize: none;
    color: #000;
}

.btn-primary {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

#commentsList {
    flex-grow: 1;
    overflow-y: auto;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    margin-top: 10px;
}

.comment-item {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.comment-user {
    font-weight: 700;
    color: #334155;
}

.comment-body {
    font-size: 14px;
    color: #0f172a;
    line-height: 1.4;
    white-space: pre-wrap;
}

.no-comments {
    text-align: center;
    color: #94a3b8;
    padding: 20px;
    font-style: italic;
}

/* ==========================================================================
   5. LOADER & ANIMATIONS
   ========================================================================== */
.loading-indicator {
    width: 100%;
    text-align: center;
    padding: 40px;
    display: none;
    grid-column: 1 / -1;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #cbd5e1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10000;
    font-size: 14px;
    white-space: nowrap;
}

/* ==========================================================================
   6. MOBILE MENU MODAL
   ========================================================================== */
.mobile-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(5px);
    z-index: 9999;
    overflow-y: auto;
    display: none; 
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-menu-modal.active {
    display: block;
    transform: translateX(0);
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #f8fafc;
    font-size: 24px;
    cursor: pointer;
    z-index: 10001;
    padding: 10px;
}

.mobile-menu-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-sizing: border-box;
}

.mobile-menu-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    padding-top: 10px;
}

.mobile-menu-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #f8fafc;
}

.mobile-menu-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
    letter-spacing: 2px;
}

.mobile-search-container {
    margin-bottom: 20px;
}

.mobile-search-form {
    display: flex;
}

.mobile-search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 8px;
    padding: 5px;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.mobile-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f8fafc;
    padding: 10px;
    font-size: 16px;
    outline: none;
}

.mobile-search-button {
    background: transparent;
    border: none;
    color: #f8fafc;
    padding: 0 15px;
    cursor: pointer;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 20px;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: #f8fafc;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.mobile-menu-link:hover, .mobile-menu-link.active {
    background: rgba(56, 189, 248, 0.1);
}

.mobile-menu-link i {
    width: 25px;
    text-align: center;
    color: #38bdf8;
}

.mobile-sub-menu {
    display: flex;
    flex-direction: column;
    padding-left: 55px;
    margin-bottom: 10px;
    gap: 2px;
}

.mobile-sub-link {
    color: #94a3b8;
    text-decoration: none;
    padding: 8px 0;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.mobile-sub-link:hover, .mobile-sub-link.active {
    color: #38bdf8;
}

.mobile-menu-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.mobile-menu-footer-title {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f8fafc;
    text-decoration: none;
    padding: 8px 0;
    font-size: 1rem;
}

.mobile-menu-action i {
    width: 20px;
    text-align: center;
    color: #94a3b8;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 100;
    margin-right: 15px;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #e5e7eb;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ==========================================================================
   7. SIDEBAR & MORE MENU
   ========================================================================== */
.yt-sidebar {
    width: 300px !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible !important;
    z-index: 1000;
    border-right: 1px solid #eff3f4;
}

.sidebar-main-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 0;
    padding-bottom: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.sidebar-main-nav a, #moreBtn {
    padding: 12px 15px;
    text-decoration: none;
    color: #0f1419;
    display: flex;
    align-items: left;
    gap: 15px;
    border-radius: 9999px;
    transition: background-color 0.2s;
    font-size: 1.1rem;
}

.sidebar-main-nav a:hover, #moreBtn:hover {
    background-color: rgba(15, 20, 25, 0.1);
}

.sidebar-main-nav a.active {
    font-weight: 700;
}



#moreModal.active {
    display: flex;
}

#moreModal a {
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f1419;
    text-decoration: none;
    transition: background-color 0.2s;
    display: block;
}

#moreModal a:hover {
    background-color: rgba(15, 20, 25, 0.1);
}

#moreBtn {
    font-weight: 700;
    cursor: pointer;
    margin-top: 5px;
    border: none;
    background: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

/* ==========================================================================
   8. RESPONSIVE DESIGN
   ========================================================================== */
/* Main Feed Grid Adjustments */
@media (min-width: 768px) { 
    .discover-grid { grid-template-columns: repeat(2, 1fr); } 
}

@media (min-width: 1024px) { 
    .discover-grid { grid-template-columns: repeat(4, 1fr); } 
}

/* Header/Menu Adjustments */
@media (max-width: 1100px) {
    .brand-title { font-size: 0.85rem; }
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    .top-actions { margin-left: auto; gap: 12px; }
    .brand-subtitle { display: block; font-size: 0.7rem; }
    .yt-sidebar {
        display: none !important;
    }
    body {
        margin-right: 0;
    }
    .main-content-wrapper {
        padding: 10px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-modal {
        display: none !important;
    }
    .main-content-wrapper {
        margin-left: 300px; 
        padding: 20px 80px 20px 20px; 
    }
}

/* Dark Mode Fallback for Sidebar */
@media (prefers-color-scheme: dark) {
    .yt-sidebar, #moreModal {
        background-color: #000000;
        border-color: #2f3336;
    }
    .sidebar-main-nav a, #moreBtn, #moreModal a {
        color: #e7e9ea;
    }
    .sidebar-main-nav a:hover, #moreBtn:hover, #moreModal a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    #moreModal {
        box-shadow: rgba(255, 255, 255, 0.2) 0px 0px 15px, rgba(255, 255, 255, 0.15) 0px 0px 3px 1px;
    }
}


/* ==========================================================================
   9. MOBILE HEADER STYLES
   ========================================================================== */
.mobile-header {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background-color: #000000;
    border-bottom: 1px solid #2f3336;
    z-index: 9000;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Make sure the hamburger menu shows properly inside the header */
.mobile-menu-toggle {
    margin-right: 0;
}

/* Adjustments for smaller screens */
@media (max-width: 768px) {
    /* Show the mobile header */
    .mobile-header {
        display: flex;
    }
    
    /* Ensure the hamburger button shows */
    .mobile-menu-toggle { 
        display: flex; 
    }
    
    /* Push the main body content down so it isn't hidden by the fixed mobile header */
    body {
        padding-top: 65px;
    }

    /* Hide the right static menu on mobile entirely (cleanup) */
    .right-static-menu { 
        display: none !important; 
    }
}