/* Modern Dark Theme Design System */
:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(21, 28, 45, 0.7);
    --bg-card-hover: rgba(30, 41, 67, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-danger: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.15);
    --glass-backdrop: blur(16px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
    padding: 2rem 1rem;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.app-header {
    margin-bottom: 2rem;
    text-align: center;
}

.logo-area {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 600px;
}

/* Search Card */
.search-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1.25rem;
    color: #ff0000;
    font-size: 1.25rem;
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.options-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

.toggle-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.toggle-checkbox input {
    accent-color: var(--accent-primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: #fff;
}

.btn-success:hover {
    opacity: 0.9;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.status-bar.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.status-icon {
    font-size: 1.25rem;
    color: var(--accent-primary);
}

/* Results Header */
.results-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

#count-badge {
    background: var(--accent-primary);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-filter {
    position: relative;
    display: flex;
    align-items: center;
}

.search-filter i {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
}

.search-filter input {
    padding: 0.6rem 0.85rem 0.6rem 2.2rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Video Card */
.video-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.video-card.selected {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.video-card.dimmed {
    opacity: 0.4;
}

.card-checkbox {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 2;
    width: 22px;
    height: 22px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.video-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .thumbnail-wrapper img {
    transform: scale(1.05);
}

.duration-badge {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    gap: 1rem;
}

.video-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.btn-card-transcribe {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.hidden, .hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    z-index: 10;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.4);
}

.modal-title-area h3 {
    font-size: 1.2rem;
    margin: 0.4rem 0;
}

.badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.video-link {
    color: #ff4e4e;
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.4rem;
}

.modal-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    flex: 1;
}

.transcript-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-inside {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-inside i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-inside input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.2rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.transcript-container {
    background: #070a12;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    max-height: 450px;
}

.transcript-container pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e2e8f0;
}
