@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

.ymd-wrapper {
    /* === NEW COLOR PALETTE: "Aurora/Cyber" === */
    --primary-color: #08d9d6;      /* Bright Teal */
    --primary-dark: #00a8a5;       /* Darker Teal */
    --secondary-color: #8e44ad;    /* Rich Purple */
    --secondary-dark: #6a11cb;       /* Deeper Purple */
    --accent-color: #ff2e63;       /* Hot Pink/Magenta */
    --bg-primary: #111827;         /* Very Dark Blue */
    --bg-secondary: #1F2937;       /* Dark Blue-Gray */
    --bg-tertiary: #374151;         /* Medium Blue-Gray */
    --glass-bg: rgba(26, 34, 55, 0.4); /* Translucent dark blue */
    --glass-border: rgba(107, 114, 128, 0.3); /* Muted gray border */
    --text-primary: #f9fafb;       /* Off-white */
    --text-secondary: #9ca3af;     /* Light Gray */
    --text-muted: #6b7281;         /* Medium Gray */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.25);

    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #111827 0%, #1e3a8a 50%, #4c1d95 100%);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

.ymd-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(8, 217, 214, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(142, 68, 173, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 46, 99, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
    animation: subtleRotate 60s linear infinite;
}

.ymd-wrapper * {
    box-sizing: border-box;
}

.ymd-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.ymd-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    animation: fadeInDown 1s ease-out;
}

.ymd-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ymd-logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 900;
    box-shadow: var(--shadow-xl);
    animation: pulse 2s ease-in-out infinite;
}

.ymd-logo-text {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -1px;
}

.ymd-subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 25px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.ymd-features-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.ymd-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.ymd-feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: rgba(40, 50, 80, 0.6);
}

.ymd-feature-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: 700;
}

.ymd-input-section {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    padding: 35px;
    border-radius: 25px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 30px;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.ymd-input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
}

.ymd-url-input {
    flex: 1;
    padding: 18px 24px;
    border: 2px solid rgba(107, 114, 128, 0.5);
    border-radius: 15px;
    font-size: 16px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    outline: none;
    color: var(--bg-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.ymd-url-input:hover {
    white-space: normal;
    overflow: visible;
    word-break: break-all;
    z-index: 10;
    position: relative;
}

.ymd-url-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(8, 217, 214, 0.2);
    transform: translateY(-2px);
}

.ymd-url-input.error {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(255, 46, 99, 0.2);
}

.ymd-url-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.ymd-fetch-btn {
    padding: 18px 35px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.ymd-fetch-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.ymd-fetch-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ymd-loading {
    display: none;
    text-align: center;
    padding: 25px;
    color: var(--text-primary);
}

.ymd-audio-preview-section {
    display: none;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    padding: 35px;
    border-radius: 25px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 30px;
    animation: slideInLeft 0.8s ease-out;
}

.ymd-audio-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 25px;
    align-items: center;
    margin-bottom: 25px;
}

.ymd-thumbnail-preview {
    width: 120px;
    height: 90px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
    margin: auto;
}

.ymd-audio-details h2 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}

.ymd-audio-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    flex-wrap: wrap;
}

.ymd-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ymd-meta-icon {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
}

.ymd-download-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ymd-download-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-color), #c11b47);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ymd-download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ymd-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ymd-download-btn.downloading {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
}

.ymd-error-message {
    background: rgba(255, 46, 99, 0.1);
    border: 1px solid rgba(255, 46, 99, 0.3);
    color: var(--accent-color);
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 15px;
    display: none;
    font-weight: 600;
}

.ymd-download-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    min-width: 320px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: none;
    color: var(--text-primary);
}

.ymd-download-progress.show {
    display: block;
    animation: slideInRight 0.4s ease-out;
}

.ymd-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ymd-progress-text {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-secondary);
}

.ymd-cancel-btn {
    background: rgba(255, 46, 99, 0.2);
    border: 1px solid rgba(255, 46, 99, 0.3);
    color: var(--accent-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.ymd-cancel-btn:hover {
    background: rgba(255, 46, 99, 0.3);
}

.ymd-progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ymd-progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent-color), #c11b47);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.ymd-progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* YouTube Icon Animation */
.ymd-youtube-icon {
    width: 50px;
    height: 50px;
    background: #ff0000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 900;
    animation: youtubeFloat 3s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
    margin: 0 10px;
}

@keyframes youtubeFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

/* Digital Loading Interface */
.ymd-digital-interface {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    background: linear-gradient(135deg, rgba(8, 217, 214, 0.1), rgba(0, 168, 165, 0.1));
    border: 2px solid rgba(8, 217, 214, 0.3);
    border-radius: 15px;
    backdrop-filter: blur(20px);
}

.ymd-scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(8, 217, 214, 0.1) 2px,
            rgba(8, 217, 214, 0.1) 4px);
    animation: scanMove 2s linear infinite;
}

