/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --bg: #0f0f13;          /* Main Background */
    --card-bg: #1a1a24;     /* Card Background */
    --text: #ffffff;        /* Main Text */
    --accent: #ff0055;      /* Neon Pink/Red Accent */
    --secondary: #888888;   /* Grey Text */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    padding-bottom: 50px; /* Space for scrolling */
}

/* =========================================
   2. HEADER
   ========================================= */
header {
    padding: 15px 20px;
    background: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.logo {
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.search-bar input {
    background: #222;
    border: 1px solid #444;
    padding: 8px 15px;
    border-radius: 5px;
    color: white;
    outline: none;
    width: 140px; /* Small on mobile */
    transition: width 0.3s ease;
}

.search-bar input:focus {
    border-color: var(--accent);
}

/* Desktop Header Adjustments */
@media(min-width: 768px) {
    .search-bar input { width: 300px; }
}

/* =========================================
   3. VIDEO GRID (HOMEPAGE)
   ========================================= */
.video-grid {
    display: grid;
    /* FORCE 2 COLUMNS ON MOBILE */
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
}

/* Desktop Grid: Adaptive columns */
@media(min-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
        padding: 20px;
    }
}

/* =========================================
   4. CARDS (VIDEOS & ADS)
   ========================================= */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: white;
    display: block;
    position: relative;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-3px); /* Subtle lift effect */
}

/* Thumbnail Wrapper (16:9 Aspect Ratio) */
.thumb-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Duration Badge (For Regular Videos) */
.duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.85);
    padding: 2px 5px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
}

/* --- AD CARD LIVE INDICATOR (Only for Ads) --- */
.card-live-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 900;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 0 5px rgba(255, 0, 85, 0.4);
}

.card-live-badge .red-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
    animation: blink 1s infinite;
}

/* Card Info */
.info {
    padding: 10px;
}

.title {
    font-size: 0.85rem;
    font-weight: 500;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.views {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 5px;
}

/* Special Style for Ad Cards Text */
.ad-card .title {
    color: var(--accent); /* Pink text for Ad titles */
    font-weight: bold;
}

/* =========================================
   5. PAGINATION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.pagination button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.pagination button:hover {
    opacity: 0.9;
}

.pagination button:disabled {
    background: #333;
    cursor: default;
    opacity: 0.5;
}

.pagination span {
    font-size: 0.9rem;
    color: #aaa;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* =========================================
   6. WATCH PAGE STYLES
   ========================================= */

/* Wrapper to prevent content from stretching on Zoom Out */
.content-wrapper {
    width: 100%;
    max-width: 1000px; /* Limits width on big screens */
    margin: 0 auto;    /* Centers it */
    background: transparent;
}

.back-btn {
    text-decoration: none;
    color: #aaa;
    font-size: 0.9rem;
    font-weight: bold;
    transition: color 0.2s;
}

.back-btn:hover {
    color: white;
}

/* Player Container */
.player-container {
    width: 100%;
    background: black;
    position: relative;
    overflow: hidden;
}

/* Responsive Player Logic */
.video-player {
    width: 100%;
    height: auto;      /* Auto height maintains aspect ratio */
    aspect-ratio: 16/9;
    display: block;
}

/* Video Info Section */
.video-info {
    padding: 15px 15px 5px 15px;
}

.video-info h1 {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 10px;
    font-weight: 600;
    color: white;
}

/* Live Stats Row (Inside Watch Page) */
.stats-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.views-count {
    font-size: 0.9rem;
    color: #ccc;
}

/* Watch Page Live Indicator (Slightly different from Card) */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--accent);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--accent);
    font-weight: bold;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Re-using red dot animation */
.red-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Suggestions Label */
.suggestions-label {
    padding: 15px 15px 0 15px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}
