:root {
    --bg-deep: #000000;
    --bg-main: #0A0A0A;
    --bg-surface: #141414;
    --bg-surface-hover: #202020;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --primary-color: #00aeff;
    --primary-color-dark: #008fcc;
    --accent-yellow: #ffeb3b;
    --divider-color: rgba(255, 255, 255, 0.08);
    --scrollbar-thumb: #4f4f4f;
    --scrollbar-track: var(--bg-main);
    --modal-bg: rgba(0, 0, 0, 0.7);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --transition-speed: 0.4s; /* Slightly slower for smoother feel */
    --transition-curve: cubic-bezier(0.4, 0, 0.2, 1); /* Smoother animation curve */
}

html[data-theme='light'] {
    --bg-deep: #f0f2f5;
    --bg-main: #ffffff;
    --bg-surface: #e4e6eb;
    --bg-surface-hover: #d8dadf;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --primary-color: #1877f2;
    --primary-color-dark: #166fe5;
    --accent-yellow: #f5c33b;
    --divider-color: #ced0d4;
    --scrollbar-thumb: #bcc0c4;
    --scrollbar-track: var(--bg-surface);
    --modal-bg: rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html[data-theme='blue'] {
    --bg-deep: #0a1929;
    --bg-main: #0f233a;
    --bg-surface: #173252;
    --bg-surface-hover: #21436b;
    --text-primary: #e6f1ff;
    --text-secondary: #a8b2d1;
    --primary-color: #64ffda;
    --primary-color-dark: #52d1b5;
    --divider-color: rgba(100, 255, 218, 0.1);
}

html[data-theme='green'] {
    --bg-deep: #121212;
    --bg-main: #1e1e1e;
    --bg-surface: #2a2a2a;
    --bg-surface-hover: #363636;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --primary-color: #1db954;
    --primary-color-dark: #1aa34a;
    --divider-color: rgba(255, 255, 255, 0.1);
}

html, body {
    width: 100vw;
    height: var(--app-height, 100vh);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--bg-deep);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    direction: rtl;
}

.container {
    background: var(--bg-deep);
    width: 100vw;
    height: var(--app-height, 100vh);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed);
}

.sidebar {
    position: fixed;
    top: 0;
    right: -280px; /* Hidden by default */
    width: 280px;
    height: 100%;
    box-shadow: var(--shadow);
    z-index: 200;
    transform: translateX(0); /* Changed from translateX(100%) */
    transition: right var(--transition-speed) var(--transition-curve); /* Changed property */
    display: flex;
    flex-direction: column;
    padding: 20px;
    
    /* --- Glass Effect --- */
    background-color: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.open {
    right: 0; /* Slide in */
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--divider-color);
    color: var(--text-primary);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

#close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-content .menu-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.sidebar-content .menu-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-content .menu-item i {
    margin-left: 15px;
    width: 20px;
    text-align: center;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 44px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--bg-surface);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    background-color: #fff;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    position: absolute;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-curve), visibility var(--transition-speed) var(--transition-curve);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.video-box {
    background: #000;
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
}

#youtube-player-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#youtube-player-container iframe {
    width: 100%;
    height: 100%;
}

#yt-play-overlay-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

#yt-play-overlay-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.chat-section {
    background: var(--bg-main);
    padding: 0px 8px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 40vh;
    overflow: hidden;
    transition: background-color var(--transition-speed);
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* --- حذف انیمیشن ورود پیام --- */

.message {
    display: flex;
    align-items: flex-start;
    gap: 6px; /* --- کاهش فاصله از 8px --- */
    max-width: 85%;
    direction: rtl;
    position: relative;
    /* --- حذف انیمیشن --- */
}

.message .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #00aeff;
    flex-shrink: 0;
}

.message .message-content {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 18px;
    padding: 6px 12px; /* --- پدینگ کوچکتر (قبلا 8px 14px 9px 12px بود) --- */
    box-shadow: var(--shadow);
    word-break: break-word;
    max-width: 100%;
    position: relative;
    z-index: 1;
    touch-action: pan-y;
    transition: transform 0.2s ease-out;
}

.reply-icon-container {
    position: absolute;
    right: -45px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.2s ease-out;
    z-index: 0;
}


.message .message-content .meta {
    display: flex;
    align-items: baseline;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: bold;
}

.message .message-content .meta .username {
    order: 3;
}

