/* YouTube Downloader Styles */
.ytd-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
}

.ytd-header {
    margin-bottom: 20px;
}

.ytd-header h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

/* فرم جدید */
.ytd-form-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.ytd-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ytd-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ytd-label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.ytd-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.ytd-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    direction: ltr;
    transition: all 0.3s ease;
}

.ytd-input:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.ytd-form-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.ytd-checkbox-group {
    display: flex;
    align-items: center;
}

.ytd-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.ytd-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ff0000;
}

.ytd-checkbox-text {
    color: #555;
}

.ytd-quality-preference {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ytd-select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.ytd-select:focus {
    outline: none;
    border-color: #ff0000;
}

/* راهنمای استفاده */
.ytd-help {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.ytd-help h4 {
    color: #1976d2;
    margin-bottom: 10px;
    font-size: 16px;
}

.ytd-help ul {
    margin: 0;
    padding-right: 20px;
}

.ytd-help li {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

/* اطلاعات ویدیو */
.ytd-video-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ytd-video-info h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.ytd-video-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.ytd-video-details p {
    margin: 0;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 14px;
}

.ytd-video-details strong {
    color: #ff0000;
}

/* پیشرفت بار */
.ytd-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.ytd-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff6b6b);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.ytd-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    min-height: 44px;
}

.ytd-btn-icon {
    font-size: 16px;
}

.ytd-btn-text {
    flex: 1;
}

.ytd-btn-primary {
    background: #ff0000;
    color: white;
}

.ytd-btn-primary:hover {
    background: #cc0000;
    transform: translateY(-2px);
}

.ytd-btn-success {
    background: #28a745;
    color: white;
    margin: 5px;
}

.ytd-btn-success:hover {
    background: #218838;
}

.ytd-btn-info {
    background: #17a2b8;
    color: white;
    margin: 5px;
}

.ytd-btn-info:hover {
    background: #138496;
}

.ytd-btn-warning {
    background: #ffc107;
    color: #212529;
    margin: 5px;
}

.ytd-btn-warning:hover {
    background: #e0a800;
}

.ytd-loading {
    text-align: center;
    padding: 40px;
}

.ytd-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff0000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.ytd-results {
    margin-top: 20px;
}

.ytd-quality-section {
    margin-bottom: 30px;
}

.ytd-quality-section h4 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff0000;
}

.ytd-quality-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.ytd-quality-item:hover {
    background: #e9ecef;
    transform: translateX(-5px);
}

.ytd-quality-info {
    flex: 1;
}

.ytd-quality-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.ytd-quality-size {
    color: #666;
    font-size: 12px;
}

.ytd-quality-actions {
    display: flex;
    gap: 10px;
}

.ytd-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.ytd-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin: 20px 0;
}

.ytd-info {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #bee5eb;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ytd-container {
        margin: 10px;
        padding: 15px;
    }
    
    .ytd-url-input {
        flex-direction: column;
    }
    
    .ytd-quality-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ytd-quality-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .ytd-btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Animation for buttons */
.ytd-btn {
    position: relative;
    overflow: hidden;
}

.ytd-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ytd-btn:hover::before {
    left: 100%;
}

/* Loading animation for download buttons */
.ytd-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.ytd-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Progress Bar Styles */
.ytd-progress-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.ytd-progress-header h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
}

.ytd-progress-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.ytd-progress-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #6c757d;
}

.ytd-progress-item span:first-child {
    font-weight: bold;
}

.ytd-progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ytd-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.ytd-progress-text {
    text-align: center;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

.ytd-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.ytd-success p {
    margin: 0 0 10px 0;
    font-weight: bold;
}

.ytd-btn-success {
    background: #28a745 !important;
    color: white !important;
}

.ytd-btn-success:hover {
    background: #218838 !important;
}

.ytd-btn-secondary {
    background: #6c757d;
    color: white;
}

.ytd-btn-secondary:hover {
    background: #5a6268;
}