/* ============================================================
   FORMULARIO UNIFICADO COMERCIO / INSTITUCIÓN
   Basado en el estilo NARANJA original
   + Variante institucional (azul)
   + FIX: Estructura Header y Colores
   ============================================================ */

:root {
    --naranja: #ff7b00;
    --institucional: #0033A0;
    --gris: #f5f5f5;
    --borde: #dcdcdc;
    --texto: #333;
    --radius: 6px;
    --font: "Poppins", sans-serif;
}

body {
    font-family: var(--font);
    background: #f0f2f5; /* Un fondo gris suave para que resalte el container */
    margin: 0;
    padding: 0;
}

/* CONTENEDOR */
.container {
    width: 95%;
    max-width: 1100px;
    margin: 20px auto; /* Centrado con margen arriba */
    padding-bottom: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden; /* Para que el header respete el radio */
}

/* ============================================================
   HEADER - ARREGLO ESTRUCTURAL
   ============================================================ */
.header {
    display: flex;
    justify-content: space-between; /* Reparte espacio: Logo | Titulo | Botones */
    align-items: center;
    padding: 20px 30px;
    color: #fff;
    background: var(--naranja); /* FIX: Fondo naranja obligatorio */
    flex-wrap: wrap;
    gap: 15px;
}

/* Columna Izquierda (Logo) */
.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* Columna Centro (Título) */
.header-center {
    flex: 1 1 auto; /* Ocupa el centro */
    text-align: center;
    min-width: 200px;
}

.header-center h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.header-center .small {
    font-size: 13px;
    opacity: 0.9;
}

/* Columna Derecha (Botones) */
.header-right {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
}

/* PILLS / SWITCH */
.header-toggle {
    display: flex;
    gap: 10px;
}

.btn-pill {
    padding: 8px 20px;
    border-radius: 30px;
    border: 2px solid rgba(255,255,255,0.8);
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-pill.active {
    background: #fff;
    color: var(--naranja); /* Texto naranja cuando está activo */
    border-color: #fff;
    font-weight: 700;
}

.btn-pill:hover:not(.active) {
    background: rgba(255,255,255,0.2);
}

/* FORM GRID */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    padding: 30px; /* Espacio interno del formulario */
}

.col-12 { grid-column: span 12; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }
.col-2  { grid-column: span 2; }

/* Estilos para campos (Labels e Inputs) */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label {
    font-weight: 600;
    font-size: 13px;
    color: var(--texto);
}

.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--borde);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    box-sizing: border-box; /* Importante para que no se desborde */
}

.input:focus {
    outline: none;
    border-color: var(--naranja);
    box-shadow: 0 0 0 3px rgba(255, 123, 0, 0.1);
}

/* PREVIEW LOGO */
.img-preview {
    width: 100%;
    height: 120px;
    border: 1px dashed var(--borde);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    font-size: 14px;
    background: #fafafa;
    overflow: hidden; /* Para que la imagen no salga */
}

.img-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* BOTÓN GUARDAR */
.btn {
    background: var(--naranja);
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    font-family: var(--font);
    transition: background 0.3s;
}

.btn:hover {
    background: #cc6200;
}

/* ============================================================
   MODO INSTITUCIONAL (Azul)
   Se activa con clase 'mode-institucion' en el container
   ============================================================ */
.container.mode-institucion .header {
    background: var(--institucional);
}

.container.mode-institucion .btn-pill.active {
    color: var(--institucional); /* Texto azul cuando está activo */
}

.container.mode-institucion .input:focus {
    border-color: var(--institucional);
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.1);
}

.container.mode-institucion .btn {
    background: var(--institucional);
}

.container.mode-institucion .btn:hover {
    background: #002070;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    .header-left, .header-right, .header-center {
        width: 100%;
        justify-content: center;
    }
    .form-grid {
        padding: 15px;
        gap: 15px;
    }
    /* En móvil, que los campos ocupen todo el ancho si es necesario */
    .col-3, .col-4, .col-2 { grid-column: span 6; } 
    .col-12 { grid-column: span 12; }
}