/**
 * ajuste-reacciones.css
 *
 * Hoja de Estilos para el Ajustador de Reacciones Químicas.
 * Versión profesional y optimizada, coherente con el tema del laboratorio.
 */

/* --- 1. VARIABLES GLOBALES Y RESET --- */
:root {
    /* Paleta de colores (consistente con las otras apps) */
    --color-bg-start: #1b2735;
    --color-bg-end: #090a0f;
    --color-text-primary: #f0f2f5;
    --color-text-secondary: #a8b2c1;
    --color-border: rgba(255, 255, 255, 0.2);
    --color-surface: rgba(255, 255, 255, 0.05);
    --color-surface-interactive: #2c3e50;
    --color-accent: #3498db;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --color-shadow: rgba(0, 0, 0, 0.5);

    /* Tipografía y espaciado */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-family-monospace: 'Courier New', Courier, monospace;
    --radius-sm: 4px;
    --radius-md: 8px;
    --shadow-md: 0 4px 12px var(--color-shadow);
    --transition-speed: 0.25s;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
    color: var(--color-text-primary);
    min-height: 100vh;
    padding: 1rem;
    font-size: 16px;
}

/* --- 2. LAYOUT Y COMPONENTES PRINCIPALES --- */
.container {
    max-width: 800px;
    margin-inline: auto;
    padding: 1rem;
}

.main-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.main-header h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px var(--color-shadow);
    margin-bottom: 0.5rem;
}

.main-header .subtitle {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--color-text-secondary);
    max-width: 60ch;
    margin-inline: auto;
}

/* --- 3. SECCIÓN DE ENTRADA --- */
.input-section {
    margin-bottom: 2rem;
}

.equation-form label {
    display: block;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-field {
    font-family: inherit;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-interactive);
    color: var(--color-text-primary);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
    flex-grow: 1;
}

.input-field:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 8px var(--color-accent);
}

.button {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-accent);
    color: var(--color-text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}
.button:hover {
    background-color: #2980b9;
}

/* --- 4. SECCIÓN DE RESULTADOS --- */
.results-section {
    min-height: 100px; /* Evita saltos de layout */
}

.result-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden; /* Para que el header se vea bien */
}

.result-header {
    background-color: var(--color-surface-interactive);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.result-body {
    padding: 1.5rem;
}

.balanced-equation {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: bold;
    color: var(--color-success);
    text-align: center;
    word-break: break-all;
}

.details-toggle {
    text-align: center;
    margin-top: 1.5rem;
}

.button-link {
    font-family: inherit;
    background: none;
    border: none;
    color: var(--color-accent);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
}

.details-content {
    margin-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-item h4 {
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.monospace {
    font-family: var(--font-family-monospace);
    background-color: var(--color-bg-end);
    padding: 1rem;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-all;
}

/* --- 5. UTILIDADES (LOADER, ERRORES) --- */
.loader, .error-message {
    text-align: center;
    padding: 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.error-message {
    color: var(--color-danger);
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--color-danger);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

[hidden] {
    display: none !important;
}
