/* ============================================================================ */
/* 👥 SISTEMA DE USUARIOS REGISTRADOS - ESTILOS                                */
/* ============================================================================ */

/* 📦 Contenedor principal */
.usuarios-container {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 📊 Estadísticas rápidas */
.usuarios-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-usuarios {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-usuarios:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.stat-card-usuarios.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card-usuarios.mayoristas {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card-usuarios.minoristas {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card-usuarios.activos {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-icon-usuarios {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
}

.stat-info-usuarios h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.stat-info-usuarios p {
    font-size: 13px;
    opacity: 0.85;
    margin: 4px 0 0 0;
    font-weight: 500;
}

/* 🔍 Barra de filtros */
.usuarios-filtros {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: #1e293b;
    border-radius: 12px;
    border: 1px solid #334155;
}

.usuarios-search-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.usuarios-search-wrapper .search-icon-usr {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}

.usuarios-search {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 2px solid #475569;
    border-radius: 8px;
    font-size: 14px;
    background: #0f172a;
    color: #e2e8f0;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.usuarios-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.usuarios-search::placeholder {
    color: #94a3b8;
}

.usuarios-filtro-tipo {
    padding: 10px 16px;
    border: 2px solid #475569;
    border-radius: 8px;
    font-size: 14px;
    background: #0f172a;
    color: #e2e8f0;
    cursor: pointer;
    min-width: 160px;
    transition: all 0.2s ease;
}

.usuarios-filtro-tipo:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn-recargar-usuarios {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-recargar-usuarios:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

/* 📋 Tabla de usuarios */
.usuarios-tabla-container {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

.usuarios-tabla-wrapper {
    overflow-x: auto;
}

.usuarios-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.usuarios-tabla thead th {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #94a3b8;
    font-weight: 600;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid #334155;
    position: sticky;
    top: 0;
    z-index: 5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.usuarios-tabla tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    color: #e2e8f0;
    vertical-align: middle;
}

.usuarios-tabla tbody tr {
    transition: background 0.15s ease;
}

.usuarios-tabla tbody tr:hover {
    background: rgba(102, 126, 234, 0.08);
}

/* Columna Nombre */
.usuario-nombre {
    font-weight: 600;
    color: #f1f5f9;
}

/* Columna Email */
.usuario-email {
    color: #94a3b8;
    font-size: 13px;
}

/* Columna Teléfono */
.usuario-telefono {
    color: #cbd5e1;
}

/* Badges de tipo de cliente */
.badge-tipo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-tipo.mayorista {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-tipo.minorista {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Badge de estado */
.badge-estado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-estado.activo {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-estado.inactivo {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Fecha */
.usuario-fecha {
    color: #94a3b8;
    font-size: 13px;
    white-space: nowrap;
}

/* Selector de tipo de cliente */
.select-tipo-cliente {
    padding: 6px 10px;
    border: 2px solid #475569;
    border-radius: 6px;
    font-size: 13px;
    background: #0f172a;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.select-tipo-cliente:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.select-tipo-cliente.guardando {
    opacity: 0.6;
    pointer-events: none;
}

.select-tipo-cliente.exito {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.select-tipo-cliente.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Estado vacío */
.usuarios-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.usuarios-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.usuarios-empty h3 {
    color: #e2e8f0;
    margin: 0 0 8px 0;
    font-size: 18px;
}

.usuarios-empty p {
    margin: 0;
    font-size: 14px;
}

/* Estado de carga */
.usuarios-loading {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.usuarios-loading .loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin-usuarios 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin-usuarios {
    to {
        transform: rotate(360deg);
    }
}

.usuarios-loading p {
    margin: 0;
    font-size: 14px;
}

/* Contador de resultados */
.usuarios-contador {
    padding: 12px 16px;
    color: #94a3b8;
    font-size: 13px;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.usuarios-contador strong {
    color: #e2e8f0;
}

/* 📱 Responsive */
@media (max-width: 768px) {
    .usuarios-container {
        padding: 12px;
    }

    .usuarios-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card-usuarios {
        padding: 14px;
    }

    .stat-info-usuarios h3 {
        font-size: 22px;
    }

    .usuarios-filtros {
        flex-direction: column;
        padding: 12px;
    }

    .usuarios-search-wrapper {
        min-width: 100%;
    }

    .usuarios-filtro-tipo {
        width: 100%;
    }

    .btn-recargar-usuarios {
        width: 100%;
        justify-content: center;
    }

    .usuarios-tabla thead th,
    .usuarios-tabla tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .usuarios-stats {
        grid-template-columns: 1fr;
    }

    .stat-card-usuarios {
        padding: 12px;
    }

    .stat-icon-usuarios {
        font-size: 24px;
        width: 40px;
        height: 40px;
    }

    .stat-info-usuarios h3 {
        font-size: 20px;
    }
}