/* 
 * Form.io Overrides to match Tailwind Theme
 * Most layout styles are now handled by Tailwind classes in index.html
 */

/* Custom scrollbar for a cleaner look */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

@media (prefers-color-scheme: dark) {
    ::-webkit-scrollbar-thumb {
        background-color: #475569;
    }
}

/* Override Form.io Bootstrap styles to blend with our theme */
.formio-form {
    font-family: 'Inter', sans-serif;
}

/* Remove unwanted Bootstrap card styles injected by Form.io */
.formio-form .card,
.formio-form .card-body,
.formio-form .border {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.formio-form .card-body {
    padding: 0 !important;
}

.formio-form .card-header {
    display: none !important;
}

/* Spacing */
.form-group,
.formio-component {
    margin-bottom: 1.5rem;
    /* Increase spacing between elements */
}

/* Input fields */
.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    /* slate-800 */
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #cbd5e1;
    /* slate-300 */
    appearance: none;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (prefers-color-scheme: dark) {
    .form-control {
        background-color: #0f172a;
        /* slate-950 - más oscuro para mejor contraste */
        border-color: #334155;
        /* slate-700 - borde más sutil */
        color: #f1f5f9;
        /* slate-100 - texto más brillante */
    }
}

.form-control:focus {
    color: #1e293b;
    background-color: #fff;
    border-color: #8b5cf6;
    /* primary-500 */
    outline: 0;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

@media (prefers-color-scheme: dark) {
    .form-control:focus {
        color: #f1f5f9;
        background-color: #0f172a;
        border-color: #c4b5fd;
        /* primary-300 - más brillante */
        box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.3);
    }
}

/* Buttons */
.btn-primary {
    color: #fff;
    background-color: #7c3aed;
    /* primary-600 */
    border-color: #7c3aed;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #6d28d9;
    /* primary-700 */
    border-color: #6d28d9;
    transform: translateY(-1px);
}

.btn-primary:focus,
.btn-primary.focus {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.5);
}

/* Labels */
.col-form-label,
label,
.control-label,
.form-label {
    font-weight: 500;
    color: #475569;
    /* slate-600 */
    margin-bottom: 0.5rem;
}

@media (prefers-color-scheme: dark) {

    .col-form-label,
    label,
    .control-label,
    .form-label {
        color: #ffffff;
        font-weight: 500;
    }

    /* Labels de campos con error - máxima visibilidad */
    .has-error label,
    .has-danger label,
    .formio-component.has-error label,
    .formio-component.has-message label {
        color: #b00020 !important;
        font-weight: 600;
        text-shadow: 0 0 8px rgba(196, 181, 253, 0.3);
        /* Sutil resplandor púrpura */
    }
}


/* Checkboxes & Radios */
.form-check-input:checked {
    background-color: #7c3aed;
    border-color: #7c3aed;
}

/* Alerts/Errors */
.alert-danger {
    color: #991b1b;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

@media (prefers-color-scheme: dark) {
    .alert-danger {
        color: #b00020;
        /* Solicitado por usuario */
        background-color: #fecaca;
        /* Fondo claro para contraste con texto oscuro */
        border-color: #ff6b6b;
        box-shadow: 0 0 12px rgba(255, 107, 107, 0.2);
    }

    .formio-error-wrapper,
    .invalid-feedback,
    .help-block {
        color: #b00020 !important;
        font-weight: 500;
    }
}

/* Field validation errors */
.formio-error-wrapper {
    margin-top: 0.5rem;
}

.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: #ef4444;
    background-image: none;
}

.form-control.is-invalid:focus,
.was-validated .form-control:invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

@media (prefers-color-scheme: dark) {

    .form-control.is-invalid,
    .was-validated .form-control:invalid {
        border-color: #ff6b6b;
        /* Solicitado por usuario */
        box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.3);
        animation: subtle-pulse 2s ease-in-out infinite;
    }

    .form-control.is-invalid:focus,
    .was-validated .form-control:invalid:focus {
        border-color: #ff6b6b;
        box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.35);
    }
}

/* Animación sutil de pulso para campos con error */
@keyframes subtle-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.3);
    }

    50% {
        box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.4);
    }
}


/* DataGrid / Table Styles */

/* Eliminar borde del contenedor del DataGrid */
.formio-component-dataGrid,
.formio-component-editgrid,
.formio-component[class*="grid"] {
    border: none !important;
}

