/**
 * Componentes reutilizables globales (botón glass, badges, caja de icono, avatar).
 * Cargado en todas las páginas vía principio_web().
 * Uso: .btn-glass, .badge-role, .icon-block + variantes, .card-avatar + variantes.
 */

/* ── Caja de icono (base común: hero-top-icon, hero-body-icon, stat-dot) ── */
.icon-block {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(51, 65, 85, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(198, 198, 198, 0.1);
}

.icon-block .material-symbols-outlined {
    font-size: 22px !important;
}

/* Tamaños */
.icon-block--lg {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    box-shadow: 0 6px 15px rgba(139, 29, 29, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.icon-block--lg .material-symbols-outlined { font-size: 26px !important; }

.icon-block--md {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    box-shadow: 0 6px 15px rgba(139, 29, 29, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.icon-block--md .material-symbols-outlined { font-size: 22px !important; }

.icon-block--sm {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.icon-block--sm .material-symbols-outlined { font-size: 22px !important; }

/* Colores */
.icon-block--primary {
    background: rgba(255, 155, 155, 0.11);
    border-color: rgba(139, 29, 29, 0.04);
}
.icon-block--primary .material-symbols-outlined { color: var(--primary-color, #8B1D1D) !important; }

.icon-block--neutral {
    background: rgba(51, 65, 85, 0.1);
    color: #334155;
    box-shadow: 0 4px 10px rgba(51, 65, 85, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(198, 198, 198, 0.1);
}
.icon-block--neutral .material-symbols-outlined { color: #334155 !important; }

/* Icono de información (tooltips, ayudas) */
.tooltip_incoterm .material-symbols-outlined
{
    font-size: 20px !important;
    color: #2196F3 !important;
}

/* ── Avatar de tarjeta (iniciales o icono) ── */
.card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.card-avatar--admin {
    background: rgba(21, 101, 192, 0.1);
    color: #1565C0;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(183, 193, 205, 0.1);
}

.card-avatar--user {
    background: rgba(120, 144, 156, 0.1);
    color: #607d8b;
    box-shadow: 0 4px 10px rgba(120, 144, 156, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(170, 179, 183, 0.1);
}

/* ── Botón glass ── */
.btn-glass {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    color: #1e293b;
    background: rgb(158 158 158 / 5%);
    border: 1px solid rgba(139, 29, 29, 0.04);
    box-shadow:
        0 6px 15px rgba(139, 29, 29, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    color: var(--primary-color, #8B1D1D);
    background: rgba(255, 155, 155, 0.11);
    box-shadow:
        0 6px 15px rgba(139, 29, 29, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(139, 29, 29, 0.04);
    transform: scale(1.02);
}

.btn-glass .material-symbols-outlined {
    font-size: 15px !important;
    color: inherit !important;
}

.btn-glass:hover .material-symbols-outlined {
    color: var(--primary-color, #8B1D1D) !important;
}

.btn-back {
    padding: 10px 22px;
}

.btn-table {
    padding: 8px 16px;
}
.btn-table .material-symbols-outlined {
    font-size: 15px !important;
}

/* ── Botón primary glass (acción principal: añadir, nuevo, etc.) ── */
.btn-glass-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border-radius: 50px;
    padding: 8px 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    color: #fff !important;
    background: rgba(139, 29, 29, 0.85);
    border: 1px solid rgba(139, 29, 29, 0.5);
    box-shadow:
        0 6px 20px rgba(139, 29, 29, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-glass-primary:hover {
    color: #fff !important;
    background: rgba(115, 20, 20, 0.95);
    border-color: rgba(115, 20, 20, 0.6);
    box-shadow:
        0 6px 24px rgba(139, 29, 29, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.btn-glass-primary .material-symbols-outlined,
.btn-glass-primary [data-icon] {
    color: #fff !important;
    font-size: 15px !important;
}

.btn-glass-gray {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border-radius: 50px;
    padding: 8px 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    color: #fff !important;
    background: rgba(120, 120, 120, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-glass-gray:hover {
    color: #fff !important;
    background: rgba(90, 90, 90, 0.85);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translateY(-2px) scale(1.02);
}

/* ── Botón exportar (liquid glass, variante verde) ── */
.btn-glass-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(56, 142, 60, 0.85);
    border: 1px solid rgba(56, 142, 60, 0.5);
    box-shadow:
        0 6px 20px rgba(56, 142, 60, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-glass-export:hover {
    background: rgba(41, 104, 44, 0.95);
    border-color: rgba(41, 104, 44, 0.6);
    box-shadow:
        0 6px 24px rgba(56, 142, 60, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.btn-glass-export [data-icon],
.btn-glass-export .material-symbols-outlined {
    color: #fff !important;
}

/* ── Pie de listado: total de resultados + acciones ── */
.listado-pie {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 12px 0 0;
    padding: 12px 0 4px;
}

.listado-total {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.listado-total-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.listado-total-num {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

/* SweetAlert: botón confirm con estilo glass (reutiliza .btn-glass) */
.swal2-confirm.btn-glass {
    background: rgb(158 158 158 / 5%) !important;
    color: #1e293b !important;
    border: 1px solid rgba(139, 29, 29, 0.04) !important;
    box-shadow: 0 6px 15px rgba(139, 29, 29, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}
.swal2-confirm.btn-glass:hover {
    color: var(--primary-color, #8B1D1D) !important;
    background: rgba(255, 155, 155, 0.11) !important;
    transform: scale(1.02);
}

/* ── Badges de rol ── */
.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.badge-role .material-symbols-outlined { font-size: 13px !important; }

.badge-admin {
    background: rgba(21, 101, 192, 0.08);
    color: #1565C0;
}
.badge-admin .material-symbols-outlined { color: #1565C0 !important; }

.badge-user {
    background: rgba(120,144,156,0.1);
    color: #607D8B;
}
.badge-user .material-symbols-outlined { color: #607D8B !important; }

.badge-you {
    background: rgba(56,142,60,0.08);
    color: #388E3C;
    margin-left: 4px;
}
.badge-you .material-symbols-outlined { color: #388E3C !important; }

.badge-login {
    background: rgba(0,0,0,0.04);
    color: #999;
}
.badge-login .material-symbols-outlined { color: #999 !important; }

/* ── Listado de cliente ── */

.listado-card {
    padding: 16px 8px 12px;
}

.listado-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.listado-header h1 {
    margin: 0 !important;
    font-weight: 550;
}

/* Header en columna: título, luego leyenda, luego botones (ej. listado tasación) */
.listado-header--column {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

/* ── Leyenda de listado (glass, se abre debajo del botón) ── */
.listado-leyenda--collapsed {
    display: none !important;
}

.listado-leyenda {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    max-width: 100%;
    box-sizing: border-box;
}

.listado-leyenda #leyenda {
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    width: auto;
}

.listado-leyenda #leyenda tr {
    display: contents;
}

.listado-leyenda .leyenda-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    vertical-align: middle;
}

.listado-leyenda .leyenda-marker {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

.listado-leyenda .leyenda-item--checkbox .leyenda-marker.l-peso-volumen {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 14px solid red;
    border-radius: 0;
}

.listado-leyenda .leyenda-item--checkbox .leyenda-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    cursor: pointer;
}

.listado-leyenda .leyenda-item--checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.listado-botones {
    display: flex;
    align-items: center;
    gap: 10px;
}

.listado-botones .enlace_boton {
    float: none;
    margin-bottom: 0;
}

.listado-table-wrap {
    overflow: auto;
    min-height: 320px;
    border: 1px solid #e9e9e9;
    border-radius: 6px;
}

.listado-card table#tablas {
    display: block;
    overflow-y: auto;
    height: 520px;
    margin: 0px;
}

input[disabled], button[disabled], select[disabled], a[disabled] {
    cursor: not-allowed;
    opacity: 1;
}

/* Estilo para centrar elementos en el td de iconos */
td.td-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Icono en celda con input (checkbox, etc.) alineado con el input. */
td.cell-input-icon {
    vertical-align: middle;
    padding: 2px 8px;
}

.cell-input-icon-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
}

.cell-input-icon-inner a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

td.td-icons a {
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 24px !important;
}

/* ═══ Alert modal glass override ═══ */
#overlay {
    background: rgba(15, 15, 20, 0.45) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
#alertModalOuter {
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
#alertModal {
    background: rgba(255, 255, 255, 0.75) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 1px rgba(255, 255, 255, 0.8) !important;
    padding: 32px 36px 28px !important;
    width: auto !important;
    min-width: 380px;
    max-width: 480px;
}
#alert {
    text-align: center;
}
.alert-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.alert-icon--warn {
    background: rgba(255, 152, 0, 0.1);
}
.alert-icon--warn .material-symbols-outlined {
    font-size: 28px !important;
    color: #e65100 !important;
}
.alert-icon--danger {
    background: rgba(198, 40, 40, 0.08);
}
.alert-icon--danger .material-symbols-outlined {
    font-size: 28px !important;
    color: #c62828 !important;
}
.alert-icon--error {
    background: rgba(198, 40, 40, 0.08);
}
.alert-icon--error .material-symbols-outlined {
    font-size: 28px !important;
    color: #c62828 !important;
}
.alert-icon--info {
    background: rgba(33, 150, 243, 0.08);
}
.alert-icon--info .material-symbols-outlined {
    font-size: 28px !important;
    color: #1565c0 !important;
}
.alert-icon--neutral {
    background: rgba(100, 116, 139, 0.08);
}
.alert-icon--neutral .material-symbols-outlined {
    font-size: 28px !important;
    color: #546e7a !important;
}
.alert-title {
    display: block !important;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
}
.alert-desc {
    display: block !important;
    font-size: 13px;
    color: #777;
    margin: 0;
    line-height: 1.5;
}
.alert-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

/* ═══ Inline message banners (ok / error / aviso) ═══ */
#ok, #error, #aviso {
    float: none !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: auto !important;
    padding: 12px 18px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin: 12px 0 !important;
    line-height: 1.4;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
#ok .material-symbols-outlined,
#error .material-symbols-outlined,
#aviso .material-symbols-outlined {
    font-size: 20px !important;
    flex-shrink: 0;
}
#ok {
    color: #2e7d32 !important;
    background: rgba(56, 142, 60, 0.08) !important;
    border: 1px solid rgba(56, 142, 60, 0.15) !important;
    box-shadow: 0 2px 8px rgba(56, 142, 60, 0.06);
}
#ok .material-symbols-outlined {
    color: #43a047 !important;
}
#error {
    color: #c62828 !important;
    background: rgba(198, 40, 40, 0.06) !important;
    border: 1px solid rgba(198, 40, 40, 0.12) !important;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.05);
}
#error .material-symbols-outlined {
    color: #e53935 !important;
}
#aviso {
    color: #1565c0 !important;
    background: rgba(33, 150, 243, 0.06) !important;
    border: 1px solid rgba(33, 150, 243, 0.12) !important;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.05);
}
#aviso .material-symbols-outlined {
    color: #1e88e5 !important;
}

/* ── Panel Gestionar columnas (campos_listado) ── */
#campos_listado {
    display: none;
    position: absolute;
    z-index: 99999;
    padding: 0;
    width: max-content;
    min-width: 180px;
    max-width: 240px;
    max-height: 250px;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

#campos_listado table {
    width: 100%;
    min-width: 0;
    border: none;
    border-collapse: collapse;
    table-layout: fixed;
}

#campos_listado td {
    padding: 8px 14px;
    font-size: 13px;
    color: #334155;
    border: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#campos_listado tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

#campos_listado tr:hover td {
    background: rgba(0, 0, 0, 0.07);
}

#campos_listado .columnas_lista {
    margin-right: 8px;
    vertical-align: middle;
}

#campos_listado .material-symbols-outlined {
    font-size: 16px !important;
    vertical-align: middle;
    margin-right: 4px;
}