.message .message-content .meta .separator {
    order: 2;
    margin-left: auto;
    margin-right: auto;
    padding: 0 0.5em;
}

.message .message-content .meta .timestamp {
    order: 1;
}

.message.system {
    justify-content: center;
    background: var(--bg-surface);
    color: var(--accent-yellow);
    text-align: center;
    font-size: 0.95em;
    font-weight: bold;
    align-self: center;
    max-width: 90%;
    padding: 5px 10px;
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    box-shadow: var(--shadow);
}

.message {
    flex-direction: row;
}

.replied-message {
    background-color: rgba(0,0,0,0.2);
    padding: 6px 10px;
    margin: 4px 0 8px 0;
    border-radius: 12px;
    border-right: 3px solid var(--primary-color);
}
html[data-theme='light'] .replied-message {
    background-color: rgba(0,0,0,0.05);
}
.replied-message strong {
    color: var(--primary-color);
    font-size: 0.9em;
    display: block;
    margin-bottom: 2px;
}
.replied-message p {
    margin: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-preview-container {
    display: none;
    align-items: center;
    background-color: var(--bg-surface);
    padding: 8px;
    border-top: 1px solid var(--divider-color);
}
.reply-preview-container.show {
    display: flex;
}
.reply-preview-content {
    flex-grow: 1;
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
}
.reply-preview-content strong {
    color: var(--primary-color);
    font-size: 0.9em;
}
.reply-preview-content p {
    margin: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cancel-reply-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 10px;
}

#chat-form {
    display: flex;
    gap: 6px;
    flex-direction: row-reverse;
}

#chat-form.chat-disabled {
    opacity: 0.6;
    pointer-events: none;
}

#chat-input {
    flex: 1;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1em;
    outline: none;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

#send-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%; /* <<<< تغییر: دکمه گرد می‌شود */
    padding: 0; /* <<<< تغییر: حذف پدینگ */
    width: 40px; /* <<<< تغییر: تعیین عرض */
    height: 40px; /* <<<< تغییر: تعیین ارتفاع */
    font-size: 1.2em; /* <<<< تغییر: اندازه آیکون */
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition-speed);
    order: -1;
    display: flex; /* <<<< تغییر: برای وسط‌چین کردن آیکون */
    align-items: center; /* <<<< تغییر: برای وسط‌چین کردن آیکون */
    justify-content: center; /* <<<< تغییر: برای وسط‌چین کردن آیکون */
}

#send-btn:hover {
    background-color: var(--primary-color-dark);
}

.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 201;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) var(--transition-curve);
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    padding: 32px 24px 20px 24px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 300px;
    max-width: 90vw;
    color: var(--text-primary);
    position: relative;
    transform: scale(0.95);
    transition: transform var(--transition-speed) var(--transition-curve);

    /* --- Glass Effect --- */
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 1.1em;
}

.modal-content input {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--divider-color);
    font-size: 1em;
    background: var(--bg-surface);
    color: var(--text-primary);
    margin-bottom: 15px;
    width: 90%;
}

.modal-content button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition-speed);
}

.modal-content .cancel-btn {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.player-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #000;
    font-family: 'Vazirmatn', sans-serif;
}

.player-container video {
    width: 100%;
    height: 100%;
    display: block;
}

.player-controls {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(25, 25, 25, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 6;
}

.player-container.show-controls .player-controls,
.player-container.paused .player-controls {
    opacity: 1;
    transform: translateY(0);
}

.timeline-container {
    width: 100%;
    cursor: pointer;
    padding: 5px 0;
}

.timeline {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    position: relative;
    border-radius: 5px;
}

.timeline .progress {
    height: 100%;
    width: 0;
    background: #00aeff;
    border-radius: 5px;
    position: absolute;
    right: 0;
    transition: width 0.1s linear;
}

.timeline .thumb-indicator {
    height: 15px;
    width: 15px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #00aeff;
    position: absolute;
    top: 50%;
    transform: translate(50%, -50%) scale(0);
    right: 0;
    left: auto;
    transition: transform 0.2s ease;
}

.timeline-container:hover .thumb-indicator {
    transform: translate(50%, -50%) scale(1);
}

.controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-controls button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s, color 0.2s;
}

.player-controls button:hover {
    color: #00aeff;
    transform: scale(1.15);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    position: relative;
    border-radius: 3px;
    transition: width 0.3s ease-in-out;
}

