/* =========================
   VARIABLES GLOBALES
========================= */
:root {
    --color-primary: #024D25;
    --color-secondary: #55882B;

    --color-paises: #81CFF4;
    --color-pilares: #024D25;
    --color-beneficios: #93C01F;
    --color-ubicaciones: #8CBCC4;

    --color-bg: #f4f6f9;
    --color-white: #ffffff;
    --color-border: rgba(0, 0, 0, 0.10);
    --color-text: #1f2937;
    --color-muted: #6b7280;

    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;

    --color-primary-hover: #036b33;
    --color-secondary-hover: #6fa63a;

    --surface-1: rgba(255, 255, 255, 0.85);
    --surface-2: rgba(255, 255, 255, 0.92);
    --surface-border: rgba(2, 77, 37, 0.08);
    --surface-sidebar: rgba(2, 77, 37, 0.88);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
}

body.loading {
    overflow: hidden;
}

/* =========================
   LOADER
========================= */
.global-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all .2s ease;
}

.global-loader.active {
    opacity: 1;
    visibility: visible;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.success-transition {
    animation: successFade 0.4s ease forwards;
}

@keyframes successFade {
    to {
        opacity: 0;
        transform: scale(0.98);
    }
}

/* =========================
   AAAAAAAAAAAAAAAAAA
========================= */

/* =========================
   BOTONES
========================= */
.btn {
    cursor: pointer;
    /* border-radius: 8px; */
    /* padding: 10px 16px; */
    border: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;

    padding: 15px 30px;
    border-radius: 15px;
}

.btn-login{
    width: 100%;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    /* width: 100%; */
    /* margin-top: 10px; */
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity .3s;
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--color-secondary-hover);
}

.btn-warning {
    background: var(--color-warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 12px 15px;
    font-size: 12px;
    border-radius: 6px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

/* Oculta el ícono cuando está loading */
.btn-loading i {
    display: none;
}

.btn-loading::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    /* margin-right: 8px; */
    animation: spin 0.6s linear infinite;
}

/* =========================
   FORMULARIOS
========================= */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

input,
select,
textarea {
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(2, 77, 37, 0.15);
    transform: scale(1.01);
}

input:hover {
    border-color: var(--color-secondary);
}

.input-wrapper {
    position: relative;
}

input.error-input,
.input-invalid {
    border-color: var(--color-danger);
    background: #fff5f5;
}

.input-valid {
    border-color: var(--color-success);
}

@keyframes shake {

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

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.shake {
    animation: shake 0.4s ease;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #444;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.toggle-password:hover {
    color: #000;
    transform: translateY(-50%) scale(1.1);
}

.password-strength {
    height: 6px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 6px;
    margin-top: 6px;
    overflow: hidden;
}

#strengthBar {
    height: 100%;
    width: 0%;
    transition: all .3s ease;
    background: #dc2626;
}

#strengthText {
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.match-ok {
    color: #16a34a;
    font-weight: 600;
}

.match-bad {
    color: #dc2626;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
}

.input-order {
    max-width: 120px;
    text-align: center;
}

.image-preview {
    margin-top: 8px;
}

.image-preview img {
    max-width: 120px;
    object-fit: contain;
}

.logo_beneficio img {
    border-radius: 10px;
    border: 1px solid #000000;
    background-color: black;
    padding: 10px;
}

/* =========================
   ALERTAS
========================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #e6f4ea;
    color: #1e4620;
    border-left-color: #16a34a;
}

.alert-danger {
    background: #fef2f2;
    color: #7f1d1d;
    border-left-color: #dc2626;
}

.alert-validation ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.alert-validation li {
    margin-bottom: 4px;
}

.alert i {
    margin-top: 2px;
}

.field-error {
    display: block;
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
}

.input-valid {
    border: 1px solid #16a34a;
}

.input-invalid {
    border: 1px solid #dc2626;
}

/* =========================
   FORM UX MEJORADO
========================= */

/* errores */
.form-error {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 4px;
}

/* spacing más consistente */
.form-group {
    gap: 4px;
}

/* input file más limpio */
input[type="file"] {
    padding: 6px;
    background: #fff;
}

/* preview más elegante (reusa tu clase existente) */
/* .image-preview img {
    max-height: 50px;
    object-fit: contain;
} */

/* feedback visual sutil */
input:focus:valid {
    border-color: var(--color-success);
}

/* checkbox más alineado */
.checkbox-label {
    margin-top: 6px;
}

/* acciones sticky (UX PRO) */
.form-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface-2);
    padding-top: 10px;
}

