/* ========================================
   MODERN UI - VOT Web Interface
   ======================================== */

/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   BASE STYLES
   ======================================== */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: url('backgroud.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #f8f9fa;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 11, 14, 0.65);
    /* Темная подложка для читаемости */
    z-index: -1;
}

/* ========================================
   AUTH PAGE
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    min-width: 320px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 0.75rem 1rem !important;
    transition: all 0.2s;
}

.modern-input:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(102, 126, 234, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    color: #fff !important;
}

.modern-input::placeholder {
    color: #64748b;
}

.mask-input {
    -webkit-text-security: disc !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    border-radius: 8px !important;
    color: #fca5a5 !important;
}

.text-muted {
    color: #94a3b8 !important;
}

.btn-lg {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
}


.container-fluid {
    max-width: 2500px;
    margin: 0 auto;
}

/* ========================================
   GLASSMORPHISM CARDS
   ======================================== */
.modern-card {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.37),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 48px 0 rgba(0, 0, 0, 0.5),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(102, 126, 234, 0.3) !important;
}

/* ========================================
   GRADIENT TEXT
   ======================================== */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ========================================
   MODERN BUTTONS
   ======================================== */
.btn-modern {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-modern:active {
    transform: translateY(0);
}

/* Button Color Variants */
.btn-modern.btn-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.btn-modern.btn-success:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.3));
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-modern.btn-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-modern.btn-danger:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.3));
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-modern.btn-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.btn-modern.btn-warning:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.3));
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-modern.btn-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.btn-modern.btn-primary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.3));
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-modern.btn-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(8, 145, 178, 0.2));
    border-color: rgba(6, 182, 212, 0.3);
    color: #67e8f9;
}

.btn-modern.btn-info:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(8, 145, 178, 0.3));
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-modern.btn-secondary {
    background: rgba(100, 116, 139, 0.2);
    border-color: rgba(100, 116, 139, 0.3);
    color: #cbd5e1;
}

.btn-modern.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.3);
    border-color: rgba(100, 116, 139, 0.5);
}

.btn-modern.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #764ba2;
    color: #fff;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* ========================================
   SECTION LABELS
   ======================================== */
.button-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-left: 0.25rem;
    display: inline-block;
}

/* ========================================
   MODAL DIALOGS
   ======================================== */
.modal-content {
    background: rgba(10, 14, 39, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow:
        0 20px 60px 0 rgba(0, 0, 0, 0.5),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.modal-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px 16px 0 0 !important;
}

.modal-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.modal-body {
    color: #e2e8f0;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* ========================================
   FORM CONTROLS
   ======================================== */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Select dropdown options */
.form-select option {
    background: #1a1f3a;
    color: #e2e8f0;
    padding: 0.5rem;
}

.form-select option:hover,
.form-select option:checked {
    background: rgba(102, 126, 234, 0.3);
}

/* Form labels */
.form-label {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Range slider */
.form-range {
    height: 6px;
}

.form-range::-webkit-slider-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.form-range::-moz-range-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.form-range::-webkit-slider-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.form-range::-moz-range-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}


/* ========================================
   TABS
   ======================================== */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 2050;
    /* Higher than media-drawer (2000) */
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    margin: -1rem -1rem 1rem -1rem;
    /* Adjust for container padding if needed */
    padding: 0.5rem 1rem 0 1rem;
}

.nav-tabs .nav-link {
    color: #94a3b8;
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tabs .nav-link.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.2);
    border-bottom: 2px solid #667eea;
}

/* ========================================
   CARDS & BACKGROUNDS
   ======================================== */
.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.bg-secondary-subtle {
    background: rgba(255, 255, 255, 0.03) !important;
}

.bg-success-subtle {
    background: rgba(16, 185, 129, 0.15) !important;
}

.bg-warning-subtle {
    background: rgba(245, 158, 11, 0.15) !important;
}

.bg-primary-subtle {
    background: rgba(59, 130, 246, 0.15) !important;
}

.bg-info-subtle {
    background: rgba(13, 202, 240, 0.15) !important;
}

.card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   LOG ENTRIES
   ======================================== */
#tasks-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Карточки одна под одной */
    gap: 1.5rem;
    padding-right: 0;
    margin-bottom: 2rem;
}

#tasks-grid::-webkit-scrollbar,
#subscriptions-list::-webkit-scrollbar {
    display: none;
}

.log-entry {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: all 0.3s;
    animation: fadeIn 0.3s ease-in;
}

