:root {
    --bg: #0f172a;
    --card: #ffffff;
    --muted: #6b7280;
    --text: #0b1220;
    --primary: #6a11cb;
    --primary2: #2575fc;
    --ok: #16a34a;
    --warn: #f59e0b;
    --bad: #ef4444;
    --shadow: 0 14px 35px rgba(0,0,0,0.12);
    --radius: 20px;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Helvetica Neue", sans-serif;
    background: radial-gradient(1200px 900px at 15% 10%, rgba(106,17,203,0.24), transparent 60%),
                  radial-gradient(1200px 900px at 85% 10%, rgba(37,117,252,0.22), transparent 60%),
                  #f6f8ff;
    min-height: 100vh;
    color: var(--text);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: -20px;
}

.main-content { 
    padding: 30px; 
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-radius: 0 0 25px 25px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 1200px;
}

.header h1 {
    margin: 0;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header .tagline {
    margin: 10px 0 0;
    font-size: 1.2em;
    opacity: 0.9;
}

/* Sección de entrada */
.input-section {
    margin-bottom: 30px;
}

.input-box {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 5px 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.input-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(106, 17, 203, 0.15);
}

.input-icon {
    font-size: 24px;
    color: #ef4444;
    margin-right: 15px;
}

.input-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 18px 0;
    font-size: 16px;
    background: transparent;
    min-width: 0;
}

.input-box input::placeholder {
    color: #94a3b8;
}

.input-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    white-space: nowrap;
}

.input-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.3);
}

.input-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

/* Información del video */
.video-info-section {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.video-info-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-card {
    display: flex;
    gap: 20px;
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.video-thumbnail {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a202c, #111827);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.loading-thumbnail {
    color: rgba(255,255,255,0.5);
    font-size: 24px;
}

.video-details {
    flex: 1;
    min-width: 0;
}

.video-details h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    word-break: break-word;
}

.video-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-id {
    font-family: monospace;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    font-size: 13px;
    color: #475569;
}

/* Formatos de audio */
.formats-section {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.formats-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.formats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.format-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.format-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: #cbd5e1;
}

.format-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(106,17,203,0.05), rgba(37,117,252,0.03));
    box-shadow: 0 8px 25px rgba(106,17,203,0.15);
}

.format-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.format-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.format-name {
    font-weight: bold;
    font-size: 16px;
    color: var(--text);
}

.format-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 13px;
}

.format-detail {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
}

.format-detail i {
    color: var(--primary);
    width: 16px;
}

.format-size {
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
    color: var(--ok);
    background: rgba(22,163,74,0.1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.format-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

/* Calidad de salida */
.quality-section {
    margin-bottom: 30px;
}

.quality-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quality-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.quality-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.quality-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.quality-card.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(106,17,203,0.05), rgba(37,117,252,0.03));
    box-shadow: 0 8px 25px rgba(106,17,203,0.15);
}

.quality-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 22px;
}

.quality-card h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.quality-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
    min-height: 36px;
}

.quality-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    background: rgba(22,163,74,0.1);
    color: var(--ok);
}

.quality-card.active .quality-badge {
    background: var(--primary);
    color: white;
}

/* Botón de descarga */
.download-section {
    text-align: center;
    margin-bottom: 40px;
}

.download-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    min-width: 300px;
    justify-content: center;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(106, 17, 203, 0.4);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #cbd5e1;
}

.download-info {
    margin-top: 15px;
    color: var(--muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Descargas activas */
.active-downloads-section {
    margin-bottom: 30px;
}

.active-downloads-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.downloads-list {
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    min-height: 100px;
}

.empty-downloads {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 30px;
}

.empty-downloads i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    animation: slideIn 0.3s ease;
}

.download-item:last-child {
    margin-bottom: 0;
}

.download-item-info {
    flex: 1;
    min-width: 0;
}

.download-item-title {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-item-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--muted);
}

.download-item-progress {
    width: 150px;
    flex-shrink: 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary2));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--text);
}

