/**
 * Feature Config Admin UI - Light Theme with Purple Accent
 * Inspired by Optimizely's clean, minimal design
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-elevated: #ffffff;
  
  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #525252;
  --text-muted: #a3a3a3;
  
  /* Purple Brand Colors */
  --accent-primary: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-light: #f3e8ff;
  --accent-border: #c4b5fd;
  
  /* Status Colors */
  --success: #10b981;
  --success-bg: #d1fae5;
  --success-border: #6ee7b7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --error-border: #fca5a5;
  
  /* Borders & Shadows */
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Layout */
#app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  height: 32px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-info {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.user-info strong {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  flex: 1;
  overflow-y: auto;
  height: 100vh;
}

/* Badges */
.badge {
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge.admin {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.badge.editor {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge.viewer {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Alternative badge naming convention */
.badge-admin {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.badge-editor {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-viewer {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s;
  border-radius: 8px;
  margin-bottom: 0.25rem;
}

.nav-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

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

.page-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px 0 rgba(139, 92, 246, 0.3);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: #059669;
}

.btn-small {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr {
  transition: background-color 0.15s;
}

.table tbody tr:hover {
  background: var(--bg-secondary);
}

.table tr:last-child td {
  border-bottom: none;
}

.table td strong {
  color: var(--text-primary);
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  white-space: nowrap;
  vertical-align: middle;
}

/* Fix table cell alignment for actions column */
.table td.table-actions {
  vertical-align: middle;
}

/* Hamburger Menu (Kebab Menu) */
.hamburger-menu {
  position: relative;
  display: inline-block;
}

.hamburger-trigger {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.hamburger-trigger:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.hamburger-trigger:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.hamburger-trigger i {
  font-size: 1rem;
  font-weight: 400;
}

.hamburger-dropdown {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.hamburger-menu.active .hamburger-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hamburger-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.hamburger-item:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

.hamburger-item:first-child {
  border-radius: 8px 8px 0 0;
}

.hamburger-item:hover {
  background: var(--bg-secondary);
}

.hamburger-item.danger {
  color: var(--error);
}

.hamburger-item.danger:hover {
  background: var(--error-bg);
}

/* Clickable table rows */
.table-row-clickable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.table-row-clickable:hover {
  background: var(--bg-secondary);
}

.table-row-clickable:active {
  background: var(--bg-tertiary);
}

/* Forms */
.form-group {
  margin-bottom: 1.75rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 500;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.modal-body {
  padding: 0;
}

.modal-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
}

.help-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.error-message {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--error);
  line-height: 1.4;
}

.modal-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
}

/* Alerts */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
}

/* Alert styles are now handled by the branding system */

/* Loading */
.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Status Indicators */
.status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status.online {
  background: var(--success);
}

.status.offline {
  background: var(--text-muted);
}

.status.error {
  background: var(--error);
}

/* Utility Classes */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small { font-size: 0.8125rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.flex-gap { gap: 1rem; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Dashboard Stats Cards - Flexbox for horizontal layout */
.dashboard-stats-grid {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.75rem !important;
  margin-bottom: 2rem !important;
  width: 100% !important;
}

.dashboard-stats-grid .card {
  flex: 1 !important;
  min-width: 0 !important;
  padding: 1rem 0.75rem !important;
  text-align: center !important;
}

@media (max-width: 1400px) {
  .dashboard-stats-grid {
    gap: 0.5rem !important;
  }
  .dashboard-stats-grid .card {
    padding: 0.75rem 0.5rem !important;
  }
}

@media (max-width: 1200px) {
  .dashboard-stats-grid {
    flex-wrap: wrap !important;
  }
  .dashboard-stats-grid .card {
    flex: 1 1 calc(33.333% - 0.67rem) !important;
    padding: 1rem !important;
  }
}

@media (max-width: 768px) {
  .dashboard-stats-grid .card {
    flex: 1 1 calc(50% - 0.5rem) !important;
  }
}

@media (max-width: 480px) {
  .dashboard-stats-grid {
    flex-direction: column !important;
  }
  .dashboard-stats-grid .card {
    flex: 1 1 100% !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .main-content {
    margin-left: 0;
    height: auto;
  }
  
  #app {
    flex-direction: column;
    height: auto;
  }
  
  .container {
    padding: 1rem;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .page-header h2 {
    font-size: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }
  
  /* Compact 2FA Modal */
  #mandatory2FAModal .modal-content {
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  #mandatory2FAModal .modal-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
  }
  
  /* Regular 2FA Verification Modal - Reduced Padding */
  #twofaModal .modal-content {
    padding: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  #twofaModal .modal-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .card {
    padding: 1.25rem;
  }
}

/* Code & Pre */
code {
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  color: var(--accent-primary);
}

pre {
  background: #1e1e1e;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: #d4d4d4;
  border: 1px solid #333;
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Syntax highlighting colors for code blocks */
.help-section pre {
  background: #1e1e1e;
  color: #d4d4d4;
  line-height: 1.5;
}

.help-section pre code {
  color: #d4d4d4;
}

/* JSON Editor textarea styling */
textarea.form-textarea[style*="monospace"] {
  tab-size: 2;
}

/* Selection */
::selection {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Help Page Styles */
.help-container {
  display: flex;
  height: calc(100vh - 4rem);
  gap: 0;
  overflow: hidden;
}

.help-nav {
  width: 280px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.help-nav-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.help-nav-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.help-nav-content {
  padding: 1rem;
}

.help-nav-section {
  margin-bottom: 0.5rem;
}

.help-nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.help-nav-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.help-nav-link.active {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.help-nav-toggle {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  background: none;
  border: none;
  text-align: left;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.help-nav-toggle::after {
  content: '›';
  position: absolute;
  right: 1rem;
  transition: transform 0.2s;
  font-size: 1.2rem;
}

.help-nav-toggle.active::after {
  transform: rotate(90deg);
}

.help-nav-toggle:hover {
  background: var(--bg-secondary);
}

.help-nav-toggle.active {
  background: var(--bg-secondary);
  color: var(--accent-primary);
}

.help-nav-subsection {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding-left: 0.5rem;
}

.help-nav-subsection.expanded {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

.help-nav-subsection .help-nav-link {
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
}

.help-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-secondary);
}

.help-content-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.help-content-inner h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.help-intro {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  line-height: 1.6;
}

.help-section {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.help-section h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.help-section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.help-section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.help-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.help-section ul,
.help-section ol {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.help-section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Responsive Design for Help Page */
@media (max-width: 768px) {
  .help-container {
    flex-direction: column;
  }
  
  .help-nav {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .help-content-inner {
    padding: 1rem;
  }
  
  .help-content-inner h1 {
    font-size: 2rem;
  }
}

/* ============================================================================
   USER PROFILE & 2FA STYLES
   ============================================================================ */

.profile-section {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-section h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.info-item label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.info-value {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* 2FA Status Card */
.twofa-status-card {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  background: var(--bg-secondary);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.status-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.status-badge.enabled {
  background: var(--success-bg);
  color: var(--success);
  border: 2px solid var(--success-border);
}

.status-badge.disabled {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.status-detail {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.warning-text {
  color: var(--warning);
  font-weight: 500;
  margin: 0.5rem 0;
}

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

/* Trusted Devices List */
.devices-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.device-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  transition: all 0.2s;
}

.device-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
}

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

.device-icon {
  font-size: 2rem;
}

.device-details {
  flex: 1;
}

.device-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.device-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Recent Activity Table Styling */

.activity-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.activity-table th,
.activity-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.activity-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.activity-table tbody tr {
  transition: background-color 0.15s;
}

.activity-table tbody tr:hover {
  background: var(--bg-secondary);
}

.activity-table tr:last-child td {
  border-bottom: none;
}

.activity-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
}

.activity-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.2;
}

.activity-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.activity-user {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.activity-site {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.activity-env {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.activity-time {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* 2FA Setup Modal Styles */
.twofa-setup-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.method-card {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-primary);
}

.method-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
  transform: translateY(-2px);
}

.method-card.recommended {
  border-color: var(--accent-primary);
  background: var(--accent-light);
}

.method-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.method-card h5 {
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.method-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 1rem;
}

.method-card .badge {
  background: var(--accent-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  margin: 0.5rem 0;
  display: inline-block;
}

/* TOTP Setup Styles */
.totp-setup .setup-steps {
  text-align: left;
  line-height: 1.8;
}

.totp-setup .setup-steps li {
  margin-bottom: 1.5rem;
}

.qr-code-container {
  text-align: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  margin: 1rem 0;
  border: 2px solid var(--border-color);
}

.qr-code {
  max-width: 200px;
  width: 100%;
  height: auto;
}

.manual-code {
  font-family: 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.2rem;
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
  margin: 1rem 0;
}

.code-input {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  text-align: center;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  display: block;
}

.code-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.code-input-group {
  margin: 1rem 0;
}

/* 6-digit code boxes */
.code-boxes {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
}

.code-box {
  width: 3rem;
  height: 3.5rem;
  font-family: 'Courier New', monospace;
  font-size: 1.75rem;
  font-weight: bold;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  transition: all 0.2s ease;
}

.code-box:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  transform: scale(1.05);
}

.code-box:not(:placeholder-shown) {
  border-color: var(--success);
  background: var(--success-bg);
}

.warning-box {
  background: var(--warning-bg);
  border: 2px solid var(--warning-border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  color: var(--warning);
  text-align: center;
  font-weight: 500;
}

.error-message {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

/* Stats Grid for Admin 2FA Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Enforcement Control */
.enforcement-control {
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.toggle-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filters select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
}

.filters select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Badge variants */
.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Button sizes */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
  .profile-info-grid {
    grid-template-columns: 1fr;
  }
  
  .twofa-setup-choice {
    grid-template-columns: 1fr;
  }
  
  .status-row {
    flex-direction: column;
    gap: 1rem;
  }
  
  .status-actions {
    width: 100%;
  }
  
  .status-actions button {
    flex: 1;
  }
  
  .device-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Feature table improvements */
.feature-key-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.feature-key-cell strong {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.feature-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 0.125rem;
}

/* Streamlined user profile section */
.user-info-streamlined {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.user-role-badge {
  /* Inherit base badge styling */
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  /* Additional user role specific styling */
  margin-left: 0.5rem;
}

.profile-settings-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.user-info-link:hover .profile-settings-icon {
  color: var(--accent-primary);
}

/* User profile section container */
.user-profile-section {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-profile-section:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.privacy-link {
  position: relative;
}

.privacy-link:hover {
  background: var(--accent-light) !important;
  color: var(--text-primary) !important;
}

/* Privacy section in profile page */
.privacy-info-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  background: var(--bg-secondary);
}

.privacy-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.privacy-description p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.privacy-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.privacy-actions .btn {
  display: flex;
  align-items: center;
  text-decoration: none;
}

@media (max-width: 768px) {
  .privacy-actions {
    flex-direction: column;
  }
  
  .privacy-actions .btn {
    justify-content: center;
  }
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 0.75rem;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--border-strong);
  border-radius: 24px;
  transition: background-color 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
  background-color: var(--accent-primary);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
}
