/* -------------------------------------------------------------
   YouTube-to-Article App CSS Design System
   Style: Dark Space Glassmorphism, Neon Accents, Smooth Animations
   ------------------------------------------------------------- */

:root {
    --bg-primary: #0a0a12;
    --bg-secondary: rgba(20, 20, 35, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(147, 51, 234, 0.4);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    
    --gradient-primary: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
    --gradient-glow: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(6, 182, 212, 0.3) 100%);
    
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Фоновое свечение */
.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(6, 182, 212, 0.05) 50%, transparent 100%);
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    filter: blur(80px);
    pointer-events: none;
}

/* Сетки и макеты */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Навигационная панель */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.4));
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.badge {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--accent-purple);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 99px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

/* Секция Hero */
.hero-section {
    text-align: center;
    max-width: 850px;
    margin: 40px auto 60px auto;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 52px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
    background: linear-gradient(180deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 40px;
}

/* Поле ввода URL */
.url-input-container {
    display: flex;
    background: rgba(15, 15, 27, 0.6);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
    position: relative;
}

.url-input-container:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.25);
}

.url-input-container input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 16px;
    padding: 12px 20px;
    font-family: var(--font-sans);
}

.url-input-container input::placeholder {
    color: rgba(156, 163, 175, 0.6);
}

/* Кнопки */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    outline: none;
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
}

.btn-copy {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-copy:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
}

/* Раздел Библиотеки */
.library-section {
    margin-top: 40px;
    transition: var(--transition-smooth);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.search-container input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-sans);
    outline: none;
    width: 280px;
    transition: var(--transition-smooth);
}

.search-container input:focus {
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.08);
}

/* Сетка карточек */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.video-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.15);
}

.card-thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Соотношение сторон 16:9 */
    background: #111;
}

.card-thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-green);
}

.status-badge.processing {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--accent-yellow);
    animation: pulse 1.5s infinite;
}

.status-badge.pending {
    background: rgba(156, 163, 175, 0.2);
    border: 1px solid rgba(156, 163, 175, 0.4);
    color: var(--text-muted);
}

.status-badge.failed {
    background: rgba(239, 108, 108, 0.2);
    border: 1px solid rgba(239, 108, 108, 0.4);
    color: var(--accent-red);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-author {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: auto;
    padding-bottom: 12px;
}

.card-footer {
    font-size: 12px;
    color: rgba(156, 163, 175, 0.5);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
}

/* Детальный вид */
.detail-section {
    animation: fadeIn 0.4s ease-out;
}

.detail-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.video-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
}

.video-iframe-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-meta h3 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.author-name {
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 24px;
}

/* Панель Статьи (с вкладками) */
.article-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.tabs-header {
    display: flex;
    background: rgba(10, 10, 18, 0.5);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--accent-purple);
    border-bottom-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.04);
}

.tabs-content {
    padding: 30px;
    flex: 1;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Стилизация содержимого Markdown */
.markdown-body {
    line-height: 1.7;
    font-size: 16px;
    color: rgba(243, 244, 246, 0.9);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-family: var(--font-heading);
    color: #ffffff;
    font-weight: 700;
    margin-top: 30px;
    margin-bottom: 16px;
}

.markdown-body h2 {
    font-size: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.markdown-body h3 {
    font-size: 20px;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent-purple);
    background: rgba(168, 85, 247, 0.05);
    padding: 16px 24px;
    border-radius: 0 12px 12px 0;
    margin: 24px 0;
    font-style: italic;
    color: rgba(243, 244, 246, 0.8);
}

.markdown-body strong {
    color: #ffffff;
    font-weight: 700;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.markdown-body th, .markdown-body td {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 700;
}

/* Стилизация сырого транскрипта */
.transcript-body {
    max-height: 500px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 20px;
    background: rgba(10, 10, 18, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Загрузчики и спиннеры */
.loading-spinner-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(168, 85, 247, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-purple);
    animation: spin 1s linear infinite;
}

/* Утилиты */
.hidden {
    display: none !important;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Анимации */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Подвал */
.footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
    background: rgba(10, 10, 18, 0.5);
    margin-top: auto;
}
