/* --- VARIABLES Y CONFIGURACIÓN BASE --- */
:root {
    --primary: #0082ff;
    --primary-dark: #0056b3;
    --accent: #7f00ff;
    --accent-dark: #6600cc;
    --bg-light: #eff2f5;
    --text-dark: #2c3e50;
    --white: #ffffff;
    --border-color: #ddd;
    --success: #28a745;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    margin: 0;
    padding: 20px;
    color: var(--text-dark);
}

/* --- CONTENEDOR PRINCIPAL --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- SELECTOR DE IDIOMA --- */
.language-selector {
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 100;
}

.language-selector select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
}

/* --- CABECERA DE PESTAÑAS (TABS) --- */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 14px 10px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #888;
    transition: 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(0, 130, 255, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    background: white;
    border-bottom: 3px solid var(--primary);
}

/* --- ESTRUCTURA DE CONTENIDO --- */
.content {
    display: flex;
    padding: 25px;
    gap: 30px;
    min-height: 600px;
}

.content.hidden {
    display: none !important;
}

/* --- COLUMNA IZQUIERDA: CONTROLES --- */
.controls {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label {
    display: block;
    font-weight: 700;
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
}

textarea {
    height: 70px;
    resize: none;
}

/* --- API KEY Y UPLOAD --- */
.api-key-container {
    background: #f0f7ff;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #cce5ff;
}

.api-row {
    display: flex;
    gap: 8px;
}

.key-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.lang-btn {
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
}

.drop-zone {
    border: 2px dashed var(--primary);
    padding: 15px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    transition: 0.3s;
}

.drop-zone:hover {
    background: #f0f7ff;
}

/* BARRA DE ESTADO DE CARGA */
.upload-status-bar {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #eee;
    min-height: 32px;
    box-sizing: border-box;
}

.mini-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
}

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

/* --- COLUMNA DERECHA: PREVISUALIZACIÓN --- */
.preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fdfdfd;
    border-radius: 15px;
    padding: 20px;
    position: relative;
    border: 1px solid #f0f0f0;
}

.preview-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #99aab5;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* EL RECUADRO DINÁMICO */
.img-container-box {
    border: 5px solid var(--primary);
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); /* Animación suave */
    max-width: 100%;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* --- BOTONES DE ACCIÓN --- */
.action-btn {
    background: var(--primary);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 10px rgba(0,130,255,0.2);
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* BOTÓN DE DESCARGA ELEGANTE */
.elegant-btn {
    background: linear-gradient(135deg, var(--accent), #e100ff);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(127,0,255,0.3);
}

.elegant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127,0,255,0.4);
    filter: brightness(1.1);
}

/* --- ESTADOS DE CARGA (LOADING) --- */
.loading-text {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    border-radius: 30px;
    font-weight: bold;
    color: var(--primary);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--primary);
    white-space: nowrap;
}

/* --- FOOTER --- */
#app-footer {
    text-align: center;
    padding: 25px;
    color: #888;
    font-size: 12px;
    border-top: 1px solid #eee;
    line-height: 1.5;
}

/* --- SELECTORES PRESETS (ESTILOS RÁPIDOS) --- */
.preset-container {
    margin-top: 5px;
    margin-bottom: 10px;
}

.preset-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    flex: 1;
    min-width: 40px;
    height: 40px;
    font-size: 20px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.preset-btn:hover {
    border-color: var(--primary);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,130,255,0.15);
}

/* --- RESPONSIVIDAD BÁSICA --- */
@media (max-width: 900px) {
    .content {
        flex-direction: column;
        align-items: center;
    }
    .controls {
        width: 100%;
    }
    .img-container-box {
        max-width: 100%;
    }
}