/* ============================================================
   Cinema Club — Player CSS (Final Clean Code)
============================================================ */

/* ============================================================
   Player Container
============================================================ */
.cc-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    direction: ltr;
    font-family: Tahoma, sans-serif;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.cc-player-inner {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ============================================================
   Video & Poster
============================================================ */
.cc-player-poster {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    transition: opacity 0.3s;
}

.cc-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    cursor: pointer;
    z-index: 2;
}

/* ============================================================
   Subtitle Container
============================================================ */
.cc-subtitle-container {
    position: absolute;
    left: 5%; right: 5%;
    bottom: var(--cc-sub-margin, 10%);
    text-align: center;
    z-index: 4;
    pointer-events: none;
    font-family: Tahoma;
    transition: bottom 0.2s;
}
.cc-subtitle-container span {
    padding: 4px 10px;
    border-radius: 4px;
    display: none;
}

/* تنظیمات زیرنویس (رنگ، اندازه، پس‌زمینه) */
.cc-video.sub-white + .cc-subtitle-container { color: #ffffff !important; }
.cc-video.sub-yellow + .cc-subtitle-container { color: #f1c40f !important; }
.cc-video.sub-green + .cc-subtitle-container { color: #2ecc71 !important; }
.cc-video.sub-small + .cc-subtitle-container { font-size: 14px !important; }
.cc-video.sub-medium + .cc-subtitle-container { font-size: 18px !important; }
.cc-video.sub-large + .cc-subtitle-container { font-size: 26px !important; }
.cc-video.sub-bg-black + .cc-subtitle-container span { background-color: rgba(0,0,0,0.8) !important; }
.cc-video.sub-bg-transparent + .cc-subtitle-container span { background-color: transparent !important; text-shadow: 0 0 4px rgba(0,0,0,1) !important; }

/* ============================================================
   Center Play Group
============================================================ */
.cc-center-play-group {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 6;
    transition: opacity 0.2s;
}
.cc-player.is-playing .cc-center-play-group { opacity: 0; pointer-events: none; }
.cc-player.is-playing:hover .cc-center-play-group { opacity: 1; pointer-events: auto; }

.cc-btn-rewind-10, .cc-btn-forward-10 {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.cc-btn-rewind-10:hover, .cc-btn-forward-10:hover { color: #ffbd3c; }

.cc-big-play {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.cc-big-play:hover {
    background: #ffbd3c;
    border-color: #ffbd3c;
    color: #111;
    transform: scale(1.05);
}

/* ============================================================
   Bottom Controls
============================================================ */
.cc-controls {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 30px 20px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.6) 60%, transparent);
    z-index: 10;
    direction: ltr;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
}
.cc-player.is-active .cc-controls,
.cc-player.is-paused .cc-controls {
    opacity: 1;
    transform: translateY(0);
}

.cc-time-row { display: flex; justify-content: flex-start; margin-bottom: 8px; }
.cc-time { display: flex; gap: 5px; color: #fff; font-size: 13px; font-family: Tahoma; }

.cc-progress {
    position: relative;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: height 0.2s;
}
.cc-progress:hover { height: 8px; }
.cc-progress-buffer { position: absolute; top: 0; bottom: 0; left: 0; height: 100%; border-radius: 3px; background: rgba(255,255,255,0.3); width: 0; }
.cc-progress-played { position: absolute; top: 0; bottom: 0; left: 0; height: 100%; border-radius: 3px; background: #ffbd3c; width: 0; }
.cc-progress-handle { position: absolute; right: -7px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; border-radius: 50%; background: #fff; }

.cc-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cc-controls-left, .cc-controls-right { display: flex; align-items: center; gap: 15px; }

.cc-btn {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}
.cc-btn:hover { background: rgba(255,255,255,0.15); color: #ffbd3c; }

.cc-volume-wrap { display: flex; align-items: center; gap: 5px; }
.cc-volume-slider-wrap { width: 0; overflow: hidden; display: flex; align-items: center; transition: width 0.2s; }
.cc-volume-wrap:hover .cc-volume-slider-wrap { width: 80px; }
.cc-volume-slider { width: 80px; height: 4px; accent-color: #ffbd3c; cursor: pointer; }

/* ============================================================
   Spinner & Error
============================================================ */
@keyframes cc-spin { 100% { transform: rotate(360deg); } }
.cc-spinner {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background: rgba(0,0,0,0.3);
}
.cc-spinner-ring {
    width: 56px; height: 56px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #ffbd3c;
    border-radius: 50%;
    animation: cc-spin 1s linear infinite;
}
.cc-error-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    color: #fff;
}
.cc-error-box {
    text-align: center;
    padding: 30px;
    background: rgba(30,30,40,0.95);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}
.cc-retry-btn {
    padding: 10px 30px;
    background: #ffbd3c;
    color: #111;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: Tahoma;
}

/* ============================================================
   Settings Menus (Glassmorphism)
============================================================ */
.cc-settings-menu {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 250px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    padding: 0;
    overflow: hidden;
    z-index: 101;
    display: none;
}
.cc-settings-menu:not([hidden]) { display: flex; flex-direction: column; }

.cc-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    font-weight: bold;
    color: #fff;
}
.cc-panel-close {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}
.cc-panel-close:hover { color: #ffbd3c; }

.cc-quality-section { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.cc-quality-section:last-child { border-bottom: none; }
.cc-section-title {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Quality Grid: 3 items per row */
.cc-quality-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.cc-quality-option {
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
    text-align: center;
}
.cc-quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.cc-quality-option.is-active {
    background: rgba(255, 189, 60, 0.15);
    border-color: #ffbd3c;
    color: #ffbd3c;
    box-shadow: 0 0 10px rgba(255, 189, 60, 0.2);
}

/* Subtitle Settings */
.cc-sub-settings-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: Tahoma;
}
.cc-sub-settings-body label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #ccc;
}
.cc-sub-settings-body select {
    width: 100%;
    padding: 8px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #fff;
    outline: none;
    font-size: 12px;
}
.cc-sub-settings-body input[type="range"] {
    width: 100%;
    accent-color: #ffbd3c;
}
#cc-save-status {
    font-size: 12px;
    text-align: center;
    min-height: 18px;
    color: #2ecc71;
    opacity: 0;
    transition: opacity 0.3s;
}

/* ============================================================
   Mobile
============================================================ */
@media (max-width: 768px) {
    .cc-center-play-group { gap: 15px; }
    .cc-big-play { width: 60px; height: 60px; }
    .cc-big-play svg { width: 30px; height: 30px; }
    .cc-btn-rewind-10, .cc-btn-forward-10 { width: 40px; height: 40px; }
    .cc-btn-rewind-10 svg, .cc-btn-forward-10 svg { width: 28px; height: 28px; }
    
    .cc-controls { padding: 20px 10px 8px; }
    .cc-btn { width: 32px; height: 32px; }
    .cc-btn svg { width: 18px; }
    
    .cc-settings-menu { width: 160px; bottom: 50px; right: 10px; }
    .cc-panel-header { padding: 8px 10px; font-size: 10px; }
    .cc-panel-close { font-size: 12px; }
    .cc-quality-section { padding: 8px 10px; }
    .cc-section-title { font-size: 9px; margin-bottom: 6px; }
    .cc-quality-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .cc-quality-option { padding: 5px 2px; font-size: 9px; border-radius: 6px; }
    
    .cc-sub-settings-body { padding: 10px; gap: 8px; }
    .cc-sub-settings-body label { font-size: 9px; margin-bottom: 4px; }
    .cc-sub-settings-body select { padding: 4px; font-size: 10px; border-radius: 6px; }
    .cc-sub-settings-body input[type="range"] { height: 3px; }
}