.volume-container:hover .volume-slider {
    width: 80px;
}

.volume-progress {
    background: #fff;
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 3px;
}

.time-display {
    font-size: 0.9em;
    user-select: none;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media (max-width: 899px) {
    .container {
        height: var(--app-height, 100vh) !important;
        min-height: var(--app-height, 100vh) !important;
        flex-direction: column;
    }
    .video-box {
        aspect-ratio: 16/9;
        flex: 0 0 auto !important;
        margin-bottom: 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
    }
    .video-box video {
        width: 100vw !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        aspect-ratio: 16/9 !important;
        object-fit: contain;
        display: block;
        border-radius: 0 !important;
        background: #000;
    }
    .chat-section {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0px 8px 8px 8px;
        border-radius: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: hidden;
    }
    #chat-messages {
        flex: 1 1 0 !important;
        min-height: 0 !important;
    }
}

#youtube-player-container {
    display: none;
}

.restriction-notice {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 5px 15px;
    text-align: center;
}

.error-container {
    display: none; 
    position: fixed;
    inset: 0;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 9999;
    padding: 20px;
}

.error-container .error-content { 
    padding: 40px 50px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 450px;
    width: 100%;
    transform: scale(0.9);
    opacity: 0;
    animation: fadeInScale 0.5s forwards cubic-bezier(0.165, 0.84, 0.44, 1);
    
    /* --- Glass Effect --- */
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes fadeInScale {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.error-icon {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.error-container .error-content h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.error-container .error-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.error-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 12px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.error-button:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-3px);
}

.error-button i {
    margin-left: 8px;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80%;
    max-width: 220px;
    margin: 5px auto;
    gap: 10px;
}

.progress-bar-container {
    width: 100%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    animation: fill-and-slide 2.5s ease-in-out infinite;
}

.loader-container span {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

@keyframes fill-and-slide {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

#mp4-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 150px;
    pointer-events: none;
}

#mp4-spinner .progress-bar-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    overflow: hidden;
}

#mp4-spinner .progress-bar-fill {
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    animation: fill-and-slide 2.5s ease-in-out infinite;
}

.channel-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 25px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 5px;
}

.channel-btn {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--divider-color);
    border-radius: 12px;
    padding: 12px 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
}

.channel-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 25px;
}

.category-btn {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--divider-color);
    border-radius: 16px;
    padding: 20px 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.category-btn i {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.category-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.back-btn {
    position: absolute;
    top: 25px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.back-btn:hover {
    color: var(--text-primary);
}

.player-container:fullscreen {
  width: 100%;
  height: 100%;
}
.player-container:-webkit-full-screen {
  width: 100%;
  height: 100%;
}

.player-overlay-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    animation: fadeIn 0.4s forwards;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.player-overlay-message .overlay-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.player-overlay-message p {
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
    padding: 0 15px;
}

.main-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

@media (min-width: 900px) {
    .container {
        height: var(--app-height, 100vh);
        max-height: var(--app-height, 100vh);
    }

    .main-content {
        flex-direction: row;
    }

    .video-box {
        flex: 1 1 auto;
        height: auto;
        max-height: none;
    }

    .chat-section {
        flex: 0 0 350px;
        max-height: none;
        border-right: 1px solid var(--divider-color);
        transition: flex-basis 0.3s ease-in-out, opacity 0.3s ease-in-out;
    }
}

.users-list-container {
    margin-top: 20px;
    margin-bottom: 25px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface);
    padding: 8px 12px;
    border-radius: 12px;
}

.user-list-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-list-info img {
    width: 45px; /* Increased size */
    height: 45px; /* Increased size */
    border-radius: 50%;
    flex-shrink: 0;
}

.user-list-info span {
    font-weight: bold;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kick-user-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.kick-user-btn:hover {
    color: #ff4d4d;
    background-color: rgba(255, 77, 77, 0.1);
}

.kick-user-btn.hidden {
    display: none;
}

.main-content.theater-mode .chat-section {
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 900px) {
    .main-content.theater-mode .video-box {
        flex-basis: 100%;
    }
    .main-content.theater-mode .chat-section {
        flex-basis: 0;
    }
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-surface);
    border-radius: 12px;
}

.setting-item span, .setting-item label {
    font-weight: 500;
    font-size: 0.95rem;
}

.settings-select {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--divider-color);
    border-radius: 8px;
    padding: 5px 8px;
    direction: ltr;
}
.settings-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.setting-item-full {
    width: 100%;
}

