/* Yalla Custom CSS */

:root {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --accent-color: #ffc107;
    --bg-dark: #1a1a2e;
    --card-bg: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --success: #10b981;
    --danger: #ef4444;
}

.matches-container {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 20px;
    font-family: 'Tajawal', sans-serif;
    color: var(--text-primary);
    direction: rtl;
}

/* Header & Tabs */
.matches-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.matches-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.yalla-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 50px;
    gap: 5px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.bein-btn {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 10px;
    transition: transform 0.2s;
}

.bein-btn:hover {
    transform: scale(1.05);
}

/* Match Card */
.match-card {
    display: block;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.match-card:hover {
    transform: translateY(-2px);
    background: #323246;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Match Row - Main Container */
.match-row,
.match-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================
   TEAM CONTAINERS - SIMPLIFIED APPROACH
   ============================================ */

.match-team {
    flex: 1;
    display: flex !important;
    align-items: center;
    gap: 12px !important;
    min-width: 0;
    direction: ltr !important;
    height: 60px;
    /* Explicit height for vertical centering consistency */
}

/* RIGHT SIDE TEAM (first-child in RTL = right side of screen) */
.match-team:first-child {
    flex-direction: row !important;
    justify-content: flex-end !important;
    /* Align to the RIGHT (End of LTR) */
    /* To push to the RIGHT edge in LTR, we need margin-left: auto */
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Reverse order for right team: [Name] [Logo] */
.match-team:first-child img,
.match-team:first-child>div:not(:last-child) {
    order: 2;
}

.match-team:first-child span {
    order: 1;
    text-align: right;
    /* Text aligns towards logo */
}

/* LEFT SIDE TEAM (last-child in RTL = left side of screen) */
.match-team:last-child {
    flex-direction: row !important;
    justify-content: flex-start !important;
    /* To push to the LEFT edge in LTR, we need margin-right: auto */
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* Normal order for left team: [Logo] [Name] */
.match-team:last-child img,
.match-team:last-child>div:not(:last-child) {
    order: 1;
}

.match-team:last-child span {
    order: 2;
    text-align: left;
    /* Text aligns towards logo */
}

/* Logo/Placeholder Styling */
.match-team img,
.match-team>div:first-of-type {
    width: 48px;
    height: 48px;
    min-width: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
    flex-shrink: 0;
    box-sizing: border-box;
    /* meaningful shadow to make it pop like reference */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Team Name Styling */
.match-team span {
    font-weight: 700;
    font-size: 1.1rem;
    /* Slightly larger like reference */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
    line-height: 1.2;
    padding-top: 2px;
    /* Visual optical alignment */
}

/* Center Info (Time/Score) */
.match-center {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0 15px;
}

.match-time {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 5px;
    direction: ltr;
}

.match-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}

.match-status.upcoming,
.match-status.pending {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.match-status.live {
    background: var(--danger);
    color: white;
    animation: pulse 1.5s infinite;
}

.match-status.ended {
    background: var(--success);
    color: white;
}

/* Match Details (Footer of card) */
.match-details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.match-details span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Responsive */

.match-details {
    flex-wrap: wrap;
    gap: 10px;
}


/* =============================================
   SERVER SELECTION & PLAYER
   ============================================= */

.match-player-container {
    background: var(--bg-dark);
    border-radius: 12px;
    /* overflow: hidden; */
    /* Allow shadows to pop */
    margin-top: 20px;
}

.servers-list {
    margin-bottom: 20px;
}

.servers-list h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.servers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.server-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    color: white;
}

.server-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Player Wrapper */
.player-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#yalla-player-frame {
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    width: 100%;
}

#yalla-player-frame iframe,
#yalla-player-frame video {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* No Broadcast State */
.match-player.no-broadcast {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* =============================================
   RELATED NEWS SECTION
   ============================================= */

.related-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 2px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.related-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.related-card-image {
    height: 160px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    /* For emoji fallback */
}

.related-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-card-image .emoji {
    width: 48px !important;
    height: 48px !important;
    object-fit: contain;
}

.related-card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.related-card-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.4;
    font-weight: 700;
}

.related-card-meta {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

@media (max-width: 600px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================
   Yalla Ads Manager Styles (Premium)
   ======================== */
.yalla-ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px auto;
    max-width: 100%;
    position: relative;
    z-index: 10;
}

/* Label for clarity but subtle */
.yalla-ad-container::before {
    content: 'إعلان';
    position: absolute;
    top: -18px;
    right: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Top Header & Home Hero */
.yalla-ad-top-header {
    margin: 0 auto;
    padding: 15px 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.yalla-ad-home-hero {
    margin-bottom: 40px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Sticky Sidebars */
.yalla-ad-sidebar-left,
.yalla-ad-sidebar-right {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    width: 160px;
    height: 600px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    /* Optional: glassmorphism effect */
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.yalla-ad-sidebar-left {
    left: 20px;
}

.yalla-ad-sidebar-right {
    right: 20px;
}

/* Sticky Footer (Premium Bar) */
.yalla-ad-sticky-footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 728px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        bottom: -100px;
        opacity: 0;
    }

    to {
        bottom: 20px;
        opacity: 1;
    }
}

/* Premium Close Button */
.ad-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #ff4757;
    color: white;
    border: 2px solid #1a1a2e;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    font-size: 14px;
    line-height: 1;
}

.ad-close-btn:hover {
    transform: scale(1.1);
    background: #ff6b81;
}

/* Popup Modal (Modern) */
.yalla-ad-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    /* Prevent blocking when hidden */
    transition: opacity 0.3s ease;
}

/* Override default display for animation logic */
.yalla-ad-popup.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    /* Enable clicks only when active */
}

.yalla-ad-popup .yalla-ad-container {
    background: transparent;
    padding: 0;
    margin: 0;
    /* Remove label for popup as it's self-contained usually */
}

.yalla-ad-popup .yalla-ad-container::before {
    display: none;
}

.ad-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
    z-index: 10001;
    /* Ensure above container */
}

.ad-popup-close::after {
    content: '✕';
    background: rgba(255, 255, 255, 0.2);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.ad-popup-close:hover {
    color: white;
}

.ad-popup-close:hover::after {
    background: rgba(255, 255, 255, 0.4);
}

/* Responsive Logic */
@media (max-width: 1200px) {

    .yalla-ad-sidebar-left,
    .yalla-ad-sidebar-right {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .yalla-ad-sticky-footer {
        width: 100%;
        bottom: 0;
        left: 0;
        transform: none;
        border-radius: 12px 12px 0 0;
        padding-bottom: 25px;
        /* Safe area */
        max-width: 100%;
    }

    .yalla-ad-home-hero {
        margin-bottom: 20px;
        padding: 10px;
    }
}

/* ========================
   AdSense Specific Optimizations
   ======================== */
.yalla-ad-container ins.adsbygoogle {
    display: block !important;
    background: transparent !important;
    /* Remove any default yellow backgrounds from testing */
}

/* Ensure centering for iframes injected by ad networks */
.yalla-ad-container iframe {
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

/* Placeholder effect while loading (Subtle pulse) */
.yalla-ad-container:empty {
    min-height: 90px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    animation: adPulse 2s infinite;
}

@keyframes adPulse {
    0% {
        background-color: rgba(255, 255, 255, 0.02);
    }

    50% {
        background-color: rgba(255, 255, 255, 0.04);
    }

    100% {
        background-color: rgba(255, 255, 255, 0.02);
    }
}