/* Tối ưu hóa thanh scrollbar */
::-webkit-scrollbar { 
    width: 6px; 
    height: 6px; 
}
::-webkit-scrollbar-track { 
    background: transparent; 
}
::-webkit-scrollbar-thumb { 
    background: #334155; 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { 
    background: #475569; 
}

/* CSS Ẩn/Hiện Tab */
.tab-content { 
    display: none; 
}
.tab-content.active { 
    display: block; 
    animation: fadeIn 0.2s ease-in-out; 
}

/* Animation chuyển tab */
@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(5px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* Custom cái mũi tên thả xuống (Dropdown) cho hợp tông Dark Mode */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 2rem !important;
}
select option { 
    background-color: #1e293b; 
    color: #e2e8f0; 
}

/* =========================================================================
   BỔ SUNG CSS CHO TAB OFANS (TUYỆT ĐỐI KHÔNG CHẠM VÀO CODE TRÊN)
   ========================================================================= */
.ofans-subtab { color: #94a3b8; border: 1px solid transparent; }
.ofans-subtab.active { background: #3b82f6; color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); border-color: #3b82f6; }

.glass-panel { background: rgba(30, 41, 59, 0.7); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); }
.hidden-view { display: none !important; }

/* Calendar zoom: 0.5 → 1.0 (mặc định 1.0). Set qua JS */
#ofans-calendarView { --cal-scale: 1; }

.calendar-nav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; background: rgba(30, 41, 59, 0.5); padding: 10px 20px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); gap: 12px; flex-wrap: wrap; }
.calendar-month-title { font-size: 18px; font-weight: bold; color: #3b82f6; text-transform: uppercase; letter-spacing: 1px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background-color: #334155; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3); }
.calendar-header-cell { background-color: #1e293b; padding: calc(12px * var(--cal-scale)); text-align: center; font-size: calc(12px * var(--cal-scale)); font-weight: bold; color: #94a3b8; text-transform: uppercase; }

.calendar-day-cell { background-color: #0f172a; min-height: calc(110px * var(--cal-scale)); padding: calc(8px * var(--cal-scale)); transition: 0.2s; position: relative; border-bottom: 1px solid #1e293b; border-right: 1px solid #1e293b; }
.calendar-day-cell:hover { background-color: #1e293b; }
.calendar-day-cell.other-month { opacity: 0.1; pointer-events: none; }
.calendar-date-num { font-size: calc(13px * var(--cal-scale)); font-weight: 700; margin-bottom: calc(8px * var(--cal-scale)); color: #64748b; }
.calendar-day-cell.today .calendar-date-num {
    background-color: #ef4444;
    color: white;
    width: calc(28px * var(--cal-scale));
    height: calc(28px * var(--cal-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: calc(14px * var(--cal-scale));
    text-decoration: none;
    margin-top: -4px;
    margin-left: -4px;
    box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}

.event-chip { font-size: calc(10px * var(--cal-scale)); padding: calc(4px * var(--cal-scale)) calc(6px * var(--cal-scale)); border-radius: 6px; margin-bottom: calc(4px * var(--cal-scale)); cursor: pointer; overflow: hidden; font-weight: bold; border-left: 3px solid transparent; display: flex; flex-direction: column; transition: transform 0.1s; gap: 1px; }
.event-chip:hover { transform: scale(1.02); filter: brightness(1.2); }
.chip-row-2 { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; min-width: 0; }
.chip-channel { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-time { font-size: calc(8px * var(--cal-scale)); opacity: 0.8; font-weight: normal; flex-shrink: 0; white-space: nowrap; }

/* ==========================================
   AUTOCOMPLETE DROPDOWN (autocomplete.js)
========================================== */
.ac-dropdown {
    position: absolute;
    z-index: 9999;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    color: #e2e8f0;
    padding: 4px 0;
}
.ac-dropdown .ac-item {
    padding: 7px 12px;
    cursor: pointer;
    line-height: 1.3;
    transition: background-color 0.1s;
}
.ac-dropdown .ac-item.ac-active {
    background: #2563eb;
    color: white;
}
.ac-dropdown .ac-item mark {
    background: transparent;
    color: #34d399;
    font-weight: 700;
    text-decoration: underline;
}
.ac-dropdown .ac-item.ac-active mark {
    color: #fde68a;
}

/* Slider zoom calendar */
.cal-zoom-slider { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; background: #334155; border-radius: 2px; outline: none; cursor: pointer; }
.cal-zoom-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: #3b82f6; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 2px rgba(59,130,246,0.3); transition: 0.15s; }
.cal-zoom-slider::-webkit-slider-thumb:hover { background: #60a5fa; box-shadow: 0 0 0 4px rgba(59,130,246,0.4); }
.cal-zoom-slider::-moz-range-thumb { width: 14px; height: 14px; background: #3b82f6; border-radius: 50%; cursor: pointer; border: none; }

.bg-chan-do { background-color: rgba(239, 68, 68, 0.2); color: #f87171; border-left-color: #ef4444; }
.bg-chan-xanh-la { background-color: rgba(34, 197, 94, 0.2); color: #4ade80; border-left-color: #22c55e; }
.bg-chan-xanh-duong { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; border-left-color: #3b82f6; }
.bg-chan-vang { background-color: rgba(234, 179, 8, 0.2); color: #facc15; border-left-color: #eab308; }
.bg-chan-hong { background-color: rgba(236, 72, 153, 0.2); color: #f472b6; border-left-color: #ec4899; }
.bg-chan-trang { background-color: rgba(255, 255, 255, 0.1); color: #ffffff; border-left-color: #ffffff; }

/* HIỆU ỨNG GLOW SÁNG NHẤP NHÁY THEO MÀU KÊNH KHI CLICK LỌC */
@keyframes glowPulseAll { 0%, 100% { box-shadow: 0 0 5px #94a3b8, 0 0 15px #94a3b8; border-color: #94a3b8; } 50% { box-shadow: 0 0 2px #94a3b8, 0 0 8px #94a3b8; border-color: #64748b; } }
@keyframes glowPulseDo { 0%, 100% { box-shadow: 0 0 5px #ef4444, 0 0 15px #ef4444; border-color: #ef4444; } 50% { box-shadow: 0 0 2px #ef4444, 0 0 8px #ef4444; border-color: rgba(239,68,68,0.5); } }
@keyframes glowPulseXanhLa { 0%, 100% { box-shadow: 0 0 5px #22c55e, 0 0 15px #22c55e; border-color: #22c55e; } 50% { box-shadow: 0 0 2px #22c55e, 0 0 8px #22c55e; border-color: rgba(34,197,94,0.5); } }
@keyframes glowPulseXanhDuong { 0%, 100% { box-shadow: 0 0 5px #3b82f6, 0 0 15px #3b82f6; border-color: #3b82f6; } 50% { box-shadow: 0 0 2px #3b82f6, 0 0 8px #3b82f6; border-color: rgba(59,130,246,0.5); } }
@keyframes glowPulseVang { 0%, 100% { box-shadow: 0 0 5px #eab308, 0 0 15px #eab308; border-color: #eab308; } 50% { box-shadow: 0 0 2px #eab308, 0 0 8px #eab308; border-color: rgba(234,179,8,0.5); } }
@keyframes glowPulseHong { 0%, 100% { box-shadow: 0 0 5px #ec4899, 0 0 15px #ec4899; border-color: #ec4899; } 50% { box-shadow: 0 0 2px #ec4899, 0 0 8px #ec4899; border-color: rgba(236,72,153,0.5); } }
@keyframes glowPulseTrang { 0%, 100% { box-shadow: 0 0 5px #ffffff, 0 0 15px #ffffff; border-color: #ffffff; } 50% { box-shadow: 0 0 2px #ffffff, 0 0 8px #ffffff; border-color: rgba(255,255,255,0.5); } }

.glow-active-all { animation: glowPulseAll 2s infinite; border: 1px solid #94a3b8 !important; }
.glow-active-do { animation: glowPulseDo 2s infinite; border: 1px solid #ef4444 !important; }
.glow-active-xanh-la { animation: glowPulseXanhLa 2s infinite; border: 1px solid #22c55e !important; }
.glow-active-xanh-duong { animation: glowPulseXanhDuong 2s infinite; border: 1px solid #3b82f6 !important; }
.glow-active-vang { animation: glowPulseVang 2s infinite; border: 1px solid #eab308 !important; }
.glow-active-hong { animation: glowPulseHong 2s infinite; border: 1px solid #ec4899 !important; }
.glow-active-trang { animation: glowPulseTrang 2s infinite; border: 1px solid #ffffff !important; }
/* ==========================================
   TÙY CHỈNH NÚT & TOOLTIP XEM NHANH VIDEO 
========================================== */
.ofans-action-btn { position: relative; transition: all 0.2s ease; cursor: pointer; }
.ofans-action-btn:hover { transform: scale(1.1); }

/* Bóng bóng Popup */
.ofans-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 50;
    border: 1px solid #475569;
}
/* Mũi tên của Popup */
.ofans-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #475569 transparent transparent transparent;
}

/* Kích hoạt hiển thị khi rê chuột */
.ofans-action-btn:hover .ofans-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Đổi màu Hover cho Nút và Tên Video */
.btn-play-hover:hover { background-color: #10b981 !important; color: white !important; border-color: #34d399 !important; }
.btn-edit-hover:hover { background-color: #2563eb !important; color: white !important; border-color: #60a5fa !important; }
.title-hover:hover { color: #34d399 !important; text-decoration: underline !important; }
/* ==========================================
   TẮT HIỆU ỨNG VIỀN KHI CLICK VÀO Ô NHẬP LIỆU TRONG FORM
========================================== */
input:focus, select:focus, textarea:focus {
    outline: none !important;
    box-shadow: none !important; /* Tắt vòng sáng (ring) của Tailwind */
    border-color: #334155 !important; /* Khóa chết màu viền xám đen mặc định, không cho đổi màu */
}

/* ==========================================
   LOGIN SCREEN (auth.js)
========================================== */
body.auth-locked { display: none !important; }

#auth-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0b1120;
    color: #e2e8f0;
    animation: authFadeIn 0.3s ease-out;
}

@keyframes authFadeIn { from { opacity: 0; } to { opacity: 1; } }

.auth-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.15), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.15), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(234, 179, 8, 0.05), transparent 60%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    padding: 36px 32px 28px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.auth-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: #10b981;
    letter-spacing: -0.02em;
}
.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin: 4px 0 4px;
    letter-spacing: -0.02em;
}
.auth-subtitle {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    border-radius: 10px;
    transition: all 0.15s;
}
.auth-input-wrap:focus-within {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}
.auth-input-wrap > i:first-child {
    margin: 0 14px;
    color: #64748b;
    font-size: 13px;
}
.auth-input-wrap input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 12px 14px 12px 0;
    color: #fff !important;
    font-size: 14px;
    outline: none;
}
.auth-input-wrap input::placeholder { color: #475569; }

.auth-eye {
    background: none;
    border: none;
    color: #64748b;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s;
}
.auth-eye:hover { color: #10b981; }

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}
.auth-remember input { cursor: pointer; accent-color: #10b981; }

.auth-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fb7185;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin: 0;
}
.auth-error.hidden { display: none; }

.auth-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 13px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 8px 24px -8px rgba(16, 185, 129, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}
.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -8px rgba(16, 185, 129, 0.6);
}
.auth-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.auth-btn-success {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
}

.auth-footer {
    text-align: center;
    color: #64748b;
    font-size: 11px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.auth-footer i { color: #10b981; margin-right: 4px; }