:root {
    --kbl-accent: #005a8e;
    --kbl-accent-dark: #004570;
    --kbl-overlay: rgba(0, 0, 0, 0.6);
    --kbl-radius: 8px;
    --kbl-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ---------------------------------------------------------------
   Overlay
--------------------------------------------------------------- */
#kbl-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: var(--kbl-overlay);
    align-items: center;
    justify-content: center;
}

#kbl-modal-overlay.kbl-open {
    display: flex;
}

/* ---------------------------------------------------------------
   Contenedor del modal
--------------------------------------------------------------- */
#kbl-modal {
    position: relative;
    background: #fff;
    border-radius: var(--kbl-radius);
    box-shadow: var(--kbl-shadow);
    padding: 36px 40px;
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    z-index: 99999;
    animation: kblFadeIn 0.2s ease;
}

@keyframes kblFadeIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------
   Cabecera del modal
--------------------------------------------------------------- */
#kbl-modal h2 {
    margin: 0 0 6px;
    font-size: 1.3em;
    color: #1d2327;
}

#kbl-modal .kbl-subtitle {
    margin: 0 0 24px;
    color: #50575e;
    font-size: 0.95em;
    line-height: 1.5;
}

/* ---------------------------------------------------------------
   Botón de cierre
--------------------------------------------------------------- */
#kbl-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    color: #50575e;
    padding: 4px;
    transition: color 0.15s;
}

#kbl-modal-close:hover {
    color: #b32d2e;
}

/* ---------------------------------------------------------------
   Formulario
--------------------------------------------------------------- */
#kbl-form .kbl-field {
    margin-bottom: 16px;
}

#kbl-form label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 5px;
    color: #1d2327;
}

#kbl-form input[type="text"],
#kbl-form input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.15s;
    outline: none;
}

#kbl-form input[type="text"]:focus,
#kbl-form input[type="email"]:focus {
    border-color: var(--kbl-accent);
    box-shadow: 0 0 0 2px rgba(0, 90, 142, 0.15);
}

/* ---------------------------------------------------------------
   Consentimiento RGPD
--------------------------------------------------------------- */
.kbl-consent-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

.kbl-consent-wrap input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--kbl-accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.kbl-consent-wrap label {
    font-size: 0.85em;
    color: #50575e;
    line-height: 1.5;
    cursor: pointer;
}

/* ---------------------------------------------------------------
   Botón de envío
--------------------------------------------------------------- */
#kbl-submit {
    width: 100%;
    padding: 13px;
    background: var(--kbl-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#kbl-submit:hover:not(:disabled) {
    background: var(--kbl-accent-dark);
}

#kbl-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------
   Spinner
--------------------------------------------------------------- */
.kbl-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kblSpin 0.7s linear infinite;
    flex-shrink: 0;
}

.kbl-loading .kbl-spinner {
    display: inline-block;
}

@keyframes kblSpin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------
   Mensaje de error
--------------------------------------------------------------- */
#kbl-error-msg {
    display: none;
    background: #fce8e8;
    border: 1px solid #f5c6c6;
    color: #b32d2e;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 0.9em;
    margin-bottom: 14px;
}

/* ---------------------------------------------------------------
   Responsive
--------------------------------------------------------------- */
@media (max-width: 520px) {
    #kbl-modal {
        padding: 24px 20px;
        margin: 16px;
        max-width: 100%;
    }

    #kbl-modal h2 {
        font-size: 1.1em;
        padding-right: 28px;
    }
}
