* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #e2e8f0;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.3rem;
    color: #94a3b8;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.search-section {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-section.compact {
    padding: 16px 24px;
    margin-bottom: 24px;
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.6), transparent);
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-section.compact .search-container {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.button-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

#searchInput {
    width: 100%;
    padding: 16px 48px 16px 16px;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    resize: none;
    min-height: 80px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    line-height: 1.5;
}

.search-section.compact #searchInput {
    min-height: 44px;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
}

#searchInput::placeholder {
    color: #64748b;
}

#searchInput:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.input-wrapper:hover .clear-btn,
#searchInput:not(:placeholder-shown) ~ .clear-btn {
    opacity: 1;
    pointer-events: all;
}

.clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.extract-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
}

.search-section.compact .extract-btn {
    padding: 10px 20px;
    font-size: 13px;
    min-width: 120px;
}

.extract-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.extract-btn:active {
    transform: translateY(0);
}

.extract-btn.loading .btn-text {
    opacity: 0;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
}

.extract-btn.loading .loading-spinner {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.results-section {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    display: none;
    position: relative;
    overflow: hidden;
}

.results-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.results-section.show {
    display: block;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-count {
    text-align: center;
    font-size: 1.3rem;
    color: #3b82f6;
    font-weight: 600;
    margin-bottom: 40px;
    padding: 16px 24px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

.video-item {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    position: relative;
}

.video-item:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.video-item.loading {
    opacity: 0.8;
}

.video-item.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(127, 29, 29, 0.2);
}

.video-item.working {
    border-color: rgba(34, 197, 94, 0.3);
}

.video-player-container {
    position: relative;
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.plyr {
    width: 100% !important;
    height: 100% !important;
}

.plyr__video-wrapper {
    background: #000;
}

.plyr--video {
    border-radius: 12px 12px 0 0;
}

.plyr__controls {
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%);
    border-radius: 0;
}

.plyr__control--overlaid {
    background: rgba(59, 130, 246, 0.9);
    border-radius: 50%;
    backdrop-filter: blur(10px);
}

.plyr__control--overlaid:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.1);
}

.video-info {
    padding: 20px;
    background: rgba(15, 23, 42, 0.4);
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 8px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-url {
    font-size: 0.8rem;
    color: #64748b;
    word-break: break-all;
    background: rgba(15, 23, 42, 0.8);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    border: 1px solid rgba(148, 163, 184, 0.1);
    margin-bottom: 8px;
    max-height: 60px;
    overflow: hidden;
    position: relative;
}

.video-url::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(15, 23, 42, 0.8));
    pointer-events: none;
}

.video-status {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.loading {
    background: #f59e0b;
    animation: pulse 2s infinite;
}

.status-indicator.success {
    background: #22c55e;
}

.status-indicator.error {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    background: rgba(15, 23, 42, 0.8);
    color: #64748b;
}

.loading-spinner-large {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 0.9rem;
    color: #64748b;
}

.error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    background: rgba(127, 29, 29, 0.3);
    color: #fca5a5;
    text-align: center;
    padding: 20px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

.error-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ef4444;
}

.error-message {
    font-size: 0.9rem;
    color: #fca5a5;
    margin-bottom: 16px;
    opacity: 0.8;
}

.error-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.retry-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.retry-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.retry-btn:active {
    transform: translateY(0);
}

.retry-btn svg {
    animation: none;
}

.retry-btn:hover svg {
    animation: spin 0.5s ease-in-out;
}

.error-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 16px;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.error-link:hover {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.5);
    transform: translateY(-1px);
}

.no-videos {
    text-align: center;
    color: #94a3b8;
    font-size: 1.2rem;
    padding: 60px 40px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.error-message {
    background: rgba(127, 29, 29, 0.3);
    color: #fca5a5;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(10px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .search-section,
    .results-section {
        padding: 20px;
        border-radius: 16px;
    }
    
    .search-section.compact {
        padding: 16px 20px;
    }
    
    .search-section.compact .search-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .video-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .extract-btn {
        align-self: stretch;
        text-align: center;
    }
    
    #searchInput {
        min-height: 80px;
        padding: 16px 40px 16px 16px;
        font-size: 16px;
    }
    
    .search-section.compact #searchInput {
        min-height: 44px;
        padding: 12px 40px 12px 16px;
    }
    
    .video-info {
        padding: 16px;
    }
    
    .video-player-container {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .search-section,
    .results-section {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    .search-section.compact {
        padding: 12px 16px;
    }
    
    .video-player-container,
    .loading-placeholder,
    .error-placeholder {
        height: 200px;
    }
    
    .header {
        margin-bottom: 28px;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .video-gallery {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .video-item {
        border-radius: 12px;
    }
    
    .video-player-container {
        border-radius: 12px 12px 0 0;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.8);
}