@keyframes scanMove {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.ymd-data-stream {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ymd-data-line {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 2px;
    animation: dataFlow 1.5s ease-in-out infinite;
}

.ymd-data-line:nth-child(2) { animation-delay: 0.3s; }
.ymd-data-line:nth-child(3) { animation-delay: 0.6s; }

@keyframes dataFlow {
    0%, 100% { opacity: 0.3; transform: scaleX(0.5); }
    50% { opacity: 1; transform: scaleX(1); }
}

.ymd-loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.ymd-loading-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.ymd-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.ymd-digital-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(8, 217, 214, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 217, 214, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridMove 4s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(20px, 20px); }
}

/* Streaming Section */
.ymd-streaming-section {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    padding: 35px;
    border-radius: 25px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 30px;
    animation: slideInLeft 0.8s ease-out;
}

.ymd-audio-visualizer-container {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.1), rgba(106, 17, 203, 0.1));
    border: 2px solid rgba(142, 68, 173, 0.3);
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(20px);
}

.ymd-audio-visualizer {
    background: rgba(142, 68, 173, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.ymd-visualizer-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 4px;
    height: 50px;
}

.ymd-bar {
    width: 4px;
    background: linear-gradient(to top, #00d2d3, #54a0ff, #8e44ad);
    border-radius: 2px;
    animation: visualizerWave 1.5s ease-in-out infinite;
}

.ymd-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.ymd-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.ymd-bar:nth-child(3) { height: 25px; animation-delay: 0.2s; }
.ymd-bar:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.ymd-bar:nth-child(5) { height: 30px; animation-delay: 0.4s; }
.ymd-bar:nth-child(6) { height: 45px; animation-delay: 0.5s; }
.ymd-bar:nth-child(7) { height: 35px; animation-delay: 0.6s; }
.ymd-bar:nth-child(8) { height: 25px; animation-delay: 0.7s; }
.ymd-bar:nth-child(9) { height: 40px; animation-delay: 0.8s; }
.ymd-bar:nth-child(10) { height: 30px; animation-delay: 0.9s; }
.ymd-bar:nth-child(11) { height: 35px; animation-delay: 1.0s; }
.ymd-bar:nth-child(12) { height: 20px; animation-delay: 1.1s; }

@keyframes visualizerWave {
    0%, 100% { transform: scaleY(0.3); opacity: 0.6; }
    50% { transform: scaleY(1); opacity: 1; }
}

.ymd-audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
}

.ymd-play-pause-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.ymd-play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.ymd-progress-container {
    flex: 1;
    cursor: pointer;
    padding: 10px 0;
}

.ymd-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.ymd-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
}

.ymd-time-display {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.ymd-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.ymd-volume-icon {
    color: white;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.ymd-volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.ymd-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
}

.ymd-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.ymd-audio-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.ymd-audio-loading.show {
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-out;
    min-height: 40px;
}

.ymd-loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes subtleRotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .ymd-container { padding: 15px; }
    .ymd-input-group { flex-direction: column; gap: 12px; }
    .ymd-fetch-btn { min-width: 100%; }
    .ymd-audio-info { grid-template-columns: 1fr; text-align: center; }
    .ymd-audio-meta { justify-content: center; }
    .ymd-download-progress { left: 15px; right: 15px; min-width: auto; }
    .ymd-features-bar { gap: 15px; }
    .ymd-feature-item { font-size: 13px; padding: 10px 16px; }
    .ymd-logo { flex-wrap: wrap; justify-content: center; }
    .ymd-youtube-icon { width: 40px; height: 40px; font-size: 16px; margin: 0 5px; }
    .ymd-audio-controls { flex-wrap: wrap; gap: 10px; }
    .ymd-progress-container { order: 3; width: 100%; }
}

@media (max-width: 480px) {
    .ymd-container { padding: 10px; }
    .ymd-input-section, .ymd-audio-preview-section { padding: 25px; }
    .ymd-logo { flex-direction: column; gap: 15px; }
    .ymd-features-bar { flex-direction: column; align-items: center; gap: 10px; }
    .ymd-feature-item { width: 100%; max-width: 280px; justify-content: center; }
}