@import url("https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css");
@import "select2.tailwind.css";
@import "modal.css";
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
    .app-auth-body {
        @apply min-h-screen bg-stone-100 text-gray-900 dark:bg-[#080705] dark:text-[#cfcac0];
    }

    .nav-link {
        @apply relative text-gray-700 dark:text-gray-300 hover:text-black dark:hover:text-white font-medium text-sm transition-colors duration-200;
    }

    .nav-link-underline {
        @apply absolute -bottom-0.5 left-0 w-0 h-0.5 bg-black dark:bg-gray-300 transition-all duration-300 group-hover:w-full;
    }

    .btn-primary {
        @apply inline-flex items-center px-5 py-2.5 bg-black dark:bg-gray-300 text-gray-300 dark:text-black text-sm font-semibold rounded-lg hover:bg-gray-800 dark:hover:bg-gray-100 transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer;
    }

    .btn-secondary {
        @apply inline-flex items-center px-5 py-2.5 border-2 border-gray-900 dark:border-gray-300 text-gray-900 dark:text-white text-sm font-semibold rounded-lg hover:bg-gray-50 dark:hover:bg-gray-950 transition-all duration-200 cursor-pointer;
    }

    .theme-toggle {
        @apply p-2.5 rounded-lg bg-gray-100 dark:bg-gray-900 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors duration-200;
    }

    .theme-icon {
        @apply w-5 h-5 text-gray-700 dark:text-gray-300;
    }

    .mobile-menu-btn {
        @apply p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-900 transition-colors duration-200;
    }

    .hamburger-box {
        @apply w-6 h-5 relative block;
    }

    .hamburger-line {
        @apply absolute left-0 w-full h-0.5 bg-gray-900 dark:bg-white rounded-full transition-all duration-300;
    }

    .hamburger-line:nth-child(1) {
        @apply top-0;
    }

    .hamburger-line:nth-child(2) {
        @apply top-1/2 -translate-y-1/2;
    }

    .hamburger-line:nth-child(3) {
        @apply bottom-0;
    }

    .mobile-menu-btn.active .hamburger-line:nth-child(1) {
        @apply top-1/2 -translate-y-1/2 rotate-45;
    }

    .mobile-menu-btn.active .hamburger-line:nth-child(2) {
        @apply opacity-0;
    }

    .mobile-menu-btn.active .hamburger-line:nth-child(3) {
        @apply top-1/2 -translate-y-1/2 -rotate-45;
        bottom: auto;
    }

    .mobile-link {
        @apply flex items-center px-4 py-3 text-gray-700 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-50 dark:hover:bg-gray-950 rounded-lg transition-colors duration-200 text-sm font-medium;
    }

    .mobile-link-outlined {
        @apply flex items-center px-4 py-3 text-gray-700 dark:text-gray-300 border-2 border-gray-900 dark:border-white hover:bg-gray-50 dark:hover:bg-gray-950 rounded-lg transition-colors duration-200 text-sm font-semibold;
    }

    .mobile-link-primary {
        @apply flex items-center px-4 py-3 bg-black dark:bg-white text-white dark:text-black hover:bg-gray-800 dark:hover:bg-gray-100 rounded-lg transition-colors duration-200 text-sm font-semibold;
    }

    .title {
        @apply text-center text-4xl font-bold text-gray-900 dark:text-gray-300 mb-4;
    }

    .text-content {
        @apply mt-1 text-sm text-gray-600 dark:text-gray-400;
    }

    .button {
        @apply inline-flex items-center rounded-lg bg-black px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition-colors duration-200 hover:bg-gray-800 hover:shadow-md dark:bg-[#c99a4b] dark:text-[#080705] dark:hover:bg-[#d6ad63] cursor-pointer;
    }

    .button-secondary {
        @apply inline-flex items-center justify-center rounded-lg border border-gray-300 px-3 py-1.5 text-xs font-semibold text-gray-700 transition-colors duration-200 hover:bg-gray-50 dark:border-gray-800 dark:text-gray-500 dark:hover:bg-white/[0.04] dark:hover:text-gray-300 cursor-pointer;
    }

    .modal-tab {
        @apply inline-flex min-h-10 items-center justify-center rounded-lg border px-4 py-2 text-sm font-semibold transition-colors duration-200;
    }

    .modal-tab-idle {
        @apply border-gray-300 text-gray-800 hover:bg-gray-50 hover:text-gray-950 dark:border-white/10 dark:text-[#9c968a] dark:hover:bg-white/[0.035] dark:hover:text-[#f2f0ea];
    }

    .modal-tab-active {
        @apply cursor-default border-amber-500 bg-amber-500 text-gray-950 shadow-sm dark:border-[#c99a4b] dark:bg-[#c99a4b] dark:text-[#080705];
    }

    .table-filter-panel {
        @apply flex flex-col gap-3 rounded-lg border border-gray-200 bg-white p-3 shadow-sm dark:border-gray-800 dark:bg-gray-950;
    }

    .table-filter-select {
        @apply w-full;
    }

    .table-container {
        @apply overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-950;
    }

    .modal-inner .table-container {
        @apply dark:border-[#3a342c] dark:bg-[#181713] dark:shadow-[0_0_0_1px_rgba(201,154,75,0.08)];
    }

    .table-responsive {
        @apply overflow-x-auto;
    }

    .table-modern {
        @apply w-full min-w-[760px] text-sm;
    }

    .table-header {
        @apply border-b border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-gray-950;
    }

    .modal-inner .table-header {
        @apply dark:border-[#3a342c] dark:bg-[#201d17];
    }

    .table-header-cell {
        @apply px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-[0.16em] text-gray-500 dark:text-gray-600;
    }

    .table-body {
        @apply divide-y divide-gray-100 dark:divide-white/5;
    }

    .table-body > tr {
        @apply transition-colors duration-200 dark:bg-gray-950;
    }

    .modal-inner .table-body > tr {
        @apply dark:bg-[#181713];
    }

    .table-body > tr:hover {
        @apply bg-gray-50 dark:bg-white/[0.035];
    }

    .modal-inner .table-body > tr:hover {
        @apply dark:bg-[#201d17];
    }

    .table-row {
        @apply transition-colors duration-200 hover:bg-gray-50 dark:hover:bg-white/[0.035];
    }

    .table-cell {
        @apply px-4 py-4 text-sm text-gray-700 dark:text-gray-400;
    }

    .table-cell-strong {
        @apply font-semibold text-gray-950 dark:text-gray-300;
    }

    .table-muted {
        @apply text-xs text-gray-500 dark:text-[#6f6a60];
    }

    .table-avatar {
        @apply flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-amber-100 text-xs font-bold text-amber-700 dark:bg-[#3a2b13] dark:text-[#c99a4b];
    }

    .table-pill {
        @apply inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold;
    }

    .table-pill-green {
        @apply bg-green-100 text-green-700 dark:bg-[#17301c] dark:text-[#6f9a6e];
    }

    .table-pill-amber {
        @apply bg-amber-100 text-amber-700 dark:bg-[#332313] dark:text-[#c99a4b];
    }

    .table-pill-red {
        @apply bg-red-100 text-red-700 dark:bg-[#341713] dark:text-[#c97b3d];
    }

    /* Estados y Badges */
    .badge {
        @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
    }

    .badge-success {
        @apply bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400;
    }

    .badge-warning {
        @apply bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400;
    }

    .badge-info {
        @apply bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400;
    }

    .badge-danger {
        @apply bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400;
    }

    /* Botones de Acción */
    .action-button {
        @apply rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-500 dark:hover:bg-white/[0.04] dark:hover:text-gray-300;
    }

    .action-button-primary {
        @apply p-1.5 text-gray-500 hover:text-blue-600 dark:hover:text-blue-400 transition-colors;
    }

    .action-button-danger {
        @apply p-1.5 text-gray-500 hover:text-red-600 dark:hover:text-red-400 transition-colors;
    }

    /* Toolbar */
    .table-toolbar {
        @apply border-b border-gray-200 bg-gray-50 px-6 py-4 dark:border-gray-800 dark:bg-gray-950;
    }

    /* Paginación */
    .pagination-container {
        @apply border-t border-gray-200 bg-gray-50 px-6 py-4 dark:border-gray-800 dark:bg-gray-900;
    }

    .pagination-button {
        @apply rounded-lg px-3 py-1 text-sm text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-500 dark:hover:bg-white/[0.04];
    }

    .pagination-button-active {
        @apply rounded-lg bg-black px-3 py-1 text-sm text-white dark:bg-[#c99a4b] dark:text-[#080705];
    }

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

    .table-row {
        animation: fadeIn 0.3s ease-out;
    }

    .label-gray {
        @apply inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700 dark:bg-white/[0.06] dark:text-[#9c968a];
    }

    .label-blue {
        @apply inline-flex items-center px-3 py-1 text-xs font-medium text-blue-700 bg-blue-100 dark:text-blue-400 dark:bg-blue-900/20 rounded-full;
    }

    .card-form {
        @apply bg-white dark:bg-gray-950 rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-6 md:p-8;
    }

    .chart-panel {
        @apply bg-white dark:bg-gray-950 rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-4 md:p-6;
    }

    .chart-panel canvas {
        @apply rounded-lg;
    }

    /* Form Grid Layouts */
    .form-grid {
        @apply grid grid-cols-1 md:grid-cols-2 gap-6;
    }

    .form-row {
        @apply grid grid-cols-1 md:grid-cols-2 gap-6;
    }

    /* Labels */
    .label {
        @apply block text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2;
    }

    .label.required::after {
        @apply content-['*'] ml-1 text-red-500;
    }

    /* Inputs Base */
    .input {
        @apply w-full rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm text-gray-900 transition-all duration-200 placeholder:text-gray-400 focus:border-transparent focus:ring-2 focus:ring-black dark:border-white/10 dark:bg-[#181713] dark:text-[#f2f0ea] dark:placeholder:text-[#6f6a60] dark:focus:ring-[#c99a4b];
    }

    .input:hover:not(:focus) {
        @apply border-gray-400 dark:border-gray-600;
    }

    .select {
        @apply w-full cursor-pointer rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm text-gray-900 transition-all duration-200 focus:border-transparent focus:ring-2 focus:ring-black dark:border-white/10 dark:bg-[#181713] dark:text-[#f2f0ea] dark:focus:ring-[#c99a4b];
    }

    .textarea {
        @apply w-full px-4 py-2.5 text-sm text-gray-900 dark:text-gray-100 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-black dark:focus:ring-white focus:border-transparent transition-all duration-200 placeholder:text-gray-400 dark:placeholder:text-gray-600 resize-none;
    }

    .input-group {
        @apply relative;
    }

    .checkbox {
        @apply w-4 h-4 text-black dark:text-white bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-black dark:focus:ring-white;
    }

    .checkbox-container {
        @apply flex items-center cursor-pointer;
    }

    .checkbox-label {
        @apply ml-2 text-sm text-gray-700 dark:text-gray-300;
    }

    .alert {
        @apply p-4 rounded-lg mb-6;
    }

    .alert-error {
        @apply bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-400 border border-red-200 dark:border-red-800 flex items-center gap-3;
    }

    .alert-success {
        @apply bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-400 border border-green-200 dark:border-green-800 flex items-center gap-3;
    }

    .alert-warning {
        @apply bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 flex items-center gap-3;
    }

    .alert-info {
        @apply bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-400 border border-blue-200 dark:border-blue-800 flex items-center gap-3;
    }

    .form-actions {
        @apply flex items-center justify-end gap-3 mt-8 pt-6 border-t border-gray-200 dark:border-gray-800;
    }

    @media (max-width: 640px) {
        .form-actions {
            @apply flex-col-reverse w-full;
        }

        .form-actions > * {
            @apply w-full;
        }
    }

    .input:disabled, .select:disabled, .textarea:disabled {
        @apply bg-gray-50 dark:bg-gray-900 cursor-not-allowed opacity-60;
    }

    .input:focus-visible, .select:focus-visible, .textarea:focus-visible {
        @apply outline-none ring-2 ring-black dark:ring-white ring-offset-2;
    }

    .dropdown {
        @apply relative min-w-64 bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-700 p-1;
    }

    .dropdown-link {
        @apply block px-4 py-2.5 text-sm text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors;
    }

    /* FLECHA MEJORADA - Ahora sí se verá puntiaguda */
    .dropdown-arrow {
        position: absolute;
        width: 10px;
        height: 10px;
    }

    .dropdown-arrow::before {
        content: '';
        position: absolute;
        width: 10px;
        height: 10px;
        background: white;
        border: 1px solid rgb(229 231 235);
        transform: rotate(45deg);
    }

    .dark .dropdown-arrow::before {
        background: rgb(17 24 39);
        border-color: rgb(55 65 81);
    }

    /* Posicionamiento para bottom (dropdown abajo del botón) */
    .dropdown-arrow[data-popper-placement^='bottom'] {
        top: -5px;
    }

    .dropdown-arrow[data-popper-placement^='bottom']::before {
        border-bottom: 0;
        border-right: 0;
    }

    /* Posicionamiento para top (dropdown arriba del botón) */
    .dropdown-arrow[data-popper-placement^='top'] {
        bottom: -5px;
    }

    .dropdown-arrow[data-popper-placement^='top']::before {
        border-top: 0;
        border-left: 0;
    }

    /* Posicionamiento para left (dropdown a la izquierda) */
    .dropdown-arrow[data-popper-placement^='left'] {
        right: -5px;
    }

    .dropdown-arrow[data-popper-placement^='left']::before {
        border-left: 0;
        border-bottom: 0;
    }

    /* Posicionamiento para right (dropdown a la derecha) */
    .dropdown-arrow[data-popper-placement^='right'] {
        left: -5px;
    }

    .dropdown-arrow[data-popper-placement^='right']::before {
        border-right: 0;
        border-top: 0;
    }
}
/* ================= Genealogy Tree Base ================= */
.gene-tree {
    --branch-gap: 20px;
    --line: #D1D5DB;
    --hover: #fbbf24;
    --origin: #fb923c;
    --node-bg: #FFFFFF;
    --node-fg: #111827;
    --node-border: #9CA3AF;

    overflow-x: auto;
    padding: 20px;
    background: transparent;
}

.dark .gene-tree {
    --line: #475569;
    --hover: #f59e0b;
    --origin: #fb923c;
    --node-bg: #111827;
    --node-fg: #e5e7eb;
    --node-border: #475569;
}

.gene-tree ul {
    padding-top: var(--branch-gap);
    position: relative;
    display: table;
    margin: 0 auto;
}

.gene-tree li {
    list-style: none;
    display: table-cell;
    text-align: center;
    position: relative;
    padding: var(--branch-gap) 8px 0 8px;
    vertical-align: top;
}

.gene-tree li::before,
.gene-tree li::after {
    content: "";
    position: absolute;
    top: 0;
    width: 50%;
    height: var(--branch-gap);
    border-top: 1px solid var(--line);
    display: block;
    transition: border-color 0.2s ease;
    pointer-events: none;
}

.gene-tree li::before {
    right: 50%;
    border-right: 1px solid var(--line);
}

.gene-tree li::after {
    left: 50%;
    border-left: 1px solid var(--line);
}

.gene-tree li:first-child::before { border: 0 none; }
.gene-tree li:last-child::after { border: 0 none; }

.gene-tree li:only-child::before,
.gene-tree li:only-child::after {
    display: none;
}

.gene-tree ul ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: var(--branch-gap);
    border-left: 1px solid var(--line);
    transition: border-color 0.2s ease;
    pointer-events: none;
}

.gene-tree li:only-child { padding-top: 0; }
.gene-tree > ul > li { padding-top: 0; }

.gene-node {
    display: inline-block;
    min-width: 90px;
    padding: 8px 12px;
    background: var(--node-bg);
    color: var(--node-fg);
    border: 1px solid var(--node-border);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
    font-size: 1em;
    line-height: 1.2;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    user-select: text;
}

.gene-arete { display: block; }

.gene-name {
    display: block;
    font-size: .7rem;
    color: #6b7280;
    font-weight: normal;
    margin-top: 2px;
}

.dark .gene-name {
    color: #cbd5e1;
}

.gene-role {
    display: block;
    margin-top: 5px;
    font-size: .8rem;
    color: #6B7280;
    font-weight: 500;
}

.dark .gene-role {
    color: #94a3b8;
}

.gene-generation {
    opacity: 0.7;
    font-size: .8rem;
}

.gene-node.is-missing {
    background: #F9FAFB;
    border-style: dashed;
    color: #9CA3AF;
}

.dark .gene-node.is-missing {
    background: #020617;
    color: #64748b;
}

.gene-node.is-root {
    background: #f0fdf4;
    border-color: #10b981;
    border-width: 2px;
}

.dark .gene-node.is-root {
    background: #052e2b;
    border-color: #34d399;
}

.gene-node.is-male { border-left: 3px solid #60a5fa; }
.gene-node.is-female { border-left: 3px solid #f472b6; }

.gene-node:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

li.hover-active > .gene-node {
    background: #fef3c7;
    border-color: var(--hover);
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.2);
}

.dark li.hover-active > .gene-node {
    background: #451a03;
    color: #fef3c7;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18), 0 8px 20px rgba(0, 0, 0, 0.22);
}

li.hover-origin > .gene-node {
    background: #fed7aa;
    border-color: var(--origin);
    border-width: 2px;
    box-shadow: 0 3px 6px rgba(251, 146, 60, 0.25);
}

.dark li.hover-origin > .gene-node {
    background: #431407;
    color: #ffedd5;
    box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.22), 0 10px 22px rgba(0, 0, 0, 0.24);
}

li.hover-active::before,
li.hover-active::after {
    border-color: var(--hover);
}

ul.has-hover-child::before {
    border-color: var(--hover);
}

li.hover-descendant > .gene-node {
    background: #dbeafe;
    border-color: #60a5fa;
}

.dark li.hover-descendant > .gene-node {
    background: #172554;
    border-color: #60a5fa;
    color: #dbeafe;
}

li.hover-active > .gene-role > .gene-generation,
li.hover-origin > .gene-role > .gene-generation {
    background: var(--hover);
    color: #78350f;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

li.pinned > .gene-node::before {
    content: "PIN";
    position: absolute;
    top: -18px;
    right: -18px;
    z-index: 10;
    border-radius: 9999px;
    background: #111827;
    color: #ffffff;
    font-size: 10px;
    line-height: 1;
    padding: 4px 5px;
}

.dark li.pinned > .gene-node::before {
    background: #e5e7eb;
    color: #111827;
}

li.pinned-trace > .gene-node {
    background: #fef3c7;
    border-color: var(--hover);
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.2);
}

.dark li.pinned-trace > .gene-node {
    background: #451a03;
    color: #fef3c7;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18), 0 8px 20px rgba(0, 0, 0, 0.22);
}

li.pinned-trace::before,
li.pinned-trace::after {
    border-color: var(--hover);
}

ul.has-pinned-child::before {
    border-color: var(--hover);
}

li.pinned-origin > .gene-node {
    background: #fed7aa;
    border-color: var(--origin);
    border-width: 2px;
    box-shadow: 0 3px 6px rgba(251, 146, 60, 0.25);
}

.dark li.pinned-origin > .gene-node {
    background: #431407;
    color: #ffedd5;
    box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.22), 0 10px 22px rgba(0, 0, 0, 0.24);
}

li.pinned-trace > .gene-role > .gene-generation,
li.pinned-origin > .gene-role > .gene-generation {
    background: var(--hover);
    color: #78350f;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

[data-popper-arrow] {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.dark .genealogy-tooltip {
    background: #181713;
    border: 2px solid #c99a4b;
    border-color: #c99a4b;
    color: #f2f0ea;
    box-shadow: 0 0 0 1px rgba(201, 154, 75, 0.18), 0 16px 34px rgba(0, 0, 0, 0.45);
}

.arrow-tooltip[data-popper-placement^="top"] {
    bottom: -6px;
    border-width: 6px 6px 0 6px;
    border-color: #030712 transparent transparent transparent;
}

.arrow-tooltip[data-popper-placement^="bottom"] {
    top: -6px;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #030712 transparent;
}

.arrow-tooltip[data-popper-placement^="left"] {
    right: -6px;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #030712;
}

.arrow-tooltip[data-popper-placement^="right"] {
    left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent #030712 transparent transparent;
}

.dark .arrow-tooltip[data-popper-placement^="top"] {
    border-color: #c99a4b transparent transparent transparent;
}

.dark .arrow-tooltip[data-popper-placement^="bottom"] {
    border-color: transparent transparent #c99a4b transparent;
}

.dark .arrow-tooltip[data-popper-placement^="left"] {
    border-color: transparent transparent transparent #c99a4b;
}

.dark .arrow-tooltip[data-popper-placement^="right"] {
    border-color: transparent #c99a4b transparent transparent;
}

@media (max-width: 768px) {
    .gene-tree {
        padding: 10px;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
        --branch-gap: 14px;
    }

    .gene-node {
        min-width: 80px;
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .gene-role { font-size: 0.65rem; }
}
/* ============================================================
   MODAL ANIMATIONS — diseño propio
   Compatibles con el Stimulus modal_controller.js
   ============================================================ */

/* ── KEYFRAMES ─────────────────────────────────────────────── */

/* Centro: emerge con blur desde profundidad */
@keyframes my-center-in {
    0%   {
        transform: translate(-50%, -50%) scale(0.82);
        opacity: 0;
        filter: blur(4px);
    }
    60%  { filter: blur(0px); }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        filter: blur(0px);
    }
}
@keyframes my-center-out {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* Top: cae con peso, squash al aterrizar */
@keyframes my-top-in {
    0%   { transform: translateY(-100%) scaleY(0.94); opacity: 0; }
    55%  { transform: translateY(6px) scaleY(1.02);   opacity: 1; }
    78%  { transform: translateY(-3px) scaleY(0.99); }
    100% { transform: translateY(0) scaleY(1);         opacity: 1; }
}
@keyframes my-top-out {
    0%   { transform: translateY(0) scaleY(1); opacity: 1; }
    30%  { transform: translateY(6px); }
    100% { transform: translateY(-110%);       opacity: 0; }
}

/* Bottom: sube con inercia, settle suave */
@keyframes my-bottom-in {
    0%   { transform: translateY(100%) scaleY(0.94); opacity: 0; }
    55%  { transform: translateY(-6px) scaleY(1.02); opacity: 1; }
    78%  { transform: translateY(3px) scaleY(0.99); }
    100% { transform: translateY(0) scaleY(1);        opacity: 1; }
}
@keyframes my-bottom-out {
    0%   { transform: translateY(0);    opacity: 1; }
    30%  { transform: translateY(-6px); }
    100% { transform: translateY(110%); opacity: 0; }
}

/* Left: drawer — rápido y decisivo, sin bounce */
@keyframes my-left-in {
    0%   { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0);     opacity: 1; }
}
@keyframes my-left-out {
    0%   { transform: translateX(0);     opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0; }
}

/* Right: drawer — simétrico al left */
@keyframes my-right-in {
    0%   { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0);    opacity: 1; }
}
@keyframes my-right-out {
    0%   { transform: translateX(0);    opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

/* Shake lateral: peso + scaleX simula compresión física */
@keyframes shake-x {
    0%,  100% { transform: translateX(0) scaleX(1); }
    10%       { transform: translateX(-12px) scaleX(0.98); }
    25%       { transform: translateX(10px) scaleX(1.01); }
    40%       { transform: translateX(-8px) scaleX(0.99); }
    55%       { transform: translateX(5px); }
    70%       { transform: translateX(-3px); }
    85%       { transform: translateX(2px); }
}

/* Shake center: preserva translate(-50%,-50%) */
@keyframes shake-x-center {
    0%,  100% { transform: translate(-50%, -50%) scale(1) scaleX(1); }
    10%       { transform: translate(calc(-50% - 12px), -50%) scale(1) scaleX(0.98); }
    25%       { transform: translate(calc(-50% + 10px), -50%) scale(1) scaleX(1.01); }
    40%       { transform: translate(calc(-50% - 8px),  -50%) scale(1) scaleX(0.99); }
    55%       { transform: translate(calc(-50% + 5px),  -50%) scale(1); }
    70%       { transform: translate(calc(-50% - 3px),  -50%) scale(1); }
    85%       { transform: translate(calc(-50% + 2px),  -50%) scale(1); }
}

/* ── CLASES DE ENTRADA/SALIDA ──────────────────────────────── */
/* Usadas por el controller vía classList.add/remove("show")   */

/* Centro — el JS ya maneja transform/opacity inline.
   Solo necesitamos las clases de animación para shake.
   La transición de entrada/salida la maneja el controller
   directamente via style.transform y style.transition.        */
.modal-animate-center {
    /* noop — JS controla transform/opacity inline */
}

/* Top */
.modal-animate-top {
    transform: translateY(-100%) scaleY(0.94);
    opacity: 0;
}
.modal-animate-top.show {
    animation: my-top-in 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* Bottom */
.modal-animate-bottom {
    transform: translateY(100%) scaleY(0.94);
    opacity: 0;
}
.modal-animate-bottom.show {
    animation: my-bottom-in 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* Left */
.modal-animate-left {
    transform: translateX(-100%);
    opacity: 0;
}
.modal-animate-left.show {
    animation: my-left-in 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Right */
.modal-animate-right {
    transform: translateX(100%);
    opacity: 0;
}
.modal-animate-right.show {
    animation: my-right-in 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ── ANIMACIONES DE SALIDA ─────────────────────────────────── */
/* El controller llama modal.classList.remove("show") al cerrar.
   Estas clases las puedes aplicar manualmente si quieres
   animar la salida también (requiere pequeño ajuste en el
   controller — ver nota abajo).                               */

.modal-animate-top.hiding {
    animation: my-top-out 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.modal-animate-bottom.hiding {
    animation: my-bottom-out 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.modal-animate-left.hiding {
    animation: my-left-out 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.modal-animate-right.hiding {
    animation: my-right-out 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* ── SHAKE ─────────────────────────────────────────────────── */
/* Usados por shakeModal() en el controller                     */

.shake-x {
    animation: shake-x 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.shake-x-center {
    animation: shake-x-center 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── OVERLAY ───────────────────────────────────────────────── */
/* El overlay lo crea el controller con JS. Estas clases son
   opcionales si quieres un fade-in del fondo más suave que
   el backdrop-filter instantáneo.                              */

@keyframes overlay-in {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(6px);
    }
}
@keyframes overlay-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

[data-modal-overlay] {
    animation: overlay-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
[data-modal-overlay].closing {
    animation: overlay-out 0.25s ease forwards;
}

/* ── SPINNER ───────────────────────────────────────────────── */
@keyframes animate-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.animate-fade {
    animation: animate-fade 0.2s ease forwards;
}
/* Contenedor general */
.select2-container {
    margin: 0 !important;
    display: block !important;
    width: 100% !important;
}

/* Caja de selección principal */
.select2-container .select2-selection {
    @apply w-full text-gray-900 dark:text-[#cfcac0] text-sm border border-gray-400 dark:border-white/10 rounded-lg p-2 bg-transparent dark:bg-[#181713] !important;
    height: 2.5rem !important;
    line-height: 1.5rem !important;
}

.select2-container .select2-selection:hover {
    @apply border-black bg-gray-50 text-gray-900 dark:border-[#c99a4b] dark:bg-[#201d17] dark:text-[#f2f0ea] !important;
}

/* Placeholder */
.select2-selection__placeholder {
    @apply text-gray-500 dark:text-[#6f6a60] !important;
}

/* Texto seleccionado */
.select2-selection__rendered {
    @apply text-gray-900 dark:text-[#f2f0ea] !important;
}

/* Asegura que el contenedor del arrow tenga posición relativa */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    top: 50% !important;
    right: 0.75rem !important; /* separa un poco del borde */
    transform: translateY(-50%) !important;
    width: 1rem !important;
    height: 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Flecha normal (cerrada) */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #999 transparent transparent transparent !important;
    border-width: 5px 4px 0 4px !important;
    display: block !important;
}

/* Flecha cuando el select está abierto */
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #999 transparent !important;
    border-width: 0 4px 5px 4px !important;
}

/* Dropdown (contenedor del menú) */
.select2-dropdown {
    @apply border border-gray-400 bg-gray-100 dark:border-[#c99a4b] dark:bg-[#12110f] rounded-b-lg rounded-t-none shadow-lg !important;
    margin-top: -1px !important;
}

/* Área de búsqueda dentro del dropdown */
.select2-search--dropdown {
    @apply p-2 bg-gray-100 dark:bg-[#12110f] !important;
}

/* Input del buscador */
.select2-search__field {
    @apply w-full text-gray-800 dark:text-[#f2f0ea] bg-gray-100 dark:bg-[#181713] border border-gray-400 dark:border-white/10 rounded-lg focus:outline-none focus:ring-0 focus:border-gray-500 dark:focus:border-[#c99a4b] !important;
}

/* Lista de resultados */
.select2-results__options {
    @apply text-gray-900 dark:text-[#cfcac0] font-normal text-sm rounded-lg !important;
    max-height: 200px;
    overflow-y: auto;
}

/* Scroll personalizado */
.select2-results__options::-webkit-scrollbar {
    width: .4rem;
}

.select2-results__options::-webkit-scrollbar-track {
    @apply bg-gray-200 dark:bg-gray-800 rounded-xl !important;
}

.select2-results__options::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded-lg !important;
}

/* Resultado destacado (hover o activo) */
.select2-results__option--highlighted {
    @apply bg-gray-700 text-gray-50 rounded-lg dark:bg-[#332313] dark:text-[#f2f0ea] !important;
}

/* Mensaje "sin resultados" */
.select2-results__message {
    @apply bg-gray-100 dark:bg-[#12110f] text-red-500 font-bold p-2 rounded-md !important;
}

/* Texto coincidente */
.select2-results__option strong {
    @apply bg-green-500 text-green-900 font-bold px-1 rounded !important;
}

/* Deshabilitado */
.select2-container--disabled .select2-selection {
    @apply bg-gray-300 dark:bg-gray-700 dark:text-gray-400 border-gray-600 cursor-not-allowed !important;
}

/* Estado abierto */
.select2-container--open .select2-selection {
    @apply rounded-t-lg rounded-b-none border-gray-400 border-b-0 dark:border-[#c99a4b] !important;
}

/* Error visual */
.is-invalid-input .select2-selection {
    @apply border-red-500 w-full !important;
}

/* ✅ Opción seleccionada (no hover) */
.select2-container--default .select2-results__option--selected {
    @apply bg-gray-800 text-gray-100 dark:bg-[#201d17] dark:text-[#f2f0ea] !important;
}

/* ✅ Opción seleccionada + hover (mantén contraste oscuro) */
.select2-container--default .select2-results__option--selected.select2-results__option--highlighted {
    @apply bg-gray-700 text-white dark:bg-[#c99a4b] dark:text-[#080705] !important;
}

.field_with_errors .select2-container .select2-selection {
    border: 1px solid #ef0e0e !important;
    width: 100% !important;
    background-color: #ffe6e6 !important;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

.app-font,
.app-font * {
    font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
    letter-spacing: 0;
}

.flatpickr-time,
.flatpickr-time input {
    font-size: 1.25rem;
}

.flatpickr-buttons-wrapper {
    display: flex;
    width: 100%;
}

.flatpickr-clear-button,
.flatpickr-today-button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
}

.flatpickr-today-button {
    background: #f0fdf4;
    color: #059669;
    border-top: 1px solid #d1fae5;
}

.flatpickr-today-button:hover {
    background: #10b981;
    color: white;
}

.flatpickr-clear-button {
    background: #fef2f2;
    color: #dc2626;
    border-top: 1px solid #fee2e2;
}

.flatpickr-clear-button:hover {
    background: #ef4444;
    color: white;
}

.flatpickr-time__header {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-top: 1px solid #e5e7eb;
}

.dark .flatpickr-calendar {
    background: #12110f;
    border-color: #c99a4b;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 154, 75, 0.35);
}

.dark .flatpickr-calendar.arrowTop::before {
    border-bottom-color: #c99a4b;
}

.dark .flatpickr-calendar.arrowTop::after {
    border-bottom-color: #12110f;
}

.dark .flatpickr-calendar.arrowBottom::before {
    border-top-color: #c99a4b;
}

.dark .flatpickr-calendar.arrowBottom::after {
    border-top-color: #12110f;
}

.dark .flatpickr-months,
.dark .flatpickr-month,
.dark .flatpickr-current-month,
.dark .flatpickr-current-month input.cur-year,
.dark .flatpickr-weekdays,
.dark span.flatpickr-weekday {
    background: #12110f;
    color: #cfcac0;
    fill: #cfcac0;
}

.dark .flatpickr-current-month .flatpickr-monthDropdown-months,
.dark .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background: #181713;
    color: #f2f0ea;
}

.dark .flatpickr-prev-month,
.dark .flatpickr-next-month {
    color: #9c968a;
    fill: #9c968a;
}

.dark .flatpickr-prev-month:hover svg,
.dark .flatpickr-next-month:hover svg {
    fill: #c99a4b;
}

.dark .flatpickr-innerContainer,
.dark .flatpickr-rContainer,
.dark .flatpickr-days,
.dark .dayContainer {
    background: #12110f;
}

.dark .flatpickr-day {
    color: #cfcac0;
    border-color: #3a342c;
}

.dark .flatpickr-day.prevMonthDay,
.dark .flatpickr-day.nextMonthDay {
    color: #6f6a60;
}

.dark .flatpickr-day:hover,
.dark .flatpickr-day:focus {
    background: #201d17;
    border-color: #c99a4b;
    color: #f2f0ea;
}

.dark .flatpickr-day.today {
    border-color: #c99a4b;
    color: #f2f0ea;
}

.dark .flatpickr-day.today:hover,
.dark .flatpickr-day.today:focus {
    background: #332313;
    color: #f2f0ea;
}

.dark .flatpickr-day.prevMonthDay:hover,
.dark .flatpickr-day.nextMonthDay:hover,
.dark .flatpickr-day.prevMonthDay:focus,
.dark .flatpickr-day.nextMonthDay:focus {
    background: #201d17;
    border-color: #3a342c;
    color: #9c968a;
}

.dark .flatpickr-day.selected,
.dark .flatpickr-day.startRange,
.dark .flatpickr-day.endRange {
    background: #c99a4b;
    border-color: #c99a4b;
    color: #080705;
}

.dark .flatpickr-time {
    background: #12110f;
    border-top-color: #3a342c;
}

.dark .flatpickr-time input,
.dark .flatpickr-time .flatpickr-am-pm {
    background: #12110f;
    color: #f2f0ea;
}

.dark .flatpickr-time input:hover,
.dark .flatpickr-time .flatpickr-am-pm:hover,
.dark .flatpickr-time input:focus {
    background: #201d17;
}

.dark .flatpickr-time__header {
    background: #12110f;
    border-top-color: #3a342c;
    color: #9c968a;
}

.dark .flatpickr-today-button {
    background: #181713;
    border-top-color: #3a342c;
    color: #cfcac0;
}

.dark .flatpickr-today-button:hover {
    background: #c99a4b;
    color: #080705;
}

.dark .flatpickr-clear-button {
    background: #211315;
    border-top-color: #4b252c;
    color: #fca5a5;
}

.dark .flatpickr-clear-button:hover {
    background: #dc2626;
    color: #ffffff;
}
