:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --background: #f9fafb;
    --foreground: #1f2937;
    --accent: #d1d5db;
    --white: #ffffff;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --container-bg: #ffffff;
    --file-count-color: #6b7280;
    --input-border: #d1d5db;
    --image-border: #ddd;
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --background: #121212;
    --foreground: #e0e0e0;
    --accent: #3f3f46;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --container-bg: #1e1e1e;
    --file-count-color: #a1a1aa;
    --input-border: #4b5563;
    --image-border: #4b5563;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    background-color: var(--container-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 700px;
    position: relative;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
    transition: color 0.3s ease;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#image-input {
    padding: 0.5rem;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    background-color: var(--container-bg);
    color: var(--foreground);
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

#file-count {
    font-size: 0.875rem;
    color: var(--file-count-color);
    transition: color 0.3s ease;
}

#preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#preview img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

button[type="submit"] {
    padding: 0.75rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

button[type="submit"]:hover {
    background-color: var(--primary-hover);
}

#converted-images {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-container {
    display: inline-block;
    position: relative;
    margin: 10px;
}

.preview-image {
    max-width: 100px;
    height: auto;
    border: 1px solid var(--image-border);
    border-radius: 5px;
    transition: border-color 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 0px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    width: 20px;
    height: 20px;
    text-align: center;
}

.close-btn:hover {
    background-color: red;
}

.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Estilos para el mensaje de éxito */
.success-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #10b981;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: none;
    animation: fadeInOut 3s ease;
}

/* Animación para el mensaje de éxito */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    85% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Estilos para el selector de tema */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

#theme-toggle-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

#theme-toggle-btn:hover {
    background-color: var(--accent);
}

.theme-icon {
    display: block;
}

body:not([data-theme="dark"]) .dark-icon {
    display: none;
}

[data-theme="dark"] .light-icon {
    display: none;
}

[data-theme="dark"] .success-message {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}