/* YouTube Video Aggregator - Mobile First CSS */

:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --accent: #ff0050;
    --accent-hover: #e00045;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header */
.site-header {
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.site-logo svg {
    color: var(--accent);
}

.header-search {
    display: flex;
    align-items: center;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    width: 100%;
    max-width: 320px;
}

.header-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 100%;
}

.header-search button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.header-search button:hover {
    color: var(--accent);
}

.btn-submit-header {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    border-radius: 9999px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-submit-header:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* Categories Nav */
.categories-nav {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.categories-nav::-webkit-scrollbar {
    display: none;
}

.categories-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.cat-link {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.cat-link:hover, .cat-link.active {
    background: var(--accent);
    color: #fff;
}

/* Main Container */
.main-content {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    flex: 1;
}

.section-header {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
}

@media (min-width: 576px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Video Card */
.video-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--bg-card-hover);
}

.thumb-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .thumb-container img {
    transform: scale(1.05);
}

.badge-category {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.badge-time {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.card-body {
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.4rem;
}

/* Detail Page Layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .detail-layout {
        grid-template-columns: 1fr 340px;
    }
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-info-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.video-detail-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

/* Download Buttons Below Title */
.video-download-wrapper {
    display: flex;
    gap: 0.85rem;
    margin: 1rem 0 1.25rem 0;
    width: 100%;
}

.btn-download {
    flex: 1 1 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: #ffffff !important;
    font-family: var(--font-sans);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: left 0.75s ease;
}

.btn-download:hover::before {
    left: 125%;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    filter: brightness(1.08);
}

.btn-download:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-download i {
    font-size: 1.45rem;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.btn-download:hover i {
    transform: translateY(2px) scale(1.1);
}

.btn-download-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.btn-download-main {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.btn-download-sub {
    font-size: 0.75rem;
    opacity: 0.88;
    font-weight: 500;
    margin-top: 2px;
}

.btn-download-server1 {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-download-server1:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.55);
}

.btn-download-server2 {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-download-server2:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.55);
}

@media (max-width: 560px) {
    .video-download-wrapper {
        flex-direction: column;
        gap: 0.65rem;
    }
    .btn-download {
        width: 100%;
        padding: 0.8rem 1rem;
    }
}

.video-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-share {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.2s ease;
}

.btn-share:hover {
    opacity: 0.9;
}

.btn-whatsapp { background: #25D366; }
.btn-facebook { background: #1877F2; }
.btn-x { background: #000; }
.btn-copy { background: #475569; }

.video-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: pre-line;
    line-height: 1.6;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
}

.breadcrumbs a:hover {
    color: var(--accent);
}

/* Sidebar */
.sidebar-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2rem;
}

.page-link {
    padding: 0.5rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
}

.page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-link:hover:not(.active) {
    background: var(--bg-card-hover);
}

/* Footer */
.site-footer {
    background: #090d16;
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem 1rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 2fr 1fr;
    }
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    max-width: 480px;
}

.footer-links h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: 1280px;
    margin: 1.5rem auto 0;
    padding-top: 1rem;
    padding-bottom: 4rem; /* Extra spacing for fixed sticky bar */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Fixed Mobile Sticky Navigation Bar (Matching Screenshot) */
.mobile-sticky-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: space-between !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 999999 !important;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.4) !important;
    background: #0f172a;
}

.mobile-sticky-bar .sticky-bar-item {
    flex: 1 1 0% !important;
    width: 33.333% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px 2px !important;
    margin: 0 !important;
    text-decoration: none !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    transition: opacity 0.2s ease, filter 0.2s ease !important;
}

.mobile-sticky-bar .sticky-bar-item i {
    font-size: 1.35rem !important;
    margin-bottom: 3px !important;
    display: block !important;
}

.mobile-sticky-bar .sticky-bar-item span {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

.mobile-sticky-bar .sticky-bar-item:hover, 
.mobile-sticky-bar .sticky-bar-item:active {
    filter: brightness(1.15) !important;
    opacity: 0.95 !important;
}

/* =========================================================================
   CENTRALIZED ADVERTISING SYSTEM STYLES
   ========================================================================= */
.ad-slot-container {
    width: 100%;
    margin: 1.25rem auto;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

.ad-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    opacity: 0.75;
}

.ad-content-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0 auto;
}

.ad-content-wrapper iframe,
.ad-content-wrapper img,
.ad-content-wrapper ins {
    max-width: 100% !important;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto;
}

/* Specific Slot Placements */
.ad-header-banner {
    margin: 0.5rem auto 1.5rem;
    max-width: 970px;
}

.ad-footer-banner {
    margin: 2rem auto 1rem;
    max-width: 970px;
}

.ad-slot-video_above_player {
    margin: 0 auto 1rem;
}

.ad-slot-video_below_player {
    margin: 1rem auto 1.25rem;
}

.ad-slot-video_below_buttons {
    margin: 1.25rem auto;
    padding: 0.75rem 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.ad-sidebar-slot {
    margin-bottom: 1.5rem;
}

/* In-Feed Native Grid Card */
.ad-in-feed-card {
    background: linear-gradient(145deg, #1e293b, #151f30);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ad-in-feed-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.ad-in-feed-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 0, 80, 0.85);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ad-in-feed-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 1rem;
    text-align: center;
    box-sizing: border-box;
}

.ad-in-feed-content iframe,
.ad-in-feed-content img {
    max-width: 100% !important;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Placeholder Box for Visual Preview */
.ad-placeholder-box {
    width: 100%;
    min-height: 90px;
    padding: 1.25rem 1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1.5px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ad-placeholder-box:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(30, 41, 59, 0.85);
}

.ad-placeholder-box i {
    font-size: 2rem;
    color: var(--accent);
    opacity: 0.8;
}

.ad-placeholder-text {
    text-align: left;
}

.ad-placeholder-text strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.ad-placeholder-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ad-placeholder-text code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 4px;
    color: #38bdf8;
    font-size: 0.75rem;
}

.ad-in-feed-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.ad-in-feed-placeholder i {
    font-size: 2rem;
    color: var(--accent);
    opacity: 0.7;
}

.ad-in-feed-placeholder strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ad-in-feed-placeholder p {
    font-size: 0.75rem;
    margin: 0;
}

@media (max-width: 640px) {
    .ad-placeholder-box {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 1rem;
    }
    .ad-placeholder-text {
        text-align: center;
    }
    .ad-slot-container {
        margin: 0.85rem auto;
    }
}