/* =========================
   TABLAS
========================= */
.table {
    width: 100%;
    /* min-width: 600px; */
    /* evita que colapse demasiado */
    border-collapse: collapse;
}

.table th,
.table td {
    /* padding: 12px; */
    padding: 10px 8px;
    font-size: 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.table th {
    background: #f9fafb;
    color: var(--color-text);
}

.table tr:hover {
    background: #f4f8f5;
}

.badge {
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 12px;
    border: none;

    display: inline-block;
    font-weight: 500;
}

.badge-success {
    background: var(--color-success);
    color: #fff;
}

.badge-danger {
    background: #f87171;
    color: #fff;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.text-muted {
    color: #6b7280;
}

.pais-icon {
    font-size: 24px;
    display: inline-block;
    width: 32px;
    height: 32px;
    text-align: center;
    line-height: 32px;
    /* border-radius: 50%; */
}

/* =========================
   LOADER EN TABLA
========================= */
.table-wrapper {
    position: relative;
}

.table-wrapper #table-body {
    transition: opacity .25s ease;
}


/* =========================
   ADMIN PANEL
========================= */
.admin-body {
    background: linear-gradient(135deg, #012a15 0%, #f4f6f9 40%, #eef3f0 100%);
    margin: 0;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(2, 77, 37, 0.08), transparent 40%);
}

/* SIDEBAR */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, var(--surface-sidebar), rgba(2, 53, 31, 0.88));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1000;
    overflow: visible;
    transition: width .25s ease;
}

.sidebar-logo {
    padding: 18px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}

.sidebar-logo img {
    height: 50px;
    object-fit: contain;
    opacity: 0.95;
    transition: all 0.25s ease;
}

.sidebar-logo img:hover {
    transform: scale(1.05);
    opacity: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin-right: 12px;
}

/* Sidebar colapsado */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo img {
    height: 32px;
}

.logo-mini {
    display: none;
}

.sidebar.collapsed .logo-full {
    display: none;
}

.sidebar.collapsed .logo-mini {
    display: block;
    height: 32px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    margin-bottom: 6px;
    transition: all .25s ease;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.85;
    transition: all .2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-item:hover i {
    transform: scale(1.1);
    opacity: 1;
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, #6fa63a, #024D25);
}

.nav-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-item.disabled:hover {
    background: transparent;
}

/* SIDEBAR TOOLTIP (colapsado) */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #111;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all .2s ease;
    z-index: 1100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
    left: 75px;
}

.sidebar:not(.collapsed) .nav-item::after {
    display: none;
}

.sidebar.collapsed .nav-item i {
    font-size: 16px;
}

/* MAIN */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f1f5f2 0%, #f7f9fb 100%);
    position: relative;
    z-index: 1;
    transition: all .25s ease;

    /* overflow: visible !important; */
    /* transform: none */
}