.danger-btn {
    width: 100%;
    padding: 10px;
    background-color: #581515;
    color: #ffc2c2;
    border: 1px solid #a33;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.2s, color 0.2s;
}

.danger-btn:hover {
    background-color: #7a2020;
    color: #ffffff;
}
.danger-btn i {
    margin-left: 8px;
}

.theme-selector {
    display: flex;
    gap: 10px;
}

.theme-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--divider-color);
    transition: transform 0.2s, border-color 0.2s;
}

.theme-option:hover {
    transform: scale(1.1);
}

.theme-option.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.theme-option.dark { background-color: #0A0A0A; }
.theme-option.light { background-color: #f0f2f5; }
.theme-option.blue { background-color: #0f233a; }
.theme-option.green { background-color: #1e1e1e; }

.profile-card {
    margin-top: 25px;
    padding: 20px;
    background-color: var(--bg-surface);
    border-radius: 16px;
    border: 1px solid var(--divider-color);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: right;
    margin-top: 10px;
}

.profile-info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: var(--bg-main);
    border-radius: 12px;
}

.profile-info-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 25px;
    text-align: center;
}

.profile-info-item span {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.theater-menu-container {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(200%);
    background: rgba(30, 30, 30, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 15px;
    display: flex;
    gap: 25px;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
}

.theater-menu-container.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.theater-menu-button {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 5px;
    transition: transform 0.2s ease, color 0.2s ease;
    width: 60px;
}

.theater-menu-button:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

.theater-menu-button i {
    font-size: 1.5rem;
}

.theater-menu-button span {
    font-size: 0.8rem;
    font-weight: bold;
}


/* --- Theme Specific Glass Effects --- */
html[data-theme='light'] .sidebar {
    background-color: rgba(255, 255, 255, 0.75);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}
html[data-theme='light'] .modal-content,
html[data-theme='light'] .error-container .error-content {
    background: rgba(240, 242, 245, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme='blue'] .sidebar {
    background-color: rgba(15, 35, 58, 0.75);
    border-left: 1px solid rgba(100, 255, 218, 0.1);
}
html[data-theme='blue'] .modal-content,
html[data-theme='blue'] .error-container .error-content {
    background: rgba(23, 50, 82, 0.75);
    border: 1px solid rgba(100, 255, 218, 0.1);
}

html[data-theme='green'] .sidebar {
    background-color: rgba(30, 30, 30, 0.75);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}
html[data-theme='green'] .modal-content,
html[data-theme='green'] .error-container .error-content {
    background: rgba(42, 42, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Glass Background Effect --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    z-index: -1;
    background: linear-gradient( -45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab );
    background-size: 400% 400%;
    animation: gradient_anim 15s ease infinite;
    opacity: 0;
    transition: opacity 0.8s ease;
}

@keyframes gradient_anim {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.glass-bg-active::before {
    opacity: 1;
}

body.glass-bg-active .container {
    background: transparent;
}

body.glass-bg-active .video-header,
body.glass-bg-active .user-bar,
body.glass-bg-active .chat-section {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
    
body.glass-bg-active .sidebar {
    background-color: rgba(10, 10, 10, 0.65);
}

body.glass-bg-active .modal-content,
body.glass-bg-active .error-container .error-content {
    background: rgba(20, 20, 20, 0.65);
}

body.glass-bg-active[data-theme='light'] .video-header,
body.glass-bg-active[data-theme='light'] .user-bar,
body.glass-bg-active[data-theme='light'] .chat-section {
    background: rgba(255, 255, 255, 0.3);
}
    
body.glass-bg-active[data-theme='light'] .sidebar {
    background-color: rgba(255, 255, 255, 0.65);
}

body.glass-bg-active[data-theme='light'] .modal-content {
    background: rgba(240, 242, 245, 0.65);
}

/* --- استایل پیام‌های شناور در حالت تمام صفحه --- */

#fullscreen-chat-notifications {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    max-width: 320px;
}

.fs-chat-notification {
    pointer-events: auto;
    padding: 10px 15px;
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInOut 6s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    15% {
        opacity: 1;
        transform: translateX(0);
    }
    85% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(20px);
    }
}

.fs-chat-notification img.fs-chat-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--primary-color);
}

.fs-chat-content {
    display: flex;
    flex-direction: column;
}

.fs-chat-content strong {
    font-size: 0.9em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.fs-chat-content p {
    margin: 0;
    font-size: 0.95em;
    color: #e0e0e0;
    word-break: break-word;
}

/* --- استایل آواتارها و دکمه چت در حالت تمام‌صفحه --- */
.fullscreen-online-avatars {
    display: none;
    align-items: center;
    padding-left: 15px;
}

.fs-chat-btn {
    display: none;
}

.player-container.is-fullscreen .fullscreen-online-avatars,
.player-container.is-fullscreen .fs-chat-btn {
    display: flex;
}

.fullscreen-online-avatars img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
    margin-right: -10px;
    transition: transform 0.2s ease-in-out, margin-right 0.2s ease-in-out;
}

.fullscreen-online-avatars:hover img {
    transform: translateX(0);
    margin-right: 2px;
}

/* --- استایل‌های جدید برای چت در حالت تمام‌صفحه --- */

.player-controls .fs-chat-btn {
    font-size: 1rem; /* کمی کوچکتر برای هماهنگی */
}

.fs-chat-panel {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 340px;
    max-width: 80vw;
    height: 60%;
    max-height: 500px;
    z-index: 100;
    
    /* --- Glass Effect --- */
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.fs-chat-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fs-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.fs-chat-header span {
    font-weight: bold;
    color: var(--text-primary);
}

.fs-chat-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.fs-chat-close-btn:hover {
    color: var(--text-primary);
}

.fs-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* --- استفاده مجدد از استایل پیام‌ها با کمی تغییر --- */
.fs-chat-messages .message .message-content {
    background: rgba(0,0,0,0.3);
}
.fs-chat-messages .message.system {
     background: rgba(0,0,0,0.4);
     font-size: 0.85em;
}


.fs-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

#fullscreen-chat-input {
    flex-grow: 1;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.9em;
    outline: none;
}

.fs-chat-form button {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    font-size: 1em;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ======================================================= */
/* =========== START: استایل‌های پلیر مدرن ============ */
/* ======================================================= */

/* ---- استایل کادر عنوان ویدیو ---- */
.video-title-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(25, 25, 25, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 15px;
    color: var(--text-primary);
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-container.show-controls .video-title-container,
.player-container.paused .video-title-container {
    opacity: 1;
}

#video-title {
    margin: 0;
    font-weight: bold;
    font-size: 0.9em;
}

/* ---- استایل شمارنده و پروفایل کاربران روی پلیر ---- */
.online-users-container {
    position: absolute;
    top: 15px;
    left: 15px; /* در گوشه بالا چپ */
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--divider-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    overflow: hidden;
    /* --- CHANGED for visibility control --- */
    opacity: 0;
    transform: translateY(-15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

/* --- NEW rule to show the counter --- */
.player-container.paused .online-users-container,
.online-users-container.show-temporarily {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


/* --- استایل جدید برای حالت روز (پس‌زمینه سفید) --- */
html[data-theme='light'] .online-users-container {
    background-color: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.online-users-container:hover {
    transform: scale(1.05);
    background-color: rgba(30, 30, 30, 0.7);
}

#video-online-avatars {
    display: flex;
    align-items: center;
    padding-right: 5px; /*فاصله از لبه*/
}

.video-avatar-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface-hover);
    margin-right: -10px; /* افکت روی هم قرار گرفتن */
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: margin-right 0.2s ease;
}

.video-avatar-img.my-avatar {
    border-color: var(--primary-color);
    z-index: 5; /* Bring it to the front of the stack */
}

.online-users-container:hover .video-avatar-img {
    margin-right: -2px; /* جدا شدن آواتارها هنگام هاور */
}

.video-avatar-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    border: 2px solid var(--bg-surface-hover);
    margin-right: -10px;
    z-index: 10;
}

.online-users-container .users-icon {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0 2px 0 5px;
}

#online-users-count {
    font-weight: bold;
    color: var(--text-primary);
    position: relative;
    padding-left: 15px;
    margin-right: -5px;
}

#online-users-count::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #2ecc71; /* نقطه سبز آنلاین */
    border-radius: 50%;
    animation: pulse 2s infinite;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#online-users-count.disconnected::before {
    background-color: #e74c3c; /* نقطه قرمز آفلاین */
    animation: pulse-red 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* ======================================================= */
/* ============ END: پایان استایل‌های پلیر مدرن ============ */
/* ======================================================= */

/* --- کد کامل و نهایی دکمه لبه‌ای با انیمیشن با تاخیر --- */

/* 1. تعریف انیمیشن جدید با تاخیر داخلی */
@keyframes delayed-shimmer-animation {
    /* از 0% تا 50% انیمیشن، نور کاملا مخفی و بی‌حرکت است */
    0%, 50% {
        transform: translateX(-150%) skewX(-30deg);
        opacity: 0;
    }
    /* از 50% تا 100%، نور ظاهر شده، حرکت کرده و دوباره محو می‌شود */
    65% {
        opacity: 0.4; /* آرام ظاهر می‌شود */
    }
    85% {
        opacity: 0.4; /* شروع به محو شدن می‌کند */
    }
    100% {
        transform: translateX(150%) skewX(-30deg);
        opacity: 0;
    }
}

/* 2. استایل اصلی دکمه */
.edge-menu-button {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 30px;
    height: 50px;
    border-radius: 0 15px 15px 0;
    border-left: none;
    background: rgba(30, 30, 30, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    color: var(--text-primary);
    cursor: pointer;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    overflow: hidden; 
}

/* 3. ایجاد نور متحرک و اعمال انیمیشن */
.edge-menu-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: delayed-shimmer-animation 5s infinite linear;
}

/* 4. استایل هاور (Hover) */
.edge-menu-button:hover {
    transform: translateY(-50%) translateX(5px);
}

/* 5. حالت محو شدن هنگام باز بودن منو */
.sidebar.open ~ .edge-menu-button {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-100%);
}

/* 6. استایل برای حالت روشن */
html[data-theme='light'] .edge-menu-button {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(0, 0, 0, 0.1);
}

/* 7. کد برای نمایش دکمه فقط در اتاق ویدیو */
body:not(.room-view) .edge-menu-button {
    display: none;
}

/* ======================================================= */
/* ====== START: استایل سایه با حالت روز سفارشی (نسخه نهایی) ====== */
/* ======================================================= */

/* --- تنظیمات اصلی بخش چت --- */
.chat-section {
    position: relative; /* برای جای‌گیری سایه ضروری است */
}

/* --- استایل سایه مشکی پیش‌فرض (برای پوسته‌های تیره) --- */
.chat-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    z-index: 10;
    pointer-events: none;
    
    /* گرادینت با رنگ مشکی پررنگ */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
}

/* --- (مهم) هماهنگ‌سازی با پوسته روشن --- */
/* در حالت روز، یک سایه خاکستری پررنگ‌تر نمایش داده می‌شود */
html[data-theme='light'] .chat-header-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 100%);
}

