@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

:root {
    --bg-color: #1D1D1D; /* Dark Dirt/Stone */
    --card-bg: #3C3C3C; /* Stone */
    --input-bg: #2c2c2c;
    --text-color: #FFFFFF;
    --text-muted: #AAAAAA;
    --primary-color: #54E358; /* XP Orb Green */
    --primary-hover: #3C8527; /* Darker Green */
    --secondary-color: #3C8527;
    --error-color: #FF5555; /* Minecraft Red */
    --error-bg: rgba(255, 85, 85, 0.2);
    --border-color: #585858;
    --overlay-bg: rgba(0, 0, 0, 0.85);
}

/* =========================================
   Reset & Base Styles
   ========================================= */
html {
    height: 100%;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    image-rendering: pixelated; /* Ensure images look crisp */
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}

/* =========================================
   Layout Utilities
   ========================================= */
.container {
    width: 100%;
    max-width: 2900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Ensure the main content container grows to fill available space */
body > .container {
    flex: 1 0 auto;
}

.main-layout {
    display: flex;
    gap: 2rem;
}

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

/* =========================================
   Components: Buttons
   ========================================= */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 0; /* No rounded corners for pixel look */
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #000; /* Pixel border */
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5); /* Hard shadow */
    text-transform: uppercase;
    font-size: 0.8rem;

    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #000;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    text-decoration: none;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--text-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

.action-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    display: inline-block;
}

.edit-btn {
    background-color: var(--secondary-color);
    color: #000;
}

.delete-btn {
    background-color: var(--error-color);
    color: #fff;
}

/* =========================================
   Components: Forms
   ========================================= */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}

.error-message {
    background-color: var(--error-bg);
    color: var(--error-color);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* =========================================
   Components: Navigation (Public)
   ========================================= */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.public-nav-links {
    display: flex;
    gap: 1.5rem;
}

.public-nav-links a {
    color: var(--text-color);
    font-weight: 600;
}

.public-nav-links a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.search-form {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.search-form input {
    width: 300px;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    padding: 10px;

    font-size: 0.8rem;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
    border-radius: 0;
}

.search-filter {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    padding: 10px;

    font-size: 0.7rem;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
    border-radius: 0;
    cursor: pointer;
    width: 150px; /* Fixed width */
}

.search-btn {
    background-color: var(--primary-color);
    color: #000;
    border: 2px solid #000;
    padding: 10px 15px;
    cursor: pointer;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background-color: var(--primary-hover);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

/* =========================================
   Components: Sidebar (Public & Admin)
   ========================================= */
.sidebar-public {
    width: 200px;
    flex-shrink: 0;
}

.sidebar-public ul, .nav-links {
    list-style: none;
    padding: 0;
}

.sidebar-public li, .nav-links li {
    margin-bottom: 0.5rem;
}

.sidebar-public a, .nav-links a {
    color: var(--text-color);
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.sidebar-public a:hover, .sidebar-public a.active,
.nav-links a:hover, .nav-links a.active {
    background-color: rgba(187, 134, 252, 0.1);
    color: var(--primary-color);
    text-decoration: none;
}

/* =========================================
   Components: Video Cards & Thumbnails
   ========================================= */
.video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-card a {
    text-decoration: none !important;
}

.video-card a:hover {
    text-decoration: none !important;
}

.thumbnail {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%; /* Standard 16:9 Aspect Ratio */
}

.thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay-text {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--overlay-bg);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}

.video-info {
    padding: 1rem;
}

.video-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-color);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}



.category-tag {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* =========================================
   Components: Tables
   ========================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--input-bg);
}

tr:last-child td {
    border-bottom: none;
}

/* =========================================
   Components: Slider
   ========================================= */
.featured-slider {
    width: 100%;
    padding-bottom: 2rem;
}

.swiper-button-next, .swiper-button-prev {
    color: var(--primary-color);
}

.swiper-pagination-bullet-active {
    background: var(--primary-color);
}

.slider-card {
    height: 100%;
}

/* =========================================
   Page: Login
   ========================================= */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

/* =========================================
   Page: Admin Dashboard
   ========================================= */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--card-bg);
    padding: 1rem;
    border-right: 1px solid var(--border-color);
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 2rem;
}

/* =========================================
   Page: Watch Video
   ========================================= */
.watch-layout {
    max-width: 1000px;
    margin: 0 auto; /* Center it */
}

