/* --- 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);
}

h1.app-title {
    text-align: center;
    color: var(--primary);
    margin: 0 0 20px 0;
    font-size: 22px;
    letter-spacing: 1px;
}

.container {
    max-width: 1200px;
    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;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    min-width: 110px;
    padding: 12px 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    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);
}

.content {
    display: flex;
    padding: 25px;
    gap: 30px;
    min-height: 600px;
}

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

.controls {
    width: 340px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

label {
    display: block;
    font-weight: 700;
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 4px;
    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: vertical;
}

textarea.system-prompt {
    height: 130px;
    font-size: 12px;
    color: #444;
}

.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;
    white-space: nowrap;
}

.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;
}

.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);
    max-width: 100%;
}

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

.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);
}

.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);
}

.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;
}

#app-footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 12px;
    border-top: 1px solid #eee;
}

@media (max-width: 900px) {
    .content { flex-direction: column; align-items: center; }
    .controls { width: 100%; }
    .img-container-box { max-width: 100%; }
    .tab-btn { font-size: 11px; padding: 10px 4px; }
}

.validate-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    font-size: 12px;
}

.validate-btn:hover {
    background: var(--primary-dark);
}

.key-status {
    margin-top: 6px;
    font-size: 11px;
    color: #555;
    min-height: 14px;
}

.key-status--ok    { color: var(--success); font-weight: bold; }
.key-status--error { color: #dc3545;        font-weight: bold; }