/* --- حذف فاصله اضافی تا پیام‌ها زیر سایه بروند --- */
#chat-messages {
    padding-top: 0;
}

@media (max-width: 899px) {
    #chat-messages {
        padding-top: 0;
    }
}
/* ======================================================= */
/* =========== END: پایان استایل سایه =========== */
/* ======================================================= */

/* --- رفع مشکل رنگ عنوان ویدیو در حالت روز --- */
html[data-theme='light'] .video-title-container {
    color: #ffffff;
}

/* =====================================================
   کد کامل و نهایی – قفل کردن کنترل‌های پلیر
   ===================================================== */

/* ۱) انیمیشن نرم برای تمام بخش‌های کنترل */
.player-container .player-controls,
.player-container .timeline-container,
.player-container .controls-left,
.player-container .controls-right > * {
    transition: opacity .3s ease, visibility .3s ease;
}

/* ۲) حالت قفل: کل نوار کنترل (به‌همراه کادر خاکستری) محو می‌شود */
.player-container.controls-locked .player-controls {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: transparent;
    box-shadow: none;
}

/* ۳) استثنا: فقط دکمهٔ قفل باید بماند */
.player-container.controls-locked .controls-right .lock-controls-btn {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ۴) پنهان‌سازی سایر المان‌های روی پلیر */
.player-container.controls-locked #video-title-overlay,
.player-container.controls-locked #online-users-container {
    opacity: 0;
}

