/* ==========================================================================
   GESTIÓN DE USUARIOS - Admin Dashboard
   ========================================================================== */

/* Users Stats Badges */
.users-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f5f7fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
}

.stat-badge i {
    font-size: 1.1rem;
}

.stat-badge strong {
    color: #1a1a1a;
    font-weight: 600;
}

.stat-badge.stat-admin {
    background: #e3f8ff;
    color: #1c66a4;
}

.stat-badge.stat-admin strong {
    color: #1c66a4;
}

.stat-badge.stat-active {
    background: #dcfce7;
    color: #16a34a;
}

.stat-badge.stat-active strong {
    color: #16a34a;
}

/* Users Filters */
.users-filters {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #e1e4e8;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--color-principal);
    box-shadow: 0 0 0 3px rgba(var(--color-principal-rgb, 51, 55, 219), 0.1);
}

.filter-select {
    padding: 10px 16px;
    border: 1.5px solid #e1e4e8;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    background: white;
    min-width: 150px;
    transition: all 0.3s;
}

.filter-select:focus {
    border-color: var(--color-principal);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: 1.5px solid #e1e4e8;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--color-principal);
    color: white;
    border-color: var(--color-principal);
    transform: rotate(180deg);
}

/* Users Table */
.users-table {
    width: 100%;
}

.users-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    vertical-align: middle;
}

/* User Info Cell */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-principal) 0%, #0a0c97 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.user-email {
    font-size: 0.85rem;
    color: #666;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.role-admin {
    background: #fee2e2;
    color: #dc2626;
}

.role-badge.role-author {
    background: #e3f8ff;
    color: #1c66a4;
}

.role-badge.role-user {
    background: #f3f4f6;
    color: #666;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.status-active {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.status-inactive {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge i {
    font-size: 0.75rem;
}

/* Date Cell */
.date-cell {
    font-size: 0.85rem;
    color: #666;
}

.date-cell .date-relative {
    display: block;
    font-weight: 600;
    color: #1a1a1a;
}

.date-cell .date-absolute {
    display: block;
    font-size: 0.75rem;
    color: #999;
}

/* Action Buttons */
.user-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-action.btn-role {
    background: #e3f8ff;
    color: #1c66a4;
}

.btn-action.btn-role:hover:not(:disabled) {
    background: #1c66a4;
    color: white;
}

.btn-action.btn-deactivate {
    background: #fee2e2;
    color: #dc2626;
}

.btn-action.btn-deactivate:hover:not(:disabled) {
    background: #dc2626;
    color: white;
}

.btn-action.btn-activate {
    background: #dcfce7;
    color: #16a34a;
}

.btn-action.btn-activate:hover:not(:disabled) {
    background: #16a34a;
    color: white;
}

/* Loading Row */
.loading-row {
    text-align: center !important;
    padding: 40px !important;
    color: #666;
}

.loading-row i {
    font-size: 1.5rem;
    margin-right: 10px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.empty-state p {
    color: #999;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-sm {
    max-width: 400px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e1e4e8;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #e1e4e8;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.modal-body .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e1e4e8;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.modal-body .form-control:focus {
    border-color: var(--color-principal);
    box-shadow: 0 0 0 3px rgba(var(--color-principal-rgb, 51, 55, 219), 0.1);
}

.warning-text {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #856404;
    margin-top: 15px;
}

.warning-text i {
    margin-right: 8px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px;
    border-top: 1px solid #e1e4e8;
}

/* Responsive */
@media (max-width: 1200px) {
    .users-stats {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .users-filters .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .users-table {
        font-size: 0.85rem;
    }

    .users-table th:nth-child(3),
    .users-table td:nth-child(3),
    .users-table th:nth-child(6),
    .users-table td:nth-child(6),
    .users-table th:nth-child(7),
    .users-table td:nth-child(7) {
        display: none;
    }

    .user-actions {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .users-filters,
[data-theme="dark"] .modal-content {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .btn-icon,
[data-theme="dark"] .modal-body .form-control {
    background: #222;
    border-color: #333;
    color: white;
}

[data-theme="dark"] .stat-badge {
    background: #222;
    color: #999;
}

[data-theme="dark"] .stat-badge strong {
    color: white;
}

[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .user-name,
[data-theme="dark"] .date-relative {
    color: white;
}

[data-theme="dark"] .modal-close {
    background: #333;
}

[data-theme="dark"] .modal-close:hover {
    background: #444;
}
