/* 🎨 YouTube Downloader - Professional Design v3.0 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* خلفية متحركة مع تأثيرات */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: backgroundMove 15s ease-in-out infinite;
}

@keyframes backgroundMove {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* زر تبديل اللغة المحسّن */
.lang-switcher {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 10px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.lang-switcher:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    background: white;
}

.lang-switcher .flag {
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* البطاقة الرئيسية */
.main-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 50px 45px;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.5) inset;
    animation: slideUp 0.6s ease-out;
}

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

/* العنوان بتأثير Gradient */
h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 15px;
    font-size: 46px;
    font-weight: 800;
    letter-spacing: -1.5px;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 45px;
    font-size: 18px;
    font-weight: 500;
    padding-top: 20px;
}

/* حقول الإدخال */
.input-group {
    margin-bottom: 32px;
}

label {
    display: block;
    margin-bottom: 12px;
    color: #1f2937;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.3px;
}

input[type="text"] {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: ltr;
    text-align: left;
    background: #f9fafb;
    font-family: inherit;
}

input[type="text"]:hover {
    border-color: #d1d5db;
    background: #ffffff;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

/* زر اللصق */
#pasteBtn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

#pasteBtn:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#pasteBtn:active {
    transform: translateY(-50%) scale(0.95);
}

/* اختيار الجودة - تصميم جديد */
.quality-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.quality-option {
    position: relative;
}

.quality-option input[type="radio"] {
    display: none;
}

.quality-option label {
    display: block;
    padding: 22px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    background: #f9fafb;
    position: relative;
    overflow: hidden;
}

.quality-option label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.quality-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-5px) scale(1.03);
    box-shadow: 
        0 12px 28px rgba(102, 126, 234, 0.35),
        0 0 0 1px rgba(255,255,255,0.1) inset;
}

.quality-option label:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
    background: white;
}

.quality-option label:hover::before {
    opacity: 1;
}

/* زر MP3 - تصميم Spotify */
.quality-option:nth-child(5) label {
    background: linear-gradient(135deg, #1DB954 0%, #1ed760 100%);
    color: white;
    border-color: transparent;
    font-weight: 600;
}

.quality-option:nth-child(5) input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #169c46 0%, #1aa34a 100%);
    box-shadow: 
        0 12px 28px rgba(29, 185, 84, 0.45),
        0 0 0 1px rgba(255,255,255,0.2) inset;
}

.quality-option:nth-child(5) label:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 28px rgba(29, 185, 84, 0.35);
    background: linear-gradient(135deg, #1aa34a 0%, #1ed760 100%);
}

/* زر التحميل - تصميم متقدم */
.btn-download {
    width: 100%;
    padding: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-download::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-download:hover::before {
    width: 350px;
    height: 350px;
}

.btn-download:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.btn-download:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-download:disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* حالة التحميل */
.loading {
    display: none;
    text-align: center;
    margin-top: 35px;
}

.loading.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.spinner {
    border: 4px solid rgba(102, 126, 234, 0.15);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* نتيجة التحميل */
.result {
    display: none;
    margin-top: 35px;
    padding: 28px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 20px;
    border: 2px solid #bae6fd;
    animation: slideIn 0.4s ease-out;
}

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

.result.active {
    display: block;
}

.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
}

.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

/* قسم المميزات */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 22px;
    margin-top: 55px;
    padding-top: 45px;
    border-top: 2px solid #f3f4f6;
}

.feature {
    text-align: center;
    padding: 28px 22px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #f3f4f6;
    position: relative;
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.feature:hover::before {
    opacity: 1;
}

.feature:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.feature-icon {
    font-size: 52px;
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
    display: inline-block;
    transition: transform 0.3s;
}

.feature:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

.feature h3 {
    color: #1f2937;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
    position: relative;
}

.feature p {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 55px;
    padding-top: 35px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    font-weight: 500;
}

footer p {
    margin: 10px 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* تحسينات الموبايل */
@media (max-width: 768px) {
    h1 {
        font-size: 36px;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .main-card {
        padding: 35px 25px;
        border-radius: 25px;
    }
    
    .quality-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .lang-switcher {
        top: 12px;
        left: 12px;
        padding: 8px 14px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 28px;
    }
    
    .quality-selector {
        grid-template-columns: 1fr;
    }
    
    #pasteBtn {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 12px;
    }
    
    input[type="text"] {
        padding-left: 20px !important;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}

/* تأثيرات إضافية */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
