/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0f0f0f;
    color: #e1e1e1;
    min-height: 100vh;
    line-height: 1.5;
}
a { text-decoration: none; color: inherit; }

/* ===== HEADER ===== */
.site-header {
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 20px;
}
.logo a {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ff0000;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.search-bar {
    flex: 1;
    max-width: 600px;
}
.search-bar form {
    display: flex;
    border: 1px solid #333;
    border-radius: 20px;
    overflow: hidden;
    background: #121212;
}
.search-bar input {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #e1e1e1;
    font-size: 0.9rem;
    outline: none;
}
.search-bar button {
    padding: 8px 16px;
    border: none;
    background: #2a2a2a;
    color: #aaa;
    cursor: pointer;
    font-size: 0.9rem;
}
.search-bar button:hover { background: #333; }
.header-actions { margin-left: auto; }
.btn-login {
    padding: 8px 16px;
    background: #ff0000;
    color: #fff;
    border-radius: 18px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-login:hover { background: #cc0000; }

/* ===== CATEGORY BAR ===== */
.category-bar {
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.category-bar::-webkit-scrollbar { height: 0; }
.category-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 8px;
    white-space: nowrap;
}
.cat-link {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #aaa;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.cat-link:hover { color: #fff; }
.cat-link.active {
    color: #fff;
    border-bottom-color: #ff0000;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
}
.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}
.video-count {
    font-size: 0.85rem;
    color: #888;
}

/* ===== VIDEO GRID ===== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ===== VIDEO CARD ===== */
.video-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}
.video-card:hover { transform: translateY(-2px); }

.video-thumb {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    background: #1a1a1a;
    overflow: hidden;
}
.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.video-card:hover .video-thumb img { transform: scale(1.05); }

.thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}
.thumb-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s;
}
.video-card:hover .play-overlay { opacity: 1; }
.play-btn {
    width: 50px;
    height: 50px;
    background: rgba(255,0,0,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.source-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}
.badge-youtube { background: #ff0000; color: #fff; }
.badge-dailymotion { background: #0066dc; color: #fff; }
.badge-vimeo { background: #1ab7ea; color: #fff; }
.badge-rumble { background: #f5c518; color: #000; }
.badge-twitch { background: #9146ff; color: #fff; }
.badge-tiktok { background: #000; color: #fff; border: 1px solid #333; }
.badge-facebook { background: #1877f2; color: #fff; }
.badge-hls { background: #28a745; color: #fff; }
.badge-direct { background: #6f42c1; color: #fff; }
.badge-custom { background: #555; color: #fff; }
.badge-unknown { background: #333; color: #888; }

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.video-details {
    padding: 10px 4px;
}
.video-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e1e1e1;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.video-title:hover { color: #fff; }
.video-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.watch-date {
    font-size: 0.8rem;
    color: #888;
}
.download-btn-small {
    font-size: 0.75rem;
    color: #ff0000;
    font-weight: 600;
    padding: 2px 8px;
    border: 1px solid #ff0000;
    border-radius: 12px;
    transition: all 0.2s;
}
.download-btn-small:hover {
    background: #ff0000;
    color: #fff;
}

/* ===== NO VIDEOS ===== */
.no-videos {
    text-align: center;
    padding: 80px 20px;
}
.no-videos-icon { font-size: 4rem; margin-bottom: 16px; }
.no-videos h3 { font-size: 1.3rem; color: #fff; margin-bottom: 8px; }
.no-videos p { color: #888; }

/* ===== WATCH PAGE ===== */
.watch-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
.watch-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}
.watch-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.watch-player iframe,
.watch-player video {
    width: 100%;
    height: 100%;
    border: none;
}
.watch-info {
    padding: 16px 0;
}
.watch-info h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.3;
}
.watch-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.download-btn {
    padding: 8px 16px;
    background: #ff0000;
    color: #fff;
    border-radius: 18px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}
.download-btn:hover { background: #cc0000; }

.related-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #2a2a2a;
}
.related-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}

/* ===== VIDEO MODAL ===== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
}
.video-modal.active { display: block; }
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}
.modal-content {
    position: relative;
    max-width: 900px;
    margin: 40px auto;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
}
.modal-header h3 {
    font-size: 1rem;
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
}
.modal-close:hover { color: #fff; }
.modal-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

/* ===== FOOTER ===== */
.site-footer {
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    padding: 20px;
    margin-top: 40px;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
}

/* ===== ADMIN PAGES ===== */
.admin-page { background: #111; }
.login-box {
    max-width: 400px;
    margin: 100px auto;
    background: #1a1a1a;
    padding: 30px;
    border-radius: 12px;
}
.login-box h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #ff0000;
}
.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #222;
    color: #fff;
    font-size: 1rem;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: #ff0000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}
.login-box button:hover { background: #cc0000; }
.error { color: #ff4444; text-align: center; margin-bottom: 10px; }
.success { color: #44ff44; text-align: center; margin-bottom: 10px; }

.dashboard { max-width: 900px; margin: 0 auto; padding: 20px; }
.dashboard header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-top-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.logout-btn { color: #ff0000; text-decoration: none; font-weight: 600; }

.add-video-form {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.add-video-form h3 { margin-bottom: 10px; color: #ff0000; }
.add-video-form .hint { color: #888; font-size: 0.85rem; margin-bottom: 15px; line-height: 1.4; }
.add-video-form input,
.add-video-form select,
.add-video-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #222;
    color: #fff;
    font-size: 1rem;
    font-family: monospace;
}
.add-video-form textarea { resize: vertical; min-height: 150px; }
.add-video-form button {
    width: 100%;
    padding: 12px;
    background: #ff0000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}
.add-all-btn {
    width: 100%;
    padding: 14px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 15px;
}
.add-all-btn:hover { background: #218838; }

.video-list { background: #1a1a1a; padding: 20px; border-radius: 12px; }
.video-list h3 { margin-bottom: 15px; color: #ff0000; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #333; }
th { color: #888; font-size: 0.85rem; }
.delete-btn { color: #ff4444; text-decoration: none; font-weight: 600; }

.url-list { max-height: 500px; overflow-y: auto; margin-top: 15px; }
.url-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #333;
    gap: 10px;
}
.url-item:hover { background: #222; }
.url-num { color: #555; font-size: 0.8rem; font-weight: 700; min-width: 30px; }
.url-text { flex: 1; font-size: 0.8rem; word-break: break-all; color: #aaa; font-family: monospace; }
.add-single-btn {
    padding: 6px 14px;
    background: #ff0000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.add-single-btn:hover { background: #cc0000; }

.ad-manager-card {
    border: 1px solid #2f2f2f;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
    background: #171717;
}
.ad-manager-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.ad-key-label {
    color: #888;
    font-size: 0.8rem;
    font-family: monospace;
}
.ad-active-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ddd;
    font-size: 0.9rem;
}

.ad-slot {
    width: 100%;
    margin: 0 auto 20px;
    text-align: center;
    overflow: hidden;
}
.ad-slot iframe,
.ad-slot img,
.ad-slot ins,
.ad-slot script,
.ad-slot div {
    max-width: 100%;
}
.ad-slot img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}
.ad-grid-break {
    grid-column: 1 / -1;
}
.script-ad-slot {
    margin: 0;
}
.mobile-only-ad {
    display: none;
}
.watch-sidebar {
    width: 100%;
}
.header-banner-inline {
    margin-bottom: 20px;
}

.interstitial-ad {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.interstitial-ad.active {
    display: flex;
}
.interstitial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.82);
}
.interstitial-box {
    position: relative;
    width: min(92%, 760px);
    max-height: 90%;
    background: #181818;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 14px;
    overflow: auto;
    z-index: 2;
}
.interstitial-top {
    color: #fff;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}
.interstitial-content {
    min-height: 160px;
}
.interstitial-placeholder {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    color: #aaa;
    border-radius: 8px;
}
.interstitial-skip {
    margin-top: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: #ff0000;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.interstitial-skip:disabled {
    background: #555;
    cursor: not-allowed;
}

.duplicate-group {
    border: 1px solid #333;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
    background: #171717;
}
.duplicate-head {
    margin-bottom: 10px;
}
.duplicate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #262626;
}
.duplicate-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
.keep-label {
    color: #44ff44;
}

.adblock-bait {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
}
.adblock-gate {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
}
.adblock-gate.active {
    display: flex;
}
.adblock-gate-box {
    width: min(100%, 520px);
    background: #181818;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.adblock-gate-box h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 12px;
}
.adblock-gate-box p {
    color: #cfcfcf;
    margin-bottom: 10px;
}
.adblock-note {
    color: #999;
    font-size: 0.92rem;
    margin-bottom: 18px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .watch-container { grid-template-columns: 1fr; }
    .watch-sidebar { display: none; }
}

@media (max-width: 768px) {
    .header-inner { gap: 12px; }
    .logo a { font-size: 1.1rem; }
    .search-bar { max-width: none; }
    .search-bar input { padding: 6px 12px; font-size: 0.85rem; }
    .search-bar button { padding: 6px 12px; }
    .btn-login { padding: 6px 12px; font-size: 0.8rem; }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    .main-content { padding: 16px; }

    .watch-info h1 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .site-header { height: 50px; }
    .header-inner { height: 50px; padding: 0 12px; }
    .logo a { font-size: 1rem; }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .main-content { padding: 12px; }
    .section-header h2 { font-size: 1rem; }

    .mobile-only-ad {
        display: block;
        position: sticky;
        bottom: 0;
        z-index: 1200;
        background: #111;
        padding: 6px;
        margin: 0;
    }

    .modal-content { margin: 10px; }
}
