:root {
    --primary-color: #057551;
    /* Default Green for Banco Demo */
    --primary-dark-color: #035840;
    --bg-color: #f0f2f5;
    --text-color: #1c1e21;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Accesibilidad */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ... existing styles ... */

.logo-placeholder {
    /* Keeping this for fallback, but it represents the "loading" state now */
    background-color: #e9ecef;
    color: #495057;
    padding: 10px 20px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.9em;
    margin-bottom: 15px;
    border: 1px dashed #ced4da;
}

h1 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin-bottom: 10px;
}

h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
}

/* ... */

legend {
    padding: 0 10px;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1em;
}

/* ...inputs... */

.form-group input:focus,
.form-group select:focus,
.iti__tel-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(5, 117, 81, 0.2);
    /* We might need RGBA variable or calc color-mix if supported, for now keeping fixed shadow or using simple opacity */
    outline: none;
}

/* ... radio ... */

.radio-option input[type="radio"] {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
    accent-color: var(--primary-color);
    cursor: pointer;
    justify-self: center;
}

input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
}

/* ... buttons ... */

.submit-button,
button[type="button"] {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s ease-in-out;
    margin-top: 10px;
}

.submit-button:hover,
button[type="button"]:not(.disabled-look):not([disabled]):hover {
    background-color: var(--primary-dark-color);
}

/* ... signature area ... */

.signature-area {
    border: 1px dashed var(--primary-color);
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #fdfdfd;
    position: relative;
    height: 200px;
}

#summaryContent h3 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

/* ... icons ... */

.icon-success {
    color: var(--primary-color);
}

/* ... spinner ... */

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(5, 117, 81, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1em;
    animation: pulse 1.5s infinite ease-in-out;
}

body.modal-open {
    /* Para evitar scroll del body cuando la modal está abierta */
    overflow: hidden;
}

.container {
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
}

.logo-placeholder {
    background-color: #e9ecef;
    color: #495057;
    padding: 10px 20px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.9em;
    margin-bottom: 15px;
    border: 1px dashed #ced4da;
}

h1 {
    color: #057551;
    font-size: 1.8em;
    margin-bottom: 10px;
}

h2 {
    color: #057551;
    text-align: center;
    margin-bottom: 20px;
}

p {
    margin-bottom: 15px;
    color: #333;
}

fieldset {
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    margin-bottom: 25px;
    padding: 20px;
}

legend {
    padding: 0 10px;
    font-weight: bold;
    color: #057551;
    font-size: 1.1em;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="file"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.uppercase-input {
    text-transform: uppercase;
}

.iti--allow-dropdown,
.iti {
    width: 100% !important;
}

.iti__tel-input {
    width: 100% !important;
    box-sizing: border-box !important;
}


.form-group input:focus,
.form-group select:focus,
.iti__tel-input:focus {
    border-color: #057551;
    box-shadow: 0 0 0 2px rgba(5, 117, 81, 0.2);
    outline: none;
}


.radio-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    padding-top: 5px;
}

.radio-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
}

.radio-option {
    display: grid;
    grid-template-columns: 24px 1fr;
    /* Fixed width for radio, rest for label */
    align-items: center;
    gap: 8px;
    width: 100%;
}

.radio-option label {
    margin: 0 !important;
    padding: 0;
    cursor: pointer;
    font-weight: normal;
    display: block !important;
    /* Block is fine inside a grid cell */
    width: auto !important;
    line-height: 1.2;
    /* Better reading on mobile */
}

.radio-option input[type="radio"] {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
    accent-color: #057551;
    cursor: pointer;
    /* Center the radio in its 24px cell */
    justify-self: center;
}

.radio-group-horizontal label {
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
    accent-color: #057551;
    width: 16px;
    height: 16px;
}

label[for="infoCorrecta"],
label[for="finalConfirmation"],
label[for="noProporcionarSelfie"] {
    font-weight: normal;
    font-size: 0.9em;
    display: inline;
}


.submit-button,
button[type="button"] {
    display: inline-block;
    padding: 10px 20px;
    background-color: #057551;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.2s ease-in-out;
    margin-top: 10px;
}

button[type="submit"] {
    width: 100%;
    padding: 12px;
}


.submit-button:hover,
button[type="button"]:not(.disabled-look):not([disabled]):hover {
    background-color: #035840;
}

#clearSignatureBtn,
#modifySignatureBtn,
#editInformationBtn {
    background-color: #6c757d;
}

#clearSignatureBtn:hover,
#modifySignatureBtn:hover,
#editInformationBtn:hover {
    background-color: #5a6268;
}

.preview-container {
    margin-top: 10px;
    text-align: center;
}