/* Eliminar bordes específicos de datagrid-table */
.formio-component-datagrid .datagrid-table,
.formio-component-datagrid .datagrid-table td,
.formio-component-datagrid .datagrid-table th {
    border: none !important;
}

.formio-form .table {
    width: 100%;
    color: #1e293b;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    /* Spacing between rows */
    border: none !important;
    overflow: visible;
}



.formio-form .table thead th {
    vertical-align: bottom;
    border: none;
    /* Sin bordes */
    background-color: transparent;
    color: #64748b;
    /* slate-500 */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem 1rem 1rem;
}

.formio-form .table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border: none;
    /* Sin bordes */
    background-color: #f8fafc;
    /* Fondo sutil */
}

/* Primera celda con borde redondeado izquierdo */
.formio-form .table tbody td:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

/* Última celda con borde redondeado derecho */
.formio-form .table tbody td:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Dark mode for tables */
@media (prefers-color-scheme: dark) {
    .formio-form .table {
        color: #f8fafc;
    }

    .formio-form .table thead th {
        color: #cbd5e1;
        /* slate-300 - más brillante */
    }

    .formio-form .table tbody td {
        background-color: #0f172a;
        /* slate-950 - coincide con inputs */
    }
}

/* Add Another Button */
.formio-button-add-row {
    background-color: transparent;
    color: #7c3aed;
    border: 1px dashed #7c3aed;
    margin-top: 0.5rem;
}

.formio-button-add-row:hover {
    background-color: #f5f3ff;
    color: #6d28d9;
    border-color: #6d28d9;
}

@media (prefers-color-scheme: dark) {
    .formio-button-add-row {
        color: #a78bfa;
        border-color: #a78bfa;
    }

    .formio-button-add-row:hover {
        background-color: #4c1d95;
    }
}

