/**
 * Enhanced User Management Styles
 * Styles for advanced user management features
 */

/* ===== BULK OPERATIONS PANEL ===== */
.bulk-operations-panel {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  margin: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: slideDown 0.3s ease;
}

.bulk-operations-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #e9ecef;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0.5rem 0.5rem 0 0;
}

.bulk-operations-header h5 {
  margin: 0;
  color: #495057;
}

.selected-count {
  font-weight: 600;
  color: #007bff;
}

.bulk-operations-content {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.bulk-operation-group {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  padding: 1rem;
}

.bulk-operation-group h6 {
  margin: 0 0 0.75rem 0;
  color: #495057;
  font-size: 0.875rem;
  font-weight: 600;
}

.role-assignment-controls,
.permission-template-controls {
  display: flex;
  gap: 0.5rem;
}

.role-assignment-controls select,
.permission-template-controls select {
  flex: 1;
}

.bulk-operation-progress {
  padding: 1rem;
  border-top: 1px solid #dee2e6;
}

.progress {
  height: 0.5rem;
  background-color: #e9ecef;
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 100%;
  background-color: #007bff;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: #6c757d;
}

/* ===== USER PROFILE MODAL ===== */
.profile-modal {
  z-index: 1060;
}

.profile-modal-content {
  max-width: 800px;
  width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.user-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  font-size: 3rem;
  color: #6c757d;
}

.user-info h3 {
  margin: 0;
  color: #495057;
}

.user-info p {
  margin: 0.25rem 0;
  color: #6c757d;
}

.profile-tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 1rem;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: #007bff;
  background-color: #f8f9fa;
}

.tab-btn.active {
  color: #007bff;
  border-bottom-color: #007bff;
  background-color: #f8f9fa;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Profile Tab */
.profile-form {
  max-height: 400px;
  overflow-y: auto;
}

.form-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section h5 {
  color: #495057;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Security Tab */
.security-settings {
  max-height: 400px;
  overflow-y: auto;
}

.security-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.security-section:last-child {
  border-bottom: none;
}

.security-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.security-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.25rem;
}

.option-info {
  flex: 1;
}

.option-info strong {
  display: block;
  color: #495057;
  margin-bottom: 0.25rem;
}

.option-info p {
  margin: 0;
  color: #6c757d;
  font-size: 0.875rem;
}

.option-control {
  flex-shrink: 0;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #007bff;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.login-stats {
  background: #f8f9fa;
  border-radius: 0.25rem;
  padding: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.stat-item:last-child {
  margin-bottom: 0;
}

.stat-label {
  color: #6c757d;
  font-weight: 500;
}

.stat-value {
  color: #495057;
  font-weight: 600;
}

.security-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Permissions Tab */
.permissions-overview {
  max-height: 400px;
  overflow-y: auto;
}

.permission-category {
  margin-bottom: 1.5rem;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
}

.permission-category h6 {
  background: #f8f9fa;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
  color: #495057;
}

.permission-list {
  padding: 0.5rem;
}

.permission-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.permission-item:hover {
  background-color: #f8f9fa;
}

.permission-item.granted {
  background-color: #d4edda;
}

.permission-item.denied {
  background-color: #f8d7da;
}

.permission-info {
  flex: 1;
}

.permission-name {
  display: block;
  font-weight: 500;
  color: #495057;
}

.permission-description {
  color: #6c757d;
  font-size: 0.875rem;
}

.permission-status {
  flex-shrink: 0;
  margin-left: 1rem;
}

.permission-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 0.5rem;
}

/* Activity Tab */
.activity-summary {
  margin-bottom: 2rem;
}

.activity-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.stat-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  font-size: 1.5rem;
  color: #007bff;
}

.stat-info {
  flex: 1;
}

.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #495057;
}

.stat-label {
  color: #6c757d;
  font-size: 0.875rem;
}