.preview-container img,
.preview-container video {
    max-width: 200px;
    max-height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.preview-container .remove-preview-btn {
    background-color: #dc3545;
    color: white;
    font-size: 0.85em;
    padding: 5px 10px;
}

.preview-container .remove-preview-btn:hover {
    background-color: #c82333;
}

.selfie-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

#selfieCameraView video {
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
}

.capture-btn {
    background-color: #28a745;
}

.capture-btn:hover {
    background-color: #218838;
}

#noSelfieOptionContainer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

button.disabled-look {
    background-color: #adb5bd;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

button.disabled-look:hover {
    background-color: #adb5bd;
}

.signature-area {
    border: 1px dashed #057551;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #fdfdfd;
    position: relative;
    height: 200px;
}

#signaturePadCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#signatureBlocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 10;
}

.signature-buttons {
    text-align: center;
    margin-top: 10px;
}

.signature-buttons button {
    margin-left: 5px;
    margin-right: 5px;
}

#summaryContent {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    background-color: #f9f9f9;
}

#summaryContent h3 {
    color: #057551;
    margin-top: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

#summaryContent p {
    margin-bottom: 8px;
    font-size: 0.95em;
}

#summaryContent strong {
    color: #333;
}

#summaryContent img {
    max-width: 150px;
    max-height: 100px;
    border: 1px solid #ccc;
    margin-top: 5px;
    display: block;
}

.review-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

#editInformationBtn {
    background-color: #6c757d;
}

#editInformationBtn:hover {
    background-color: #5a6268;
}

small {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
}

.hidden {
    display: none !important;
}

.hidden-field {
    display: none;
}

/* Autocomplete Styles */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #dddfe2;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f0f2f5;
    color: var(--primary-color);
}

.mt-10 {
    margin-top: 10px;
}

.text-center {
    text-align: center;
}

.tenant-logo-img {
    max-height: 80px;
    margin-bottom: 15px;
}

.error-message {
    color: #ef4444;
    font-size: 0.8em;
    font-weight: 500;
    margin-top: 5px;
    display: none;
    animation: errorSlideDown 0.2s ease-out;
}

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

input.invalid,
select.invalid,
.iti--allow-dropdown.invalid .form-control {
    border-color: #ef4444 !important;
    background-color: rgba(254, 226, 226, 0.3) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Estilos para las Modales (Glassmorphism) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 35px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 1001;
    width: 90%;
    max-width: 420px;
    text-align: center;
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-content h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.modal-content p {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 24px;
    line-height: 1.55;
}

/* Modal Icons */
.modal-icon {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.6em;
    font-style: normal;
    margin-bottom: 20px;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.icon-success {
    background-color: rgba(5, 117, 81, 0.1);
    color: #057551;
    border: 1px solid rgba(5, 117, 81, 0.2);
}

.icon-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.icon-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

#successModal .success-logo {
    max-width: 180px;
    margin-bottom: 20px;
    display: block;
}

/* Loading Overlay & Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#loadingModalLogo {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 20px;
    display: block;
}

@media (max-width: 480px) {
    #loadingModalLogo {
        max-width: 100px;
        max-height: 50px;
    }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(5, 117, 81, 0.1);
    border-left-color: #057551;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.spinning {
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #057551;
    font-weight: 600;
    font-size: 1.1em;
    animation: pulse 1.5s infinite ease-in-out;
}

.loading-subtext {
    color: #6c757d;
    font-size: 0.9em;
    margin-top: 10px;
    text-align: center;
    max-width: 80%;
}

/* 4. Error View (Universal) */
.error-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f9fafb;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.error-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    text-align: center;
}

.error-icon {
    color: #e63946;
    font-size: 48px;
    margin-bottom: 16px;
}

.error-card h1 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 1.5em;
}

.error-card p {
    margin: 0 0 24px;
    color: #6b7280;
    line-height: 1.5;
}

.retry-link {
    color: #057551;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Mobile Fixes */
@media (max-width: 600px) {
    .container {
        padding: 20px 15px;
    }

    .signature-area {
        height: 180px;
        /* Slightly smaller on mobile */
    }

    h1 {
        font-size: 1.5em;
    }

    .modal {
        width: 85%;
        padding: 20px;
    }
}

/* Custom File Upload Styles */
.hidden-file-input {
    display: none;
}

.file-control-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.custom-file-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #fff;
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.custom-file-button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.custom-file-button:active {
    background-color: #e9ecef;
    transform: translateY(1px);
}

.file-name-text {
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
    word-break: break-all;
    min-height: 1.2em;
    margin-left: 2px;
}

.main-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* 4. Error View (Universal) */
.error-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f9fafb;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.error-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    text-align: center;
}

.error-icon {
    color: #e63946;
    font-size: 48px;
    margin-bottom: 16px;
}

.error-card h1 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 1.5em;
}

.error-card p {
    margin: 0 0 24px;
    color: #6b7280;
    line-height: 1.5;
}

.retry-link {
    color: #057551;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
}