.download-item-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.download-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.download-action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* Historial */
.history-section {
    margin-bottom: 30px;
}

.history-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    min-height: 100px;
}

.empty-history {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 30px;
}

.empty-history i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-weight: bold;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--muted);
}

.history-item-format {
    background: rgba(106,17,203,0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 11px;
}

.history-item-size {
    color: var(--ok);
    font-weight: bold;
}

.history-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.clear-history-btn {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.clear-history-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: translateY(-2px);
}

/* Estado del sistema */
.tools-section {
    margin-bottom: 30px;
}

.tools-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.tool-status {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-status i {
    font-size: 20px;
    color: var(--ok);
}

.tool-status.error i {
    color: var(--bad);
}

.tool-status.warning i {
    color: var(--warn);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.download-progress {
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary2));
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--muted);
}

#progressText {
    font-weight: bold;
    color: var(--primary);
    font-size: 16px;
}

.download-details p {
    margin: 8px 0;
    font-size: 14px;
}

.download-details strong {
    color: var(--text);
    min-width: 70px;
    display: inline-block;
}

.modal-footer {
    padding: 20px;
    background: #f8fafc;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.modal-btn.primary {
    background: var(--primary);
    color: white;
}

.modal-btn.secondary {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid #cbd5e1;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #111827;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(0,0,0,0.35);
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: min(420px, calc(100vw - 40px));
}

.toast.visible {
    display: flex;
    animation: slideIn 0.3s ease;
}

.toast.ok {
    background: var(--ok);
}

.toast.error {
    background: var(--bad);
}

.toast.warn {
    background: var(--warn);
    color: #111827;
}

/* Footer */
footer {
    margin-top: 30px;
    color: white;
    text-align: center;
    opacity: 0.85;
    font-size: 14px;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin-top: -25px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 26px;
    }
    
    .header .tagline {
        font-size: 1em;
    }
    
    .input-box {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    
    .input-box input {
        width: 100%;
        padding: 15px;
        text-align: center;
    }
    
    .video-card {
        flex-direction: column;
        text-align: center;
    }
    
    .video-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .video-meta {
        justify-content: center;
    }
    
    .formats-container {
        grid-template-columns: 1fr;
    }
    
    .quality-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .download-btn {
        min-width: 100%;
        padding: 15px 20px;
    }
    
    .tools-status {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .quality-cards {
        grid-template-columns: 1fr;
    }
    
    .download-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .download-item-progress {
        width: 100%;
    }
    
    .history-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}


/* En ytmp3.css añade: */
.download-success {
    text-align: center;
    margin-bottom: 20px;
}

.success-icon {
    font-size: 60px;
    color: var(--ok);
    margin-bottom: 15px;
}

.success-message {
    font-size: 18px;
    font-weight: bold;
    color: var(--ok);
}

/* Estilos para el modal de éxito */
.success-indicator {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(22, 163, 74, 0.1);
    border-radius: 12px;
}

.success-icon {
    font-size: 60px;
    color: #16a34a;
    margin-bottom: 15px;
}

.success-title {
    font-size: 18px;
    font-weight: bold;
    color: #16a34a;
    margin: 0;
}

.progress-container {
    background: #f8fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.progress-label {
    font-weight: 600;
    color: #475569;
    min-width: 80px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6a11cb, #2575fc);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-percent {
    font-weight: bold;
    color: #6a11cb;
    min-width: 50px;
    text-align: right;
}

.file-size {
    display: flex;
    align-items: center;
    gap: 15px;
}

.size-label {
    font-weight: 600;
    color: #475569;
    min-width: 80px;
}

.size-value {
    font-weight: bold;
    color: #059669;
}

.file-details {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
}

.detail-row {
    display: flex;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.detail-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #475569;
    min-width: 80px;
}

.detail-value {
    color: #1e293b;
    word-break: break-all;
}

.status-complete {
    color: #16a34a;
    font-weight: bold;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-size: 16px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
}

.modal-btn.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#viewDownloadBtn {
    min-width: 180px;
    justify-content: center;
}