/* ============================================================
   COMPONENTS - Plenus Access
   Botones, badges, alerts, switches y utilidades reutilizables
   ============================================================ */

/* ============================================================
   BOTONES (v2 - más modernos)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem 1.65rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s cubic-bezier(.4, 0, .2, 1),
                box-shadow .22s ease,
                background .22s ease,
                color .18s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* -------- Primario -------- */
.btn-primary {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 100, 167, .32);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 100, 167, .42);
    color: #fff;
}

/* -------- Acento (celeste) -------- */
.btn-accent {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-secondary) 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 180, 233, .32);
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(47, 180, 233, .42);
    color: #fff;
}

/* -------- Ghost -------- */
.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--color-border);
    color: var(--color-primary);
}
.btn-ghost:hover {
    background: #F8FAFC;
    border-color: var(--color-accent);
    color: var(--color-secondary);
    transform: translateY(-1px);
}

/* -------- Peligro -------- */
.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, #a00711 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(220, 8, 20, .3);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(220, 8, 20, .4);
    color: #fff;
}

/* -------- Tamaños -------- */
.btn-sm {
    padding: .55rem 1.1rem;
    font-size: .85rem;
    border-radius: 10px;
}
.btn-lg {
    padding: 1.05rem 2.1rem;
    font-size: 1.05rem;
    border-radius: 14px;
}
.btn-block { width: 100%; }

/* -------- Efecto shimmer al hover -------- */
.btn-primary::after,
.btn-accent::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
    transition: left .55s ease;
}
.btn-primary:hover::after,
.btn-accent:hover::after { left: 100%; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .015em;
    white-space: nowrap;
    line-height: 1.3;
}

.badge-success { background: #ECFDF5; color: #047857; }
.badge-muted   { background: #F3F4F6; color: #6B7280; }
.badge-info    { background: #EFF6FF; color: var(--color-primary); }
.badge-accent  { background: #E0F2FE; color: #0369A1; }
.badge-danger  { background: #FEF2F2; color: var(--color-danger); }
.badge-warn    { background: #FEF3C7; color: #B45309; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: .95rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}
.alert-success { background: #ECFDF5; color: #065F46; border-color: #10B981; }
.alert-error   { background: #FEF2F2; color: #991B1B; border-color: var(--color-danger); }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-color: var(--color-secondary); }
.alert-warn    { background: #FEF3C7; color: #92400E; border-color: #F59E0B; }

/* ============================================================
   SWITCH
   ============================================================ */
.switch {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    cursor: pointer;
    user-select: none;
    font-size: .9rem;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: relative;
    width: 42px;
    height: 24px;
    background: #CBD5E1;
    border-radius: 999px;
    transition: background .25s;
    flex-shrink: 0;
}
.switch-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
}
.switch input:checked + .switch-slider::after { transform: translateX(18px); }

.switch-mini .switch-slider { width: 38px; height: 22px; }
.switch-mini .switch-slider::after { width: 16px; height: 16px; }
.switch-mini input:checked + .switch-slider::after { transform: translateX(16px); }

/* ============================================================
   PLENUS LOADER - Spinner global de pantalla completa
   ============================================================ */
.plenus-loader {
    position: fixed;
    inset: 0;
    background: rgba(0, 20, 40, .58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
    pointer-events: none;
}

.plenus-loader.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.plenus-loader-spinner {
    width: 58px;
    height: 58px;
    position: relative;
}

.plenus-loader-spinner::before,
.plenus-loader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.plenus-loader-spinner::before {
    inset: 0;
    border: 4px solid rgba(255, 255, 255, .15);
}

.plenus-loader-spinner::after {
    inset: 0;
    border: 4px solid transparent;
    border-top-color: var(--color-accent, #2FB4E9);
    border-right-color: var(--color-accent, #2FB4E9);
    animation: plenusSpin .85s cubic-bezier(.5, 0, .5, 1) infinite;
}

@keyframes plenusSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.plenus-loader-text {
    color: #fff;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: .92rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    text-align: center;
    padding: 0 1rem;
    max-width: 320px;
}

/* Botón con estado "loading" */
.btn.is-loading {
    pointer-events: none;
    opacity: .85;
}

.btn.is-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: plenusSpin .7s linear infinite;
    margin-right: .5rem;
}