/* ======================================================= */
/* =========== START: استایل راهنمای منو (نسخه نهایی) ============ */
/* ======================================================= */

.menu-guide-overlay {
    position: fixed;
    top: 50%;
    left: 45px;
    transform: translateY(-50%);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    direction: rtl;
}

.menu-guide-overlay.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
    animation: guide-intro-animation 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes guide-intro-animation {
    from { transform: translateY(-50%) scale(0.8); }
    to   { transform: translateY(-50%) scale(1); }
}

.menu-guide-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
}

.guide-text {
    margin: 0;
    font-size: 0.95rem;
    font-weight: bold;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

/* ------------------------------------------------------ */
/* افکت نور نرمِ راست‌به‌چپ (شروع سریع)            */
/* ------------------------------------------------------ */
.guide-text::before {
    content: '';
    position: absolute;
    top: -10%;
    height: 120%;
    width: 160px;
    background: linear-gradient(
        to left,
        rgba(255, 235, 59, 0) 0%,
        rgba(255, 235, 59, 0.05) 40%,
        rgba(255, 235, 59, 0.25) 70%,
        var(--accent-yellow) 95%,
        rgba(255, 235, 59, 0) 100%
    );
    filter: blur(6px);
    opacity: 0;
    /* بلافاصله بعد از ظاهر شدنِ باکس، نور هم شروع به حرکت کند */
    animation: soft-sweep-rtl 10s infinite cubic-bezier(.37, 0, .63, 1);
    animation-delay: 0.6s;   /* ← همین یک خط مشکل را حل می‌کند */
}

@keyframes soft-sweep-rtl {
    0%  { right: -180px; opacity: 0; }
    5%  { opacity: 1; }
    35% { right: calc(100% + 20px); opacity: 1; }
    50% { opacity: 0; }
    100%{ right: calc(100% + 20px); opacity: 0; }
}

.guide-arrow {
    width: 30px;
    height: 30px;
    stroke: var(--accent-yellow);
    animation: point-left 1.5s ease-in-out infinite;
    transform: rotate(180deg);
}

@keyframes point-left {
    0%, 100% { transform: translateX(0) rotate(180deg); }
    50%      { transform: translateX(-8px) rotate(180deg); }
}

/* ======================================================= */
/* ============ END: پایان استایل راهنمای منو ============ */
/* ======================================================= */

/* =================================================================
// START: استایل مربوط به منوی بازشونده ایموجی (موقعیت جدید: داخل فرم چت)
// ================================================================= */

/* 1. استایل کلی (موقعیت دهی) */
/* از position:absolute به position:relative برای داخل فرم چت تغییر کرد */
#emoji-flyout-wrapper {
    position: relative; /* برای حفظ جریان flex در فرم چت */
    order: 2; /* قرارگیری بین input و send-btn در flex-box فرم چت */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 -5px;
    z-index: 10; 
}

