/* ==============================================================================
   SUNERA / eRAsolar Suite - Módulo de Gestión de Usuarios y Seguridad RBAC
   Estilos Pro-Elite (Dark Glassmorphism, Tonos Ámbar/Oro, Tipografía Outfit & Inter)
   ============================================================================== */

/* Tipografías */
.font-display {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #030712;
    background-image: 
        radial-gradient(at 10% 10%, rgba(245, 158, 11, 0.05) 0px, transparent 40%),
        radial-gradient(at 90% 90%, rgba(14, 165, 233, 0.04) 0px, transparent 40%);
}

/* 1. Botones Principales */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.82rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    border: 1px solid #f59e0b;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-create-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    border-radius: 0.85rem;
    font-weight: 800;
    font-size: 0.82rem;
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #0f172a;
    border: 1px solid rgba(253, 184, 19, 0.5);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-create-user:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.38);
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.95rem;
    border-radius: 0.85rem;
    font-weight: 600;
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 0.8);
    color: #94a3b8;
    border: 1px solid #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    color: #f8fafc;
    border-color: #334155;
    background: rgba(30, 41, 59, 0.8);
}

.btn-refresh:hover svg {
    transform: rotate(180deg);
}

.btn-refresh svg {
    transition: transform 0.4s ease;
}

/* 2. Tarjetas de Estadísticas */
.stat-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.4));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #94a3b8;
    line-height: 1.2;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
    margin-top: 0.15rem;
}

/* 3. Filtros y Pestañas */
.tab-filter {
    padding: 0.35rem 0.75rem;
    border-radius: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tab-filter:hover {
    color: #ffffff;
}

.tab-filter.active {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    font-weight: 700;
}

.tab-count {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 9999px;
}

/* 4. Tabla y Elementos de Fila */
tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.35);
}

.user-table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 0.8rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 0.5rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.module-chip {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.module-chip.superadmin-all {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    font-weight: 800;
}

/* 5. Switch Interactivo de Aprobación (Zero-Trust) */
.switch-approve-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.switch-approve-btn.approved {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.switch-approve-btn.approved:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.switch-approve-btn.pending {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.45);
    animation: pulseBorder 2s infinite;
}

.switch-approve-btn.pending:hover {
    background: rgba(34, 197, 94, 0.22);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.6);
}

@keyframes pulseBorder {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}

/* 6. Botones de Acción de Fila */
.row-action-btn {
    padding: 0.35rem;
    border-radius: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.15);
}

.row-action-btn.btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 7. Modal & Formularios */
.modal-close-btn {
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

/* Scrollbar ultra-fina, ergonómica y estilizada para los modales de seguridad */
.modal-custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.35) rgba(15, 23, 42, 0.6);
    overscroll-behavior: contain;
}

.modal-custom-scroll::-webkit-scrollbar {
    width: 6px;
}

.modal-custom-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
}

.modal-custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.6);
}

.module-check-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.15s ease;
}

.module-check-label:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
}

.check-box-icon {
    width: 28px;
    height: 28px;
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.check-box-icon svg {
    width: 15px;
    height: 15px;
}

.mod-checkbox, .new-mod-checkbox {
    width: 17px;
    height: 17px;
    accent-color: #f59e0b;
    cursor: pointer;
}

/* 8. Toast Notifications */
.toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.15rem;
    border-radius: 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success {
    background: #064e3b;
    color: #a7f3d0;
    border: 1px solid #059669;
}

.toast.error {
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid #dc2626;
}

.toast.info {
    background: #0c4a6e;
    color: #bae6fd;
    border: 1px solid #0284c7;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