/* Remove Button */
.formio-button-remove-row {
    color: #ef4444;
    background: #fef2f2;
    border: none;
    padding: 0.75rem;
    /* Más grande */
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    /* Circular */
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.formio-button-remove-row:hover {
    background-color: #fee2e2;
    color: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.formio-button-remove-row:active {
    transform: scale(0.95);
}

/* Hacer el icono más grande */
.formio-button-remove-row i,
.formio-button-remove-row svg {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
}

@media (prefers-color-scheme: dark) {
    .formio-button-remove-row {
        color: #fca5a5;
        background-color: #450a0a;
    }

    .formio-button-remove-row:hover {
        background-color: #7f1d1d;
        color: #fecaca;
        box-shadow: 0 4px 6px rgba(248, 113, 113, 0.2);
    }
}

/* Choices.js (Tags Input) Overrides */
.choices__inner {
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    min-height: 44px;
    font-size: 0.95rem;
}

.choices__input {
    background-color: transparent;
    margin-bottom: 0;
}

.choices__list--multiple .choices__item {
    background-color: #7c3aed;
    border: 1px solid #6d28d9;
    border-radius: 0.25rem;
}

/* Native select styling */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

@media (prefers-color-scheme: dark) {
    .choices__inner {
        background-color: #0f172a;
        /* slate-950 */
        border-color: #334155;
        /* slate-700 */
        color: #f1f5f9;
    }

    .choices__input {
        color: #f1f5f9;
    }

    /* Native select in dark mode */
    select.form-control {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    }

    select.form-control option {
        background-color: #0f172a;
        color: #f1f5f9;
    }

    /* Choices.js dropdown - Use !important to override inline styles or library defaults */
    .choices__list.choices__list--dropdown,
    .choices__list--dropdown .choices__item,
    .choices[data-type*="select-one"] .choices__list--dropdown,
    .choices[data-type*="select-multiple"] .choices__list--dropdown {
        background-color: #0f172a !important;
        border-color: #334155 !important;
        color: #f1f5f9 !important;
    }

    /* Dropdown container itself */
    .choices__list[aria-expanded] {
        background-color: #0f172a !important;
        border: 1px solid #334155 !important;
    }

    /* Individual dropdown items */
    .choices__list--dropdown .choices__item,
    .choices__list[role="listbox"] .choices__item {
        background-color: #0f172a !important;
        color: #f1f5f9 !important;
    }

    /* Highlighted/hovered item */
    .choices__list--dropdown .choices__item--selectable.is-highlighted,
    .choices__list[role="listbox"] .choices__item--selectable.is-highlighted {
        background-color: #1e293b !important;
        /* slate-800 - más claro para hover */
        color: #ffffff !important;
    }

    /* Disabled items */
    .choices__list--dropdown .choices__item--disabled {
        background-color: #0f172a !important;
        color: #64748b !important;
        opacity: 0.5;
    }

    /* Placeholder text */
    .choices__placeholder {
        color: #64748b !important;
        opacity: 1;
    }

    /* Search input inside dropdown */
    .choices__list--dropdown .choices__input,
    .choices__input--cloned {
        background-color: #1e293b !important;
        color: #f1f5f9 !important;
        border: 1px solid #334155 !important;
        padding: 0.5rem 0.75rem !important;
    }

    .choices__list--dropdown .choices__input::placeholder,
    .choices__input--cloned::placeholder {
        color: #94a3b8 !important;
        opacity: 0.7;
    }
}

/* Submit Button Alignment */
.formio-component-submit {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* ====================================
   WIZARD STEPPER STYLES - Paginated Responsive Version
   ==================================== */

/* Hide Form.io's default wizard navigation elements (but keep the nav buttons visible) */
.formio-form .pagination.pagination-breadcrumb,
.formio-form nav .list-inline,
.formio-form .wizard-tablist,
.formio-form ul[role="tablist"] {
    display: none !important;
}

/* Stepper Container */
.stepper-container {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-radius: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

@media (prefers-color-scheme: dark) {
    .stepper-container {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
        border-color: rgba(139, 92, 246, 0.2);
    }
}

/* Progress Bar */
.stepper-progress-wrapper {
    animation: fadeIn 0.5s ease-in;
}

.stepper-progress-fill {
    position: relative;
    overflow: hidden;
}

.stepper-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Stepper Navigation - Add more top spacing */
nav[aria-label="Progress"] {
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    nav[aria-label="Progress"] {
        margin-top: 2rem;
    }
}

/* Steps Container - More gap between circles */
ol[role="list"] {
    gap: 0.75rem;
}

@media (min-width: 640px) {
    ol[role="list"] {
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    ol[role="list"] {
        gap: 1.25rem;
    }
}

/* Navigation Buttons */
.stepper-nav-btn {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: white;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
    transition: all 0.2s ease;
    font-weight: 500;
    cursor: pointer;
}

.stepper-nav-btn:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
    transform: translateX(0);
}

.stepper-nav-prev:hover {
    transform: translateX(-2px);
}

.stepper-nav-next:hover {
    transform: translateX(2px);
}

@media (prefers-color-scheme: dark) {
    .stepper-nav-btn {
        background: #1e293b;
        color: #a78bfa;
        border-color: #4c1d95;
    }

    .stepper-nav-btn:hover {
        background: #334155;
        border-color: #7c3aed;
    }
}

/* Step Items - Reduced sizes for better fit */
.step-item {
    min-width: 55px;
    max-width: 95px;
}

@media (min-width: 640px) {
    .step-item {
        min-width: 70px;
        max-width: 115px;
    }
}

@media (min-width: 1024px) {
    .step-item {
        min-width: 85px;
        max-width: 140px;
    }
}

/* Step Circle - Adjusted for smaller size, prevent cutoff */
.step-circle {
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    /* Prevent circle from shrinking */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-circle:hover {
    transform: scale(1.05) !important;
}

/* Active step pulse animation */
.step-circle.scale-110 {
    animation: step-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes step-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    }
}

/* Step completion animation */
@keyframes step-complete {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Checkmark appear animation */
@keyframes checkmark-appear {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Apply checkmark animation to SVG inside completed steps */
.step-circle.from-green-500 svg,
.step-circle.from-green-600 svg {
    animation: checkmark-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Step content transitions */
.step-content {
    transition: all 0.3s ease;
}

/* Step number fade transition */
.step-content span {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Step Labels - Multi-line support */
.step-label {
    line-height: 1.2;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
    /* Allow multi-line */
    min-height: 2em;
    /* Reserve space for 2 lines */
    transition: color 0.4s ease, font-weight 0.3s ease;
}

/* Smooth color transitions for step states */
.step-circle,
.step-circle>* {
    transition:
        background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scale animation when becoming active */
@keyframes step-activate {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1.1);
    }
}

/* Glow effect for active step */
@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4),
            0 0 20px rgba(139, 92, 246, 0.2);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(139, 92, 246, 0),
            0 0 30px rgba(139, 92, 246, 0.4);
    }
}

/* Smooth transitions */
.step-item,
.step-circle,
.step-label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation when step item appears */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple steps */
.step-item:nth-child(1) {
    animation-delay: 0.05s;
}

.step-item:nth-child(2) {
    animation-delay: 0.1s;
}

.step-item:nth-child(3) {
    animation-delay: 0.15s;
}

.step-item:nth-child(4) {
    animation-delay: 0.2s;
}

.step-item:nth-child(5) {
    animation-delay: 0.25s;
}

.step-item:nth-child(6) {
    animation-delay: 0.3s;
}

.step-item:nth-child(7) {
    animation-delay: 0.35s;
}

.step-item:nth-child(8) {
    animation-delay: 0.4s;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 639px) {
    .stepper-container {
        padding: 0.75rem;
    }

    .stepper-progress-wrapper {
        margin-bottom: 1rem;
    }

    .step-circle {
        width: 2rem !important;
        height: 2rem !important;
    }

    .step-label {
        font-size: 0.6rem;
        margin-top: 0.25rem;
        line-height: 1.1;
    }

    .stepper-nav-btn {
        padding: 0.375rem;
    }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .step-circle {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    }

    .stepper-progress-fill::after {
        background: linear-gradient(90deg,
                transparent,
                rgba(139, 92, 246, 0.4),
                transparent);
    }
}

/* ====================================
   WIZARD NAVIGATION BUTTONS - Enhanced Styling
   ==================================== */

/* Button Container - Better spacing and alignment */
.formio-form .wizard-page .formio-button-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
}

@media (prefers-color-scheme: dark) {
    .formio-form .wizard-page .formio-button-toolbar {
        border-top-color: #334155;
    }
}

/* Base button styles */
.formio-component-button .btn,
button[name="data[submit]"],
button.btn-wizard-nav-previous,
button.btn-wizard-nav-next,
button.btn-wizard-nav-cancel {
    min-width: 120px;
    font-weight: 600;
    letter-spacing: 0.025em;
    font-size: 0.875rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Next / Submit button - Primary purple gradient */
button.btn-wizard-nav-next,
button[name="data[submit]"] {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    border: 1px solid transparent;
}

button.btn-wizard-nav-next:hover,
button[name="data[submit]"]:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

button.btn-wizard-nav-next:active,
button[name="data[submit]"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3);
}

/* Previous button - Secondary style with border */
button.btn-wizard-nav-previous {
    background: white;
    color: #7c3aed;
    border: 1.5px solid #e9d5ff;
}

button.btn-wizard-nav-previous:hover {
    background: #f5f3ff;
    border-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

button.btn-wizard-nav-previous:active {
    transform: translateY(0);
    background: #ede9fe;
}

/* Cancel button - Subtle gray style */
button.btn-wizard-nav-cancel,
.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

button.btn-wizard-nav-cancel:hover,
.btn-secondary:hover {
    background: #e2e8f0;
    color: #475569;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Dark mode button styles */
@media (prefers-color-scheme: dark) {

    /* Next button in dark mode */
    button.btn-wizard-nav-next,
    button[name="data[submit]"] {
        background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    }

    button.btn-wizard-nav-next:hover,
    button[name="data[submit]"]:hover {
        background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
    }

    /* Previous button in dark mode */
    button.btn-wizard-nav-previous {
        background: #1e293b;
        color: #a78bfa;
        border-color: #4c1d95;
    }

    button.btn-wizard-nav-previous:hover {
        background: #334155;
        border-color: #7c3aed;
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }

    button.btn-wizard-nav-previous:active {
        background: #475569;
    }

    /* Cancel button in dark mode */
    button.btn-wizard-nav-cancel,
    .btn-secondary {
        background: #1e293b;
        color: #94a3b8;
        border-color: #334155;
    }

    button.btn-wizard-nav-cancel:hover,
    .btn-secondary:hover {
        background: #334155;
        color: #cbd5e1;
        border-color: #475569;
    }
}

/* Disabled state for buttons */
button.btn-wizard-nav-next:disabled,
button.btn-wizard-nav-previous:disabled,
button[name="data[submit]"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .formio-form .wizard-page .formio-button-toolbar {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .formio-component-button .btn,
    button.btn-wizard-nav-previous,
    button.btn-wizard-nav-next,
    button.btn-wizard-nav-cancel {
        width: 100%;
        min-width: auto;
    }
}

/* ====================================
   ERROR STATE ANIMATIONS
   ==================================== */

/* Fade in animation for error box */
@keyframes fadeInError {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slow bounce animation for error icon */
@keyframes bounceSlow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Apply animations via classes */
.animate-fade-in {
    animation: fadeInError 0.5s ease-out;
}

.animate-bounce-slow {
    animation: bounceSlow 2s ease-in-out infinite;
}

/* Error box hover effects */
#errorBox>div {
    will-change: transform;
}

/* ====================================
   SELECTBOXES MODERN STYLE - SUBTLE VERSION
   ==================================== */

/* Target the entire selectboxes component */
.selectboxes-modern,
.formio-component-selectboxes.selectboxes-modern {
    display: block !important;
}

/* Container for each checkbox option */
.selectboxes-modern .form-check,
.selectboxes-modern .checkbox,
.selectboxes-modern .form-radio {
    margin-bottom: 0.75rem !important;
    position: relative !important;
}

/* Hide the actual checkbox but keep it functional */
.selectboxes-modern input[type="checkbox"],
.selectboxes-modern .form-check-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

/* Style ONLY the option labels as subtle cards - not the main question label */
.selectboxes-modern .form-check label,
.selectboxes-modern .form-check .form-check-label,
.selectboxes-modern .checkbox label,
.selectboxes-modern .form-radio label {
    display: block !important;
    padding: 0.875rem 1.125rem !important;
    margin: 0 !important;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    font-weight: 400 !important;
    color: #475569 !important;
    position: relative !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    width: 100% !important;
}

/* Hover state - very subtle - only for option labels */
.selectboxes-modern .form-check label:hover,
.selectboxes-modern .form-check .form-check-label:hover,
.selectboxes-modern .checkbox label:hover,
.selectboxes-modern .form-radio label:hover {
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* CHECKED STATE - Subtle border accent instead of full background */
.selectboxes-modern input[type="checkbox"]:checked+label,
.selectboxes-modern input[type="checkbox"]:checked~label,
.selectboxes-modern .form-check:has(input:checked) label,
.selectboxes-modern .form-check-input:checked+.form-check-label,
.selectboxes-modern .form-check-input:checked~.form-check-label {
    background: #faf5ff !important;
    border: 1.5px solid #8b5cf6 !important;
    color: #6d28d9 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
    font-weight: 500 !important;
}

/* Small checkmark for checked state */
.selectboxes-modern input:checked+label::after,
.selectboxes-modern input:checked~label::after,
.selectboxes-modern .form-check:has(input:checked) label::after,
.selectboxes-modern .form-check-input:checked+.form-check-label::after,
.selectboxes-modern .form-check-input:checked~.form-check-label::after {
    content: '✓' !important;
    position: absolute !important;
    right: 0.875rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    color: #8b5cf6 !important;
    opacity: 0 !important;
    animation: checkmark-fade-in 0.2s ease forwards !important;
}

@keyframes checkmark-fade-in {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Subtle left accent bar for checked items */
.selectboxes-modern input:checked+label::before,
.selectboxes-modern input:checked~label::before,
.selectboxes-modern .form-check:has(input:checked) label::before,
.selectboxes-modern .form-check-input:checked+.form-check-label::before,
.selectboxes-modern .form-check-input:checked~.form-check-label::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 3px !important;
    background: #8b5cf6 !important;
    border-radius: 0.5rem 0 0 0.5rem !important;
    z-index: 1 !important;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {

    .selectboxes-modern .form-check label,
    .selectboxes-modern .form-check .form-check-label,
    .selectboxes-modern .checkbox label,
    .selectboxes-modern .form-radio label {
        background: #0f172a !important;
        border-color: #334155 !important;
        color: #cbd5e1 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    }

    .selectboxes-modern .form-check label:hover,
    .selectboxes-modern .form-check .form-check-label:hover,
    .selectboxes-modern .checkbox label:hover,
    .selectboxes-modern .form-radio label:hover {
        border-color: #475569 !important;
        background: #1e293b !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    }

    .selectboxes-modern input:checked+label,
    .selectboxes-modern input:checked~label,
    .selectboxes-modern .form-check:has(input:checked) label,
    .selectboxes-modern .form-check-input:checked+.form-check-label,
    .selectboxes-modern .form-check-input:checked~.form-check-label {
        background: #1e1b4b !important;
        border-color: #8b5cf6 !important;
        color: #c4b5fd !important;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15) !important;
    }

    .selectboxes-modern input:checked+label::after,
    .selectboxes-modern input:checked~label::after,
    .selectboxes-modern .form-check:has(input:checked) label::after,
    .selectboxes-modern .form-check-input:checked+.form-check-label::after,
    .selectboxes-modern .form-check-input:checked~.form-check-label::after {
        color: #a78bfa !important;
    }
}

/* Responsive */
@media (max-width: 640px) {

    .selectboxes-modern .form-check label,
    .selectboxes-modern .form-check .form-check-label,
    .selectboxes-modern .checkbox label,
    .selectboxes-modern .form-radio label {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.9rem !important;
    }
}

/* ====================================
   MODERN TOGGLE SWITCH STYLES - TAILWIND DESIGN
   ==================================== */

/* Target ALL checkboxes in the form */
input[type="checkbox"].form-check-input,
.form-check input[type="checkbox"] {
    /* Hide default checkbox */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Toggle switch size and style */
    width: 2.75rem;
    height: 1.5rem;
    border: 2px solid #d1d5db;
    border-radius: 9999px;
    background-color: #e5e7eb;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;

    /* Subtle shadow */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Toggle circle (handle) */
input[type="checkbox"].form-check-input::before,
.form-check input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.125rem;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    background-color: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Hover state */
input[type="checkbox"].form-check-input:hover,
.form-check input[type="checkbox"]:hover {
    border-color: #a78bfa;
    background-color: #ddd6fe;
}

/* Focus state */
input[type="checkbox"].form-check-input:focus,
.form-check input[type="checkbox"]:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Checked state - switch ON */
input[type="checkbox"].form-check-input:checked,
.form-check input[type="checkbox"]:checked {
    background-color: #8b5cf6;
    border-color: #8b5cf6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Move circle to the right when checked */
input[type="checkbox"].form-check-input:checked::before,
.form-check input[type="checkbox"]:checked::before {
    left: 1.375rem;
    background-color: #ffffff;
}

/* Checkbox labels - better spacing and alignment */
.form-check,
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 0;
}

.form-check-label,
.checkbox label {
    font-size: 1rem;
    line-height: 1.5;
    color: #374151;
    cursor: pointer;
    user-select: none;
    margin: 0;
    flex: 1;
    font-weight: 500;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {

    input[type="checkbox"].form-check-input,
    .form-check input[type="checkbox"] {
        border-color: #4b5563;
        background-color: #374151;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    input[type="checkbox"].form-check-input::before,
    .form-check input[type="checkbox"]::before {
        background-color: #e5e7eb;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    }

    input[type="checkbox"].form-check-input:hover,
    .form-check input[type="checkbox"]:hover {
        border-color: #8b5cf6;
        background-color: #4b5563;
    }

    input[type="checkbox"].form-check-input:checked,
    .form-check input[type="checkbox"]:checked {
        background-color: #8b5cf6;
        border-color: #8b5cf6;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(139, 92, 246, 0.2);
    }

    input[type="checkbox"].form-check-input:checked::before,
    .form-check input[type="checkbox"]:checked::before {
        background-color: #ffffff;
    }

    .form-check-label,
    .checkbox label {
        color: #d1d5db;
    }
}

/* Disabled state */
input[type="checkbox"].form-check-input:disabled,
.form-check input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"].form-check-input:disabled+label,
.form-check input[type="checkbox"]:disabled~label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Active/pressing state - slight scale */
input[type="checkbox"].form-check-input:active::before,
.form-check input[type="checkbox"]:active::before {
    width: 1.25rem;
}

/* Responsive - slightly smaller on mobile */
@media (max-width: 640px) {

    input[type="checkbox"].form-check-input,
    .form-check input[type="checkbox"] {
        width: 2.5rem;
        height: 1.375rem;
    }

    input[type="checkbox"].form-check-input::before,
    .form-check input[type="checkbox"]::before {
        width: 1rem;
        height: 1rem;
    }

    input[type="checkbox"].form-check-input:checked::before,
    .form-check input[type="checkbox"]:checked::before {
        left: 1.25rem;
    }

    .form-check-label,
    .checkbox label {
        font-size: 0.9375rem;
    }
}

/* ====================================
   ENHANCED INPUT FOCUS STATES
   ==================================== */

/* Enhanced input styles - no floating labels to avoid conflicts */
input.form-control,
textarea.form-control,
select.form-control {
    padding: 0.75rem 0.875rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

input.form-control:focus,
textarea.form-control:focus,
select.form-control:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    outline: none;
}

/* Better label spacing */
.formio-component label.control-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    display: block;
}

/* Dark mode for enhanced inputs */
@media (prefers-color-scheme: dark) {

    input.form-control,
    textarea.form-control,
    select.form-control {
        background-color: #1f2937;
        border-color: #374151;
        color: #e5e7eb;
    }

    input.form-control:focus,
    textarea.form-control:focus,
    select.form-control:focus {
        border-color: #8b5cf6;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    }

    .formio-component label.control-label {
        color: #d1d5db;
    }
}

/* ====================================
   ANIMATED PANEL HEADERS WITH ICONS
   ==================================== */

.wizard-panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.wizard-panel-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wizard-panel-header .panel-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.wizard-panel-header .panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

/* Different colors for each module */
.wizard-panel-header.module-citas {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: #c4b5fd;
}

.wizard-panel-header.module-ventas {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fcd34d;
}

.wizard-panel-header.module-soporte {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #93c5fd;
}

.wizard-panel-header.module-info {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #6ee7b7;
}

/* Dark mode for panel headers */
@media (prefers-color-scheme: dark) {
    .wizard-panel-header {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
    }

    .wizard-panel-header .panel-title {
        color: #e5e7eb;
    }

    .wizard-panel-header.module-citas {
        background: linear-gradient(135deg, #2d1b4b 0%, #1e1b4b 100%);
        border-color: #6d28d9;
    }

    .wizard-panel-header.module-ventas {
        background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
        border-color: #92400e;
    }

    .wizard-panel-header.module-soporte {
        background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
        border-color: #0369a1;
    }

    .wizard-panel-header.module-info {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        border-color: #047857;
    }
}

/* Hide Wizard Cancel Button */
.btn-wizard-nav-cancel {
    display: none !important;
}

/* ====================================
   SMOOTH FADE IN/OUT ANIMATIONS
   ==================================== */

/* Fade in animation for conditional fields */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply animation to conditional components */
[data-conditional="true"],
.formio-component[style*="display: block"] {
    animation: fadeInDown 0.3s ease;
}

/* Smooth transitions for showing/hiding */
.formio-component {
    transition: opacity 0.2s ease, max-height 0.3s ease, margin 0.2s ease;
}

.formio-component[style*="display: none"] {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
}

/* ====================================
   IMPROVED DATAGRID STYLES
   ==================================== */

.formio-component-datagrid table {
    border-radius: 0.5rem;
    /* overflow: hidden; Removed to fix dropdown clipping */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Allow dropdowns to overflow the table container */
.formio-component-datagrid .table-responsive {
    overflow: visible !important;
}

.formio-component-datagrid thead {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.formio-component-datagrid thead th {
    color: white !important;
    font-weight: 600;
    padding: 0.875rem;
    border: none;
}

.formio-component-datagrid tbody tr {
    transition: all 0.2s ease;
}

.formio-component-datagrid tbody tr:hover {
    background-color: #f9fafb;
    /* transform: scale(1.01); Removed to fix z-index/stacking context issues with dropdowns */
}

.formio-component-datagrid tbody td {
    padding: 0.75rem;
    border-color: #e5e7eb;
}

/* Dark mode for datagrids */
@media (prefers-color-scheme: dark) {
    .formio-component-datagrid tbody tr:hover {
        background-color: #1f2937;
    }

    .formio-component-datagrid tbody td {
        border-color: #374151;
    }
}

/* ====================================
   MODULE SEPARATORS
   ==================================== */

.module-separator {
    margin: 2rem 0;
    height: 1px;
    border: none;
    display: block;
    width: 100%;
    /* Subtle gradient line that fades out at edges */
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(209, 213, 219, 0.4) 20%,
            rgba(209, 213, 219, 0.4) 80%,
            transparent 100%);
}

/* Hide the old icon elements */
.module-separator::before {
    display: none;
}

.module-separator .separator-icon {
    display: none;
}

/* Dark mode for separators */
@media (prefers-color-scheme: dark) {
    .module-separator {
        background: linear-gradient(90deg,
                transparent 0%,
                rgba(75, 85, 99, 0.4) 20%,
                rgba(75, 85, 99, 0.4) 80%,
                transparent 100%);
    }
}