/* 2. استایل دکمه تاگل */
/* ابعاد کوچکتر و استایل ساده‌تر برای داخل فرم */
.emoji-reaction-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 30px; 
    height: 30px;
    min-width: 30px; /* جلوگیری از تغییر اندازه در flex */
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: none;
    transition: color 0.2s, transform 0.2s;
    padding: 0;
}

.emoji-reaction-toggle:hover {
    color: var(--primary-color); /* تغییر رنگ در هاور */
    transform: scale(1.05);
}

/* 3. استایل منوی بازشونده ایموجی (حالت پیش فرض: مخفی) */
#emoji-reactions-container {
    /* موقعیت منو را نسبت به فرم چت (والدش) تعیین می‌کند */
    position: absolute; 
    bottom: 40px; /* باز شدن منو به سمت بالا */
    right: 0; /* چسبیدن به لبه راست دکمه */
    
    display: flex;
    flex-direction: row-reverse;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-surface); /* رنگ پس‌زمینه جدید */
    border: 1px solid var(--divider-color);
    border-radius: 20px;
    
    /* حالت مخفی اولیه (همان انیمیشن قبلی) */
    clip-path: circle(0% at 100% 50%); 
    transform: scale(0.8);
    opacity: 0;
    visibility: hidden;
    
    transition: 
        clip-path 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        opacity 0.2s ease,
        visibility 0s linear 0.3s;
    
    z-index: 11; /* بالاتر از همه عناصر داخل چت */
    box-shadow: var(--shadow);
}

/* 4. (مهم!) حالت باز شده */
#emoji-flyout-wrapper.open #emoji-reactions-container {
    clip-path: circle(150% at 100% 50%); 
    transform: scale(1);
    opacity: 1;
    visibility: visible;
    
    transition: 
        clip-path 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        opacity 0.2s ease,
        visibility 0s linear;
}