.video-player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.video-player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-details h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.category-badge {
    color: var(--secondary-color);
}

.tags {
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    background-color: var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    color: #ccc;
}

.description {
    line-height: 1.6;
    color: #ccc;
}
/* =========================================
   Components: Navigation (Desktop Default)
   ========================================= */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding-left: 1rem; /* Small padding from edge */
    padding-right: 1rem;
    max-width: 100%; /* Full width */
}

.mobile-header {
    display: flex;
    align-items: center;
    width: auto; /* Auto width on desktop */
    margin-bottom: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.menu-toggle {
    display: none; /* Hide on desktop */
}

.public-nav-links {
    display: flex;
    gap: 1.5rem;
    background: none;
    padding: 0;
    box-shadow: none;
}

.public-nav-links a {
    color: var(--text-color);
    font-weight: bold;
    font-size: 1rem;
}

.public-nav-links a:hover, .public-nav-links a.active {
    color: var(--primary-color);
    text-decoration: none;
}

.search-form {
    flex: 1;
    max-width: 600px;
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar-public {
        width: 100%;
        margin-bottom: 2rem;
        overflow-x: auto;
    }

    .sidebar-public ul {
        display: flex;
        gap: 1rem;
        padding-bottom: 0.5rem;
    }

    .sidebar-public li {
        margin-bottom: 0;
        white-space: nowrap;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    /* Hamburger Menu */
    .mobile-header {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 100;
    }

    .menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: var(--text-color);
        margin-bottom: 5px;
        transition: 0.3s;
    }

    .public-nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: center;
        background-color: var(--card-bg);
        padding: 1rem;
        border-radius: 8px;
        margin-top: 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    }

    .public-nav-links.active {
        display: flex;
    }

    .search-form {
        width: 100%;
        order: 2; /* Search below logo/menu */
        margin-bottom: 1rem;
    }

    .search-form input {
        width: 100%;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); /* 1 column on mobile */
    }
    
    /* Trusted Logos Mobile */
    .trusted-logo-item {
        width: 60px !important;
        height: 60px !important;
        margin: 0 1rem !important;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
    
    .mobile-header {
        display: contents; /* Treat children as if they were direct children of .container */
    }
}

/* =========================================
   Orders System
   ========================================= */
.status-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.status-card:hover {
    transform: translateY(-5px);
}

.progress-track {
    background: #333;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 1s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

.order-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 600px) and (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(45%, 1fr)); /* 2 columns on tablets */
    }
}

/* 18. Channel Preview Card */
.channel-preview-card {
    position: fixed; /* Fixed to viewport to avoid overflow clipping */
    bottom: auto;
    left: 0;
    top: 0;
    width: 300px;
    background-color: #0f0f0f; /* YouTube Dark BG */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999; /* High z-index */
    pointer-events: none;
    border: 1px solid #333;
    transform: translateX(-50%); /* Center horizontally relative to left position */
}

.channel-preview-card.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.channel-banner {
    height: 80px;
    background-size: cover;
    background-position: center;
    background-color: #333;
}

.channel-info {
    padding: 0 16px 16px;
    display: flex;
    align-items: flex-start;
    margin-top: -30px; /* Pull avatar up */
}

.channel-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid #0f0f0f;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-details {
    margin-left: 12px;
    padding-top: 34px; /* Push text down to align with avatar bottom */
    flex: 1;
}

.channel-name {
    font-family: 'Roboto', sans-serif; /* YouTube font */
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-handle {
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 4px;
}

.channel-subs {
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 10px;
}


/* 19. Video Series / Episodes */
.series-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--primary-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.episodes-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 3;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.video-card:hover .episodes-overlay {
    opacity: 1;
    visibility: visible;
}

.episodes-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.episodes-list::-webkit-scrollbar {
    width: 4px;
}

.episodes-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.episode-item {
    padding: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
}

.episode-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary-color);
    text-decoration: none;
}

/* Series Card Golden Effect */
.series-card {
    border: 2px solid #FFD700; /* Gold */
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
    border-radius: 12px; /* Ensure rounded corners */
    overflow: hidden; /* Clip content to border */
    transition: all 0.3s ease;
}

.series-card:hover {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
    transform: translateY(-5px);
    border-color: #FFED4A; /* Lighter gold on hover */
}

/* Ensure the badge matches */
.series-card .series-badge {
    background-color: #FFD700;
    color: #000;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}

/* =========================================
   Component: Video Grid
   ========================================= */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
}

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