* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 30px;
}

.upload-area {
    margin-bottom: 30px;
}

#image-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px dashed #4facfe;
    border-radius: 12px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(79, 172, 254, 0.05);
}

.upload-label:hover {
    background: rgba(79, 172, 254, 0.1);
    border-color: #2c8ef7;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.preview-container {
    margin-bottom: 30px;
}

.preview-container h3 {
    margin-bottom: 15px;
    color: #444;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.preview-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.format-selection {
    margin-bottom: 30px;
}

.format-selection h3 {
    margin-bottom: 15px;
    color: #444;
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.format-option {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.format-option:hover {
    background: #e9ecef;
}

.format-option input {
    margin-right: 8px;
}

.format-option:has(input:checked) {
    background: #d1e7ff;
    border-color: #4facfe;
}

button {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.progress-container {
    margin-top: 30px;
    text-align: center;
}

.progress-bar {
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-label {
        padding: 25px 15px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Toast mejorado === */
#toast-container {
    position: fixed;
    bottom: 20px;   /* anclado abajo */
    right: 20px;
    display: flex;
    flex-direction: column-reverse; /* el último toast queda el más abajo */
    gap: 12px;
    z-index: 9999;
    pointer-events: none; /* evita bloquear clicks en la página, excepto en cada toast */
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 260px;
    max-width: 340px;
    padding: 14px 16px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    background: #333;
    gap: 12px;
    pointer-events: auto; /* el toast sí puede recibir clicks */
    opacity: 0;
    transform: translateY(-20px);
    animation: toast-slide-in 0.35s ease forwards;
}

.toast.success {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

.toast.error {
    background: linear-gradient(135deg, #e53935 0%, #ef5350 100%);
}

.toast span {
    flex: 1;                  /* el texto ocupa todo lo posible */
    line-height: 1.4;
    word-break: break-word;   /* permite saltos si es muy largo */
}

.toast button {
    flex-shrink: 0;           /* evita que la X cambie de tamaño */
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.toast button:hover {
    background-color: rgba(255,255,255,0.15);
    transform: scale(1.1);
}

@keyframes toast-slide-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-slide-out {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}



.header-content {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }
        .logo {
            height: 120px;
            width: auto;
            border-radius: 12px; /* Bordes redondeados similares a otros elementos */
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); /* Sombra suave para profundidad */
            transition: transform 0.3s ease, box-shadow 0.3s ease; /* Transición suave */
        }
       
        .titles {
            text-align: center;
        }
        @media (max-width: 768px) {
            .header-content {
                flex-direction: column;
                text-align: center;
            }
            .logo {
                height: 90px;
                border-radius: 10px; /* Bordes ligeramente menos redondeados en móviles */
            }
        }