.activity-timeline {
  max-height: 300px;
  overflow-y: auto;
}

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e9ecef;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  background: #007bff;
  border: 3px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
}

.timeline-content {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  padding: 0.75rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-weight: 600;
  color: #495057;
}

.timeline-time {
  color: #6c757d;
  font-size: 0.875rem;
}

.timeline-details {
  color: #6c757d;
  font-size: 0.875rem;
}

/* Onboarding Tab */
.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.progress-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-circle {
  width: 4rem;
  height: 4rem;
  border: 4px solid #e9ecef;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-percentage {
  font-weight: 700;
  color: #495057;
  font-size: 0.875rem;
}

.progress-info {
  display: flex;
  flex-direction: column;
}

.onboarding-steps {
  max-height: 350px;
  overflow-y: auto;
}

.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  position: relative;
}

.onboarding-step.completed {
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.onboarding-step.required::after {
  content: "*";
  color: #dc3545;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1.25rem;
}

.step-marker {
  width: 2rem;
  height: 2rem;
  border: 2px solid #6c757d;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.onboarding-step.completed .step-marker {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

.step-number {
  font-weight: 600;
  font-size: 0.875rem;
}

.step-content {
  flex: 1;
}

.step-content h6 {
  margin: 0 0 0.5rem 0;
  color: #495057;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== BULK EMAIL MODAL ===== */
.recipient-list {
  max-height: 100px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  padding: 0.5rem;
  background-color: #f8f9fa;
}

.recipient-tag {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin: 0.125rem;
  font-size: 0.875rem;
}

/* ===== NOTIFICATIONS ===== */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  color: white;
  font-weight: 500;
  z-index: 1070;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  min-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification.success {
  background-color: #28a745;
}

.notification.error {
  background-color: #dc3545;
}

.notification.warning {
  background-color: #ffc107;
  color: #212529;
}

.notification.info {
  background-color: #007bff;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6c757d;
}

.loading-spinner::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid #e9ecef;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .bulk-operations-content {
    grid-template-columns: 1fr;
  }

  .profile-modal-content {
    width: 95vw;
    margin: 1rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .activity-stats {
    grid-template-columns: 1fr;
  }

  .user-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-tabs {
    flex-direction: column;
  }

  .tab-btn {
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .tab-btn.active {
    border-left-color: #007bff;
    border-bottom-color: transparent;
  }

  .security-option {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .option-control {
    align-self: flex-start;
  }

  .step-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .notification {
    right: 10px;
    left: 10px;
    min-width: auto;
  }

  .timeline {
    padding-left: 1rem;
  }

  .timeline-marker {
    left: -1.25rem;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* ===== ACCESSIBILITY ===== */
.tab-btn:focus,
.btn:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.switch input:focus + .slider {
  box-shadow: 0 0 1px #007bff;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bulk-operations-panel {
    border: 2px solid #000;
  }

  .permission-item.granted {
    background-color: #90ee90;
    border: 1px solid #000;
  }

  .permission-item.denied {
    background-color: #ffb6c1;
    border: 1px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .notification,
  .tab-content,
  .bulk-operations-panel {
    animation: none;
    transition: none;
  }

  .progress-bar {
    transition: none;
  }
}

.policies-container {
  display: flex;
  gap: 2rem;
}

.policy-list-container {
  flex: 1;
}

.policy-editor-container {
  flex: 2;
}

.policy-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  overflow: hidden;
}

.policy-list li {
  padding: 1rem;
  cursor: pointer;
  border-bottom: 1px solid #ddd;
}

.policy-list li:last-child {
  border-bottom: none;
}

.policy-list li:hover {
  background-color: #f5f5f5;
}

.policy-list li.active {
  background-color: #e0e7ff;
  font-weight: bold;
}

#policy-editor-form .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

#policy-editor-form .checkbox-group {
  margin-top: 1rem;
}

#policy-editor-form .form-actions {
  margin-top: 1.5rem;
}
