/* ============================================
   Global Styles & Variables
   ============================================ */
@font-face {
    font-family: 'Mj_tunisiaBold';
    src: url('Mj_tunisiaBold.ttf') format('truetype');
}

:root {
    --primary-color: #800000;    /* Dark Red */
    --secondary-color: #1a1a1a;
    --accent-color: #d4af37;     /* Gold */
    --text-color: #ffffff;
    --text-muted: #cccccc;
    --bg-dark: #1c1c1c;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    height: 100vh;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   Layout Containers
   ============================================ */
.app-container {
    width: 100%;
    min-height: 100vh;
    height: auto;
    position: relative;
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.container {
    width: 95%;
    margin: 0 auto;
}

/* ============================================
   Headers & Navigation
   ============================================ */
/* Mobile Header - Hidden on Desktop */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: rgba(60, 0, 0, 0.9);
    color: var(--accent-color);
    border-bottom: 1px solid #550000;
    position: relative;
    z-index: 100;
}

.mobile-brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.hamburger-menu {
    font-size: 1.5rem;
    cursor: pointer;
    border: 1px solid #777;
    border-radius: 4px;
    padding: 8px 12px;
    color: #aaa;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.3s ease;
}

.hamburger-menu:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Desktop Header */
.desktop-header {
    width: 100%;
    position: relative;
    z-index: 20;
}

/* Date Bar */
.top-bar {
    background-color: #979797;
    padding: 6px 4px;
    text-align: right;
    font-size: 1rem;
    color: #000000;
    font-family: 'HacenTunisiaLt', 'Segoe UI', sans-serif;
    font-weight: bold;
}

.top-bar .container {
    display: flex;
    justify-content: flex-start;
    direction: rtl; /* Right to left for Hijri layout */
}

/* Main Navigation */
.main-nav {
    background-color: rgba(98, 0, 0, 0.7);
}

.nav-tabs {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
}

.nav-tabs a {
    display: block;
    padding: 10px 30px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 1.1rem;
    transition: background 0.3s ease, color 0.3s ease;
    font-family: 'Mj_tunisiaBold', sans-serif;
}

.nav-tabs a:hover,
.nav-tabs a.active {
    background-color: rgba(0, 0, 0, 0.4);
    color: var(--accent-color);
}

/* ============================================
   Main Video Layout (Desktop Stretch Mode)
   ============================================ */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    pointer-events: none;
}

.content-scaler {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    justify-content: center;
    background-repeat: no-repeat;
    background-position: center top;
    background-size: 100% 100%;
    margin-top: 24px;
    pointer-events: none;
}

.video-container {
    position: absolute;
    width: 55%;
    height: 55%;
    top: 31.3%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #000;
    border: 4px solid #620000;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

/* ============================================
   KTV PLAYER — Custom HLS Player Styles
   ============================================ */
.ktv-player {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

#ktvVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Spinner */
.ktv-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.ktv-spinner.hidden {
    opacity: 0;
}

.ktv-spinner-ring {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255, 255, 255, 0.18);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ktvSpin 0.9s linear infinite;
}

@keyframes ktvSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Footer & Social
   ============================================ */
footer {
    background-color: transparent;
    padding: 0;
    position: absolute;
    top: 90%;
    width: 100%;
    left: 0;
    pointer-events: auto;
    z-index: 10;
}

.footer-group {
    display: flex;
    flex-direction: column;
    width: fit-content;
    margin: 0 auto;
}

.social-follow-text, .footer-brand-text {
    text-align: justify;
    text-align-last: justify;
    color: var(--text-color);
    font-weight: 700;
    width: 100%;
    display: block;
}

.social-follow-text {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    margin-bottom: 12px;
    font-family: 'Mj_tunisiaBold', sans-serif;
}

.footer-brand-text {
    font-size: clamp(0.8rem, 1.8vw, 1.1rem);
    margin-bottom: 30px;
    color: var(--text-muted);
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.social-btn {
    width: clamp(35px, 4vw, 50px);
    height: clamp(35px, 4vw, 50px);
    background-color: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #444;
}

.social-btn img {
    width: 60%; /* Sized down slightly so icons don't touch edges */
    height: 60%;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.social-btn:hover { transform: translateY(-3px) scale(1.1); border-color: transparent; }
.social-btn:hover img { opacity: 1; }

#btn-youtube:hover { background-color: #FF0000; }
#btn-facebook:hover { background-color: #1877F2; }
#btn-instagram:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
#btn-telegram:hover { background-color: #0088cc; }
#btn-aparat:hover { background-color: #E62117; }
#btn-rubika:hover { background-color: #1A73E8; }
#btn-whatsapp:hover { background-color: #25D366; }
#btn-eita:hover { background-color: #db6301; }

.footer-text {
    text-align: center;
    color: #888;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    margin-top: 20px;
}

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--secondary-color); }
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
    border: 1px solid #330000;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

/* =========================================
   MOBILE VIEW (Max Width 768px)
   ========================================= */
@media (max-width: 768px) {
    .app-container {
        background-image: none;
    }

    .mobile-header {
        display: flex;
    }

    .desktop-header {
        display: block;
        position: relative;
        z-index: 101; /* High z-index so dropdown stays on top of video */
    }

    /* Fix applied: Date is now visible on mobile, nicely styled */
    .top-bar {
        display: block; 
        background-color: rgba(20, 20, 20, 0.95);
        color: var(--accent-color);
        text-align: center;
        padding: 8px 10px;
        border-bottom: 1px solid #333;
    }

    .top-bar .container {
        justify-content: center; /* Center the date text on mobile */
    }

    /* Fixed mobile menu overlap */
    .main-nav {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        background-color: rgba(40, 0, 0, 0.95);
        position: absolute;
        top: 100%; /* Drop down directly below the date bar */
        left: 0;
        width: 100%;
        transition: max-height 0.4s ease, opacity 0.4s ease;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    }

    .main-nav.show {
        max-height: 400px;
        opacity: 1;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .nav-tabs a {
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 15px 20px;
    }

    .content-scaler {
        aspect-ratio: 9 / 16;
        margin-top: 0;
    }

    .video-container {
        width: 75.6%;
        height: 23.9%;
        top: 43.8%;
        left: 50%;
        transform: translateX(-50%);
    }

    footer {
        top: 70%;
        bottom: auto;
    }
}
/* ============================================
   KTV PLAYER UI OVERLAYS
   ============================================ */
.ktv-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none; /* Allows clicking the video to mute/unmute */
    padding: 15px;
    z-index: 20;
}

.ktv-overlay-btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: background 0.3s ease, opacity 0.3s ease, transform 0.2s ease;
}

.ktv-overlay-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.ktv-overlay-btn:active {
    transform: scale(0.95);
}

#ktvUnmuteBtn {
    align-self: center;
    margin-top: auto;
    margin-bottom: auto;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.ktv-fs-btn {
    align-self: flex-end;
    padding: 10px 14px;
    font-size: 1.2rem;
    border-radius: 8px;
}

/* Utility to hide the unmute button smoothly */
.fade-out {
    opacity: 0;
    pointer-events: none !important;
}