/* 5. (جدید) مخفی کردن دکمه تاگل (لازم نیست در این حالت) */
#emoji-flyout-wrapper.open #emoji-toggle-button {
    /* در فرم چت نیازی به مخفی کردن دکمه نداریم، فقط استایل آن را عوض می‌کنیم */
    color: var(--primary-color);
}


/* 6. استایل خود ایموجی‌ها (بدون تغییر) */
.emoji-reaction {
    width: 30px; 
    height: 30px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px; 
    line-height: 1; 
    border-radius: 5px; 
    background-color: transparent;
    transition: background-color 0.2s, transform 0.2s;
}

.emoji-reaction:hover {
    transform: scale(1.05);
    background-color: rgba(255, 255, 255, 0.1);
}

/* =================================================================
// END: استایل مربوط به منوی بازشونده ایموجی
// ================================================================= */

/* --- Welcome Modal Slider Styles (Revised for Modern Look) --- */
#welcome-modal-content {
    /* کاهش پدینگ بالا از 30px به 20px */
    padding: 20px 20px 85px 20px; 
    /* کاهش حداقل ارتفاع کلی مودال از 400px به 350px */
    min-height: 350px;
    overflow: hidden;
    /* این انیمیشن برای بسته شدن مودال است */
    transition: transform var(--transition-speed) var(--transition-curve), min-height 0.3s ease;
}

.welcome-slider-container {
    position: relative;
    width: 100%;
    /* کاهش ارتفاع اصلی کانتینر اسلاید از 250px به 200px */
    height: 200px; 
    margin-bottom: 25px; /* کمی فضای بیشتر بالای دات‌ها */
}

.welcome-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    /* 🌟 انیمیشن نرم‌تر و زیباتر با منحنی ease-in-out قوی‌تر و مدت زمان کمی بیشتر */
    transform: translateX(100%); 
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), /* منحنی استاندارد و نرم */
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.6s;
}

.welcome-slide.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.welcome-slide.prev {
    /* اسلاید به بیرون چپ منتقل شود */
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
}

.welcome-slide i {
    /* **تغییر: کاهش اندازه آیکون از 4rem به 2.5rem** */
    font-size: 2.5rem; 
    color: var(--primary-color);
    /* **تغییر: کاهش فاصله پایین آیکون از 20px به 15px** */
    margin-bottom: 15px; 
    opacity: 0.85; 
}

.welcome-slide h3 {
    margin-top: 0;
    /* **تغییر: کاهش اندازه تیتر از 1.5rem به 1.25rem** */
    margin-bottom: 8px; /* کمی کمتر */
    font-size: 1.25rem; 
    font-weight: 700;
}

.welcome-slide p {
    /* **تغییر: کاهش اندازه متن پاراگراف از 1.05rem به 0.95rem** */
    font-size: 0.95rem; 
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 0 10px;
    margin: 0;
    max-width: 350px;
}

/* --- Navigation Dots (Pill-shaped Modern Look) --- */
.welcome-slider-dots {
    position: absolute;
    bottom: 65px; /* 🌟 تغییر: کمی بالاتر بردن دات‌ها برای ایجاد فضای بیشتر بالای دکمه */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.welcome-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background-color: var(--bg-surface-hover);
    cursor: pointer;
    transition: background-color 0.3s ease, width 0.3s ease, border-radius 0.3s ease;
}

.welcome-dot.active {
    width: 25px;
    height: 8px;
    border-radius: 4px;
    background-color: var(--primary-color);
}

/* --- Navigation Buttons (Smaller and Lower) --- */
.welcome-slider-nav {
    position: absolute;
    bottom: 10px; /* 🌟 تغییر: پایین آوردن دکمه‌ها تا جای ممکن */
    left: 20px;
    right: 20px;
    display: block;
}

.welcome-nav-btn {
    width: 100%;
    /* 🌟 تغییر: کوچک‌تر شدن ارتفاع دکمه */
    padding: 8px 20px; 
    font-size: 0.9rem; /* فونت کوچک‌تر */
    
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s ease, opacity 0.3s ease, box-shadow 0.3s;
    box-shadow: var(--shadow);
}

.welcome-nav-btn.primary {
    background-color: var(--primary-color);
    color: #fff;
}

.welcome-nav-btn:hover {
    opacity: 0.9;
}