/* Variables de tema claro y oscuro */
:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: white;
    --border-color: #4CAF50;
    --dropzone-bg: white;
    --dropzone-border: #4CAF50;
    --status-info-bg: #e3f2fd;
    --status-info-color: #0d47a1;
    --status-success-bg: #e8f5e8;
    --status-success-color: #1b5e20;
    --status-error-bg: #ffebee;
    --status-error-color: #b71c1c;
    --status-warning-bg: #fff3e0;
    --status-warning-color: #e65100;
    --button-bg: #4CAF50;
    --button-color: white;
    --button-disabled-bg: #ccc;
    --footer-bg: #ddd;
    --toggle-bg: #4CAF50;
    --toggle-text: white;
    --toggle-border: #2e7d32;
    --contador-verde: #4CAF50;
    --contador-amarillo: #ffc107;
    --contador-rojo: #f44336;
    --contador-bg: rgba(0,0,0,0.1);
    --progress-bg: #e0e0e0;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2d2d2d;
    --border-color: #66bb6a;
    --dropzone-bg: #2d2d2d;
    --dropzone-border: #66bb6a;
    --status-info-bg: #0d47a1;
    --status-info-color: #e3f2fd;
    --status-success-bg: #1b5e20;
    --status-success-color: #e8f5e8;
    --status-error-bg: #b71c1c;
    --status-error-color: #ffebee;
    --status-warning-bg: #e65100;
    --status-warning-color: #fff3e0;
    --button-bg: #66bb6a;
    --button-color: #1a1a1a;
    --button-disabled-bg: #555;
    --footer-bg: #2d2d2d;
    --toggle-bg: #66bb6a;
    --toggle-text: #1a1a1a;
    --toggle-border: #2e7d32;
    --contador-verde: #66bb6a;
    --contador-amarillo: #ffb74d;
    --contador-rojo: #ff8a80;
    --contador-bg: rgba(255,255,255,0.1);
    --progress-bg: #444;
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    color: inherit;
    font-size: 2em;
    margin: 40px 0 10px 0;
}

.drop-zone {
    width: 100%;
    border: 3px dashed var(--dropzone-border);
    border-radius: 20px;
    padding: 30px;
    background: var(--dropzone-bg);
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
    margin: 15px 0;
}

.drop-zone.dragover {
    background: var(--status-info-bg);
    border-color: var(--status-info-color);
}

.controls {
    margin: 15px 0;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.preview-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 15px 0;
    flex: 1;
}

.preview-box {
    flex: 1;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.preview-box p {
    margin: 0 0 10px 0;
    font-weight: bold;
}

.preview-box img {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    object-position: center;
    border-radius: 5px;
}

.placeholder {
    color: #999;
    padding: 40px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Barra de progreso pequeña */
.result-progress-container {
    width: 100%;
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.result-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--button-bg);
    border-radius: 3px;
    transition: width 0.2s ease, background-color 0.3s ease;
}

/* Estado completado (verde) */
.result-progress-bar.completado {
    background-color: #4CAF50;
    width: 100% !important;
}

/* Animación de pulso mientras procesa */
@keyframes progreso-pulso {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.result-progress-bar:not(.completado) {
    animation: progreso-pulso 1s infinite;
}

button {
    padding: 10px 20px;
    background: var(--button-bg);
    color: var(--button-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

button:disabled {
    background: var(--button-disabled-bg);
    cursor: not-allowed;
}

select, input[type="file"] {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
}

#status {
    max-width: 500px;
    margin: 10px auto;
    padding: 10px;
    font-weight: bold;
    border-radius: 5px;
}

#status:not(.error) {
    display: none;
}

.info { background: var(--status-info-bg); color: var(--status-info-color); }
.success { background: var(--status-success-bg); color: var(--status-success-color); }
.error { background: var(--status-error-bg); color: var(--status-error-color); display: block !important; }

.hidden { display: none; }

footer {
    margin-top: 20px;
    padding: 15px;
    background: var(--footer-bg);
    border-radius: 10px;
    font-size: 0.9em;
}

/* Botón de modo oscuro - pequeño y en la esquina */
#darkModeToggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--toggle-bg);
    color: var(--toggle-text);
    border: 2px solid var(--toggle-border);
    border-radius: 30px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Contador visual */
.contador-container {
    max-width: 400px;
    margin: 10px auto;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.contador-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: bold;
}

.contador-barra {
    width: 100%;
    height: 20px;
    background: var(--contador-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.contador-progreso {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.contador-progreso.verde { background-color: var(--contador-verde); }
.contador-progreso.amarillo { background-color: var(--contador-amarillo); }
.contador-progreso.rojo { background-color: var(--contador-rojo); }

.contador-mensaje {
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
}

.contador-mensaje.bloqueado { 
    color: var(--contador-rojo);
}

/* Media queries para móvil */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-top: 50px;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls select, .controls button {
        width: 100%;
    }
    
    .preview-container {
        flex-direction: column;
        align-items: center;
    }
    
    .preview-box {
        width: 100%;
        max-width: 100%;
    }
    
    #darkModeToggle {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
}