/* 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;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   HEADER & NAVIGATION (headertop.php)
   ========================================================================== */
header.qtp-videos-header {
    background: radial-gradient(circle at top, #020617, #020617 55%, #000 100%);
    padding: 12px 16px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    position: relative;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.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-header-center {
    flex: 0 1 640px;
    display: flex;
    justify-content: center;
}

.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;
}

/* Nav Shell */
.nav-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.nav-main {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.nav-links {
    display: inline-flex;
    align-items: flex-end;
    gap: 0.25rem;
}

.nav-links a {
    font-size: 0.82rem;
    padding: 0.45rem 0.6rem 0.4rem;
    border-bottom: 2px solid transparent;
    color: #9ca3af;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #38bdf8;
    border-bottom-color: rgba(148, 163, 184, 0.7);
}

.nav-links a.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
    font-weight: 500;
}

/* ==========================================================================
   MAIN FEED & DISCOVER CARDS (index.php)
   ========================================================================== */
.section-heading {
    font-size: 24px;
    font-weight: 800;
    padding: 20px 16px 0;
    max-width: 1400px;
    margin: 0 auto;
    color: #1e293b;
}

.discover-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* Show 2 per row on tablets */
@media (min-width: 768px) { .discover-grid { grid-template-columns: repeat(2, 1fr); } }

/* Force 4 per row on laptops and desktops (anything wider than 1024px) */
@media (min-width: 1024px) { .discover-grid { grid-template-columns: repeat(4, 1fr); } }

.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;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.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;
}

/* ==========================================================================
   MODAL & COMMENTS (index.php)
   ========================================================================== */
.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;
}

@keyframes pop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.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;
}

/* ==========================================================================
   LOADER & TOAST
   ========================================================================== */
.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); }
}

.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;
}

/* ==========================================================================
   MOBILE MENU MODAL (headertop.php)
   ========================================================================== */
.mobile-menu-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-modal.active {
    display: flex;
    opacity: 1;
}

.mobile-menu-content {
    background: #0f172a;
    border-radius: 16px;
    width: 90%;
    max-width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.mobile-menu-modal.active .mobile-menu-content {
    transform: translateY(0);
}

.mobile-menu-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.95);
    border-radius: 16px 16px 0 0;
}

.mobile-menu-title {
    font-size: 24px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 4px;
}

.mobile-menu-subtitle {
    font-size: 14px;
    color: #94a3b8;
}

.mobile-search-container {
    padding: 20px 24px 0;
}

.mobile-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.mobile-search-input {
    flex: 1;
    padding: 15px 50px 15px 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mobile-search-button {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.mobile-menu-links {
    padding: 20px 0;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.2s;
}

.mobile-menu-link:hover {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    padding-left: 28px;
}

.mobile-menu-link.active {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-left: 4px solid #38bdf8;
}

.mobile-menu-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.mobile-menu-footer {
    padding: 20px 24px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 0 0 16px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.mobile-menu-footer-title {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-action {
    display: flex;
    align-items: center;
    padding: 14px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 10px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
}

.mobile-menu-action:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    transform: translateY(-2px);
}

.mobile-menu-action i {
    margin-right: 12px;
    font-size: 16px;
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 50%;
    color: #e5e7eb;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10000;
}

.mobile-menu-close:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border-color: #38bdf8;
    transform: rotate(90deg);
}

/* Mobile Menu Toggle Button */
.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);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
    .yt-header-center { flex: 0 1 400px; }
    .brand-title { font-size: 0.85rem; }
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    .yt-header-center { display: none; }
    .nav-shell { display: none; }
    .top-actions { margin-left: auto; gap: 12px; }
    .brand-subtitle { display: block; font-size: 0.7rem; }
}

@media (max-width: 480px) {
    header.qtp-videos-header { padding: 10px 12px 6px; }
    .brand { gap: 8px; }
    .logo-circle { width: 34px; height: 34px; }
    .brand-title { font-size: 0.8rem; }
    .brand-subtitle { font-size: 0.65rem; }
}














/* Desktop Sidebar - Hidden on Mobile */
.yt-sidebar {
    width: 240px;
    background-color: #0f172a;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.yt-sidebar a {
    color: #e2e8f0;
    text-decoration: none;
    padding: 10px 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.yt-sidebar a:hover,
.yt-sidebar a.active {
    background-color: rgba(148, 163, 184, 0.1);
}

.yt-sidebar a.active {
    color: #38bdf8;
    font-weight: 500;
}

/* Hide Desktop Sidebar on Mobile */
@media (max-width: 768px) {
    .yt-sidebar {
        display: none !important;
    }
}

/* Mobile Menu Styling - Hidden by default */
.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;
}

/* Sub-menu styling */
.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;
}

/* Responsive adjustments */
@media (min-width: 769px) {
    .mobile-menu-modal {
        display: none !important;
    }
}