/* Channel Banner Overlays */
.sub-banner-container {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.sub-banner-overlay-play {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.sub-banner-container:hover .sub-banner-overlay-play {
    opacity: 1;
}

.sub-banner-container:hover .sub-banner-main {
    transform: scale(1.05);
}

.sub-banner-main {
    transition: transform 0.3s ease;
}

.cursor-pointer {
    cursor: pointer !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-entry:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.log-entry-header {
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
}

/* Status Colors with Gradients */
.log-entry.status-processing .log-entry-header {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.log-entry.status-success .log-entry-header {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.log-entry.status-error .log-entry-header {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.log-entry.status-skipped .log-entry-header {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.log-entry.status-queued {
    opacity: 0.6;
}

.log-entry.status-queued .log-entry-header {
    background: rgba(100, 116, 139, 0.3);
}

/* ========================================
   LOG TEXT COLORS
   ======================================== */
.log-info {
    color: #6ee7b7;
    font-weight: 500;
}

.log-warn {
    color: #fcd34d;
    font-weight: 500;
}

.log-error {
    color: #fca5a5;
    font-weight: 700;
}

.log-module {
    color: #94a3b8;
    font-weight: 500;
}

.log-divider {
    color: #67e8f9;
}

.log-link {
    color: #93c5fd;
    text-decoration: underline;
    transition: color 0.2s;
}

.log-link:hover {
    color: #bfdbfe;
}

/* ========================================
   PROGRESS BARS
   ======================================== */
.progress {
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea, #764ba2);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.5);
    transition: width 0.3s ease;
}

.progress-bar-animated {
    animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
    0% {
        background-position: -100% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   STATS DISPLAY
   ======================================== */
#stats-card {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Stat Items */
.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-success {
    border-left: 3px solid #00f2fe !important;
}

.stat-warning {
    border-left: 3px solid #f9d423 !important;
}

.stat-label {
    opacity: 0.7;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.stat-value {
    font-weight: 700;
    font-size: 1.25rem;
}

.automation-status {
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.stat-item.stat-warning .stat-value {
    color: #fcd34d;
}

#stats-card .fs-4 {
    font-weight: 700;
    font-size: 1.75rem !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   MANUAL WORKFLOW STYLES
   ======================================== */
.animate-pulse {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

#pendingVideosModal .table {
    border-color: rgba(255, 255, 255, 0.1);
}

#pendingVideosModal .table thead th {
    background-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px;
}

#pendingVideosModal .table tbody td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px;
}

#pendingVideosModal .btn-group .btn {
    border-radius: 4px;
    margin-left: 2px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .modern-btn-group {
        width: 100%;
    }

    .btn-modern {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }
}

/* Modern List Styling - Адаптивная плитка на всю ширину */
.modern-list {
    background: transparent;
    border: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    padding: 0;
    width: 100%;
}

.modern-list .list-group-item {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 15px !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modern-list .list-group-item:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    transform: translateY(-8px);
    border-color: rgba(var(--accent-rgb), 0.5) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.modern-list .delete-btn {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.modern-list .list-group-item:hover .delete-btn {
    opacity: 1;
}

.min-width-0 {
    min-width: 0;
}

/* Subscription Banner Styling */
.sub-banner-container {
    width: 100%;
    height: 120px;
    /* Уменьшенная высота для компактности на 4K */
    background: #000;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sub-banner-blur {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(15px) brightness(0.5);
    transform: scale(1.1);
    /* Чтобы края не были пустыми после блюра */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.sub-banner-main {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.modern-card:hover .sub-banner-main {
    transform: scale(1.05);
}

.modern-list .modern-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-list .modern-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.sub-banner-link {
    display: block;
    text-decoration: none !important;
    border: none;
    outline: none;
}

.sub-banner-link:hover {
    opacity: 0.95;
}

/* Placeholder Styling */
.sub-banner-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.4) 0%, rgba(var(--accent-rgb), 0.1) 100%);
    position: relative;
    overflow: hidden;
}

.sub-banner-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 80%);
    pointer-events: none;
}

.placeholder-initial {
    font-size: 3.5rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    user-select: none;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* ========================================
   GALLERY ENHANCEMENTS (TubeArchivist Style)
   ======================================== */

.watched-video {
    opacity: 0.75;
    transition: all 0.3s ease;
}

.watched-video:hover {
    opacity: 1;
}

.watched-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(1px);
}

.watched-video .watched-overlay {
    opacity: 1;
}

.watched-overlay i {
    font-size: 3rem;
    color: #10b981;
    /* Success Green */
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.watched-video:hover .watched-overlay i {
    transform: scale(1.1);
}

/* Ensure play overlay is still accessible/visible on hover if needed, 
   but for now, watched overlay takes precedence visually until played. 
   Actually, let's allow play button to show ON TOP if user hovers comfortably.
   But user asked for "Substrate", implying it covers. 
   Let's make play-overlay z-index higher than watched-overlay so user can still see play button on hover. */
.play-overlay {
    z-index: 10;
    /* Higher than 5 */
}

#gallerySearchInput {
    background: rgba(13, 110, 253, 0.05) !important;
}

/* Base card transitions */
.video-card {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Staggered entrance animation class */
.animate-card {
    opacity: 0;
    transform: translateY(20px);
    animation: cardEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.video-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 15px rgba(102, 126, 234, 0.2) !important;
    border-color: rgba(102, 126, 234, 0.5) !important;
    z-index: 10;
}

/* Overlay play button animation */
.play-overlay {
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2) !important;
}

.video-card:hover .play-overlay {
    background: rgba(0, 0, 0, 0.4) !important;
}

.play-overlay i {
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.8;
}

.video-card:hover .play-overlay i {
    transform: scale(1.2);
    opacity: 1;
    color: #fff;
    text-shadow: 0 0 15px rgba(102, 126, 234, 0.8);
}

.toggle-watched-btn {
    opacity: 0.6;
    transition: all 0.2s;
}

.toggle-watched-btn:hover {
    opacity: 1;
    color: #0dcaf0 !important;
    transform: scale(1.2);
}

.watched-video .toggle-watched-btn {
    opacity: 1;
    color: #198754 !important;
}

.watched-video .card-title {
    color: #94a3b8 !important;
}

/* YouTube Links Hover Effects */
.card-title a:hover,
.gradient-text a:hover {
    text-decoration: underline !important;
    opacity: 0.9;
}

.extra-small {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    color: #0dcaf0 !important;
    /* Яркий голубой для лучшей видимости */
}

.btn-group-xs>.btn {
    padding: 1px 5px;
    font-size: 0.7rem;
    line-height: 1.5;
}

/* ========================================
   MEDIA VIEW (Centered HD Player)
   ======================================== */
.media-drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1280px;
    max-width: 95vw;
    height: auto;
    max-height: 90vh;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.media-drawer.active {
    display: flex;
}

.media-drawer-header {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-drawer-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.media-drawer-close:hover {
    color: #fca5a5;
    transform: scale(1.2);
}

.media-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.media-container {
    width: 100%;
    background: #000;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
}

.media-container video {
    width: 100%;
    height: 100%;
    display: block;
}

.media-info {
    animation: fadeIn 0.4s ease-out;
}

.media-info h4 {
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    font-size: 1.25rem;
}

.media-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.media-drawer-overlay.active {
    display: block;
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Search Clear Button Improvements */
.search-clear-btn {
    opacity: 0.5;
    transition: all 0.2s ease;
    border-left: none !important;
}

.search-clear-btn:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.1) !important;
    color: #ff4d4d !important;
}

.search-clear-btn i {
    font-size: 0.8rem;
}

/* ========================================
   CUSTOM UI HELPERS (Moved from client.js)
   ======================================== */
@keyframes heartbeat {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(220, 53, 69, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.heartbeat-badge {
    animation: heartbeat 2s infinite;
}

.hover-link {
    transition: color 0.2s;
}

.hover-link:hover {
    color: #0dcaf0 !important;
    text-decoration: underline !important;
    /* Fix for when parent has gradient-text (makes text transparent) */
    -webkit-text-fill-color: #0dcaf0 !important;
    background: none !important;
}

.source-icon-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-icon-badge i {
    font-size: 0.8rem;
}

.source-icon-badge:hover {
    transform: scale(1.05) translateY(-2px);
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* Colors for specific sources */
.source-badge-translated {
    border-left: 3px solid #60a5fa !important;
    color: #93c5fd !important;
}
.source-badge-translated i { color: #60a5fa; }

.source-badge-direct {
    border-left: 3px solid #34d399 !important;
    color: #6ee7b7 !important;
}
.source-badge-direct i { color: #34d399; }

.source-badge-imported {
    border-left: 3px solid #fbbf24 !important;
    color: #fcd34d !important;
}
.source-badge-imported i { color: #fbbf24; }

.source-badge-local {
    border-left: 3px solid #94a3b8 !important;
    color: #cbd5e1 !important;
}
.source-badge-local i { color: #94a3b8; }
/* Сводки видео (26.10.2026) */
.summary-md { font-size: 0.95rem; line-height: 1.5; }
.summary-md__h { margin: 1rem 0 0.5rem; font-size: 0.95rem; font-weight: 700; color: #8fd3ff; text-transform: none; letter-spacing: 0; }
.summary-md__p { margin-bottom: 0.6rem; }
.summary-md__list { margin: 0 0 0.8rem 0; padding-left: 1.2rem; }
.summary-md__list li { margin-bottom: 0.35rem; }
.summary-md__quote { border-left: 3px solid #4b6a86; padding-left: 0.75rem; color: #b9c7d4; font-style: italic; margin: 0.5rem 0 0.8rem; }
.summary-md code { color: #ffd479; background: rgba(255,255,255,0.06); padding: 0 0.25rem; border-radius: 3px; }