/* HEADER */
.admin-header {
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    backdrop-filter: blur(10px);
    background: var(--surface-2);
    border-bottom: 1px solid var(--surface-border);
    position: relative;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

/* =========================
   BENEFICIOS - CELDAS
========================= */

.beneficio-title {
    font-weight: 600;
    color: var(--color-text);
}

.beneficio-meta {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

.cell-flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-sm {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.pais-icon-fallback {
    font-size: 18px;
    opacity: 0.7;
}

.link-primary {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.link-primary:hover {
    text-decoration: underline;
}

/* EMPTY STATE (reutilizable) */
.empty-state {
    text-align: center;
    padding: 20px;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-icon {
    font-size: 26px;
    opacity: 0.25;
}

/* =========================
   USER DROPDOWN
========================= */

.admin-user {
    position: relative;
}

/* CONTENEDOR PRINCIPAL */
.user-dropdown {
    position: relative;
    z-index: 1100;
}

/* TRIGGER */
.user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .2s ease;
    user-select: none;
}

.user-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* AVATAR */
.avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* DROPDOWN MENU */
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 120%;
    min-width: 180px;
    padding: 8px;

    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);

    display: none;
    animation: fadeDropdown .2s ease;
    z-index: 1200;
}

/* SHOW STATE */
.user-dropdown.active .dropdown-menu {
    display: block;
}

/* BUTTONS INSIDE MENU */
.dropdown-menu form button {
    width: 100%;
    background: none;
    border: none;

    padding: 10px;
    text-align: left;

    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;

    transition: background .2s ease;
}

.dropdown-menu form button:hover {
    background: #f3f4f6;
}

/* ANIMATION */
@keyframes fadeDropdown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

/* CONTENT */
.admin-page {
    padding: 24px;
    background: transparent;
    animation: fadePage .25s ease;
}

@keyframes fadePage {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.page-wrapper {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(2, 77, 37, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-border);
    transition: all .2s ease;

    margin-top: 15px;
}


.card:hover {
    transform: translateY(-2px);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.td-actions,
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.td-actions {
    gap: 10px;
}

/* =========================
   DASHBOARD CARDS
========================= */
.dashboard-header {
    margin-bottom: 20px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 26px;
    color: var(--color-text);
}

.dashboard-header p {
    margin: 4px 0 0 0;
    font-size: 14px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.dash-card {
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
    position: relative;
}

.dash-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 4px;
    opacity: 0.8;
}

.dash-card.paises::before {
    background: #3b82f6;
}

.dash-card.pilares::before {
    background: var(--color-primary);
}

.dash-card.beneficios::before {
    background: var(--color-secondary);
}

.dash-card.ubicaciones::before {
    background: #6366f1;
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(2, 77, 37, 0.12);
}

.dash-card.paises:hover {
    box-shadow: 0 10px 20px rgba(129, 207, 244, 0.25);
}

.dash-card.beneficios:hover {
    box-shadow: 0 10px 20px rgba(147, 192, 31, 0.25);
}

.dash-card-icon {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.dash-card-icon i {
    transition: transform .2s ease;
}

.dash-card:hover .dash-card-icon i {
    transform: scale(1.15);
}

.dash-card.paises .dash-card-icon {
    background: var(--color-paises);
}

.dash-card.pilares .dash-card-icon {
    background: var(--color-pilares);
}

.dash-card.beneficios .dash-card-icon {
    background: var(--color-beneficios);
}

.dash-card.ubicaciones .dash-card-icon {
    background: var(--color-ubicaciones);
}

.dash-card.usuarios .dash-card-icon {
    background: var(--color-success);
}

.dash-card h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
}

.dash-card p {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.dashboard-cards a.dash-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    cursor: pointer;
}

/* =========================
   AUTH
========================= */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #024D25, #55882B);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.auth-logo img {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
    transition: transform .2s ease, opacity .2s ease;
}

.auth-logo img:hover {
    transform: scale(1.03);
    opacity: 0.95;
}

.auth-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .15);
    animation: fadeUpLogin .5s ease;
}

@keyframes fadeUpLogin {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.auth-card.success {
    transform: scale(0.98);
    opacity: 0.8;
    transition: all .3s ease;
}

.auth-card h2 {
    background: linear-gradient(180deg, #024D25, #55882B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--color-muted);
    margin-bottom: 20px;
}

.auth-link {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}

.auth-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: bold;
}

.error {
    color: #dc3545;
    font-size: 12px;
}

/* =========================
   SCROLLBAR
========================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* =========================
   TOAST
========================= */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 240px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn .25s ease;
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

.toast-info {
    background: #2563eb;
}

@keyframes slideIn {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

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

/* =========================
   MODAL BASE
========================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;

    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal.hidden {
    display: none;
}

/* estado visible */
.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* =========================
   MODAL CONTENT
========================= */

.modal-content {
    background: #fff;
    padding: 20px;
    animation: pop .2s ease;
    border-radius: 14px;

    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes pop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

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

/* =========================
   HEADER
========================= */

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 18px 20px;
    border-bottom: 1px solid #eee;

    background: #fafafa;
    justify-content: center;
}

.modal-header h3 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: #222;
}

.modal-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #eee;
    background: var(--color-primary);
}

/* =========================
   BODY
========================= */

#modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* secciones */
.modal-section {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f1f1;
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;

    color: var(--color-secondary);
    margin-bottom: 10px;
    font-weight: 700;
}

/* textos */
.modal-section p {
    margin: 4px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* labels fuertes */
.modal-section p strong {
    color: #111;
}

/* =========================
   ACTIONS
========================= */

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;

    padding: 14px 20px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 13px;
    margin-left: 5px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* oculto */
.hidden {
    display: none;
}

/* lista */
.modal-list {
    margin-top: 6px;
    padding-left: 18px;
}

.modal-list li {
    font-size: 14px;
    margin-bottom: 3px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 600px) {
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
        border-radius: 10px;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================
   FILTROS
========================= */

.dragging {
    opacity: 0.5;
    background: #f3f4f6;
}

.drag-chosen {
    background: #e0f2fe;
}

.beneficios-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}


.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* padding: 12px 0; */
    align-items: center;

    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    /* margin: 10px 0; */
}

.table-toolbar .filter-control {
    width: auto !important;
    /* rompe el 100% global */
    min-width: 180px;
    max-width: 240px;

    padding: 8px 10px;
    font-size: 13px;

    border-radius: 8px;
    /* border: 1px solid #d1d5db; */

    background: #fff;
}

#beneficios-counter {
    align-self: flex-end;
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
    font-weight: 500;

    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    letter-spacing: 0.2px;

    font-variant-numeric: tabular-nums;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 260px;

        transform: translateX(-105%);
        transition: transform 0.3s ease;

        z-index: 2000;
        will-change: transform;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;

        background: rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);

        opacity: 0;
        visibility: hidden;
        transition: all 0.25s ease;

        z-index: 1500;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .sidebar.collapsed .nav-item span {
        display: inline;
    }

    .nav-item {
        gap: 10px;
        padding: 14px;
    }

    .nav-item i {
        font-size: 16px;
        min-width: 22px;
    }

    .nav-item span {
        font-size: 15px;
    }

    /* Bandera */
    .table-paises th:nth-child(1),
    .table-paises td:nth-child(1) {
        display: none;

    }

    /* Código */
    .table-paises th:nth-child(3),
    .table-paises td:nth-child(3) {
        display: none;

    }

    /* Bandera */
    .table-pilares th:nth-child(1),
    .table-pilares td:nth-child(1) {
        display: none;

    }

    .table-pilares th:nth-child(3),
    .table-pilares td:nth-child(3) {
        display: none;

    }

    .table-pilares th:nth-child(4),
    .table-pilares td:nth-child(4) {
        display: none;

    }

    .table-pilares th:nth-child(5),
    .table-pilares td:nth-child(5) {
        display: none;

    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        background: #fff;
        margin-bottom: 12px;
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        border: 1px solid #80808030;

        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .table td {
        display: flex;
        align-items: center;
        padding: 12px 0;
        min-height: 35px;
    }

    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
    }

    .table td:not(.td-actions) {
        justify-content: space-between;
        gap: 10px;
    }

    .table td.td-actions {
        justify-content: flex-end;
        gap: 6px;
        width: 100%;
    }

    .td-actions {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
    }

    /* Label "Acciones" */
    .table td.td-actions::before {
        display: none;
    }

    .td-actions .btn {
        min-width: 36px;
        justify-content: center;
    }

    /* .badge {
        padding: 6px 10px;
        font-size: 11px;
    } */

    /* ocultar ID
    .table-beneficios td:nth-child(1),
    .table-beneficios th:nth-child(1) {
        display: none;
    } */

    /* ocultar Pilar */
    .table-beneficios td:nth-child(2),
    .table-beneficios th:nth-child(2) {
        display: none;
    }

    /* ocultar País */
    .table-beneficios td:nth-child(3),
    .table-beneficios th:nth-child(3) {
        display: none;
    }

    /* asegurar layout limpio */
    .table-beneficios tr {
        gap: 12px;
    }

    .hide-mobile {
        display: none !important;
    }

    .table-ubicaciones td:first-child {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
}

/* FORMULARIOS */