/**
 * SECURITY-UI.css
 * 
 * Styles for Security Settings & Audit Log Viewer
 * Include this file in your main CSS or merge with styles.css
 */

/* ═══════════════════════════════════════════════════════════════════════ */
/* SECURITY SETTINGS PANEL */
/* ═══════════════════════════════════════════════════════════════════════ */

.security-settings {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.05) 0%, rgba(100, 50, 200, 0.05) 100%);
  border-radius: 12px;
  padding: 30px;
  max-width: 900px;
  margin: 0 auto;
  color: #e0e0e0;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(245, 166, 35, 0.2);
}

.settings-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: #f5a623;
  margin: 0;
}

.security-score-badge {
  background: linear-gradient(135deg, #f5a623 0%, #ff6b6b 100%);
  color: #000;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.security-score-badge .score {
  font-size: 18px;
  font-weight: 700;
}

/* Tabs */
.settings-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(245, 166, 35, 0.1);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
  bottom: -1px;
}

.tab-btn:hover {
  color: #e0e0e0;
}

.tab-btn.active {
  color: #f5a623;
  border-bottom-color: #f5a623;
}

/* Tab content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Overview Tab */
.overview-tab {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.security-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.security-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 166, 35, 0.1);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
}

.security-card:hover {
  border-color: rgba(245, 166, 35, 0.3);
  background: rgba(245, 166, 35, 0.05);
  transform: translateY(-2px);
}

.security-card .icon {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.security-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #f5a623;
}

.security-card .status {
  font-size: 24px;
  font-weight: 700;
  margin: 10px 0;
  color: #00ff88;
}

.security-card .status.disabled {
  color: #ff6b6b;
}

.security-card small {
  display: block;
  color: #a0a0a0;
  font-size: 12px;
  margin-top: 10px;
}

.recommendations-box {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 8px;
  padding: 20px;
}

.recommendations-box h4 {
  color: #00ff88;
  margin: 0 0 15px 0;
  font-size: 16px;
}

.recommendations-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recommendations-box li {
  padding: 8px 0;
  color: #e0e0e0;
  font-size: 14px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.1);
}

.recommendations-box li:last-child {
  border-bottom: none;
}

/* 2FA Tab */
.2fa-tab {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.status-box {
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.status-box.success {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.status-box.warning {
  background: rgba(255, 166, 35, 0.1);
  border: 1px solid rgba(255, 166, 35, 0.2);
}

.status-box .icon {
  font-size: 24px;
  flex-shrink: 0;
}

.status-box h3 {
  color: #f5a623;
  font-size: 16px;
  margin: 0 0 5px 0;
}

.status-box p {
  color: #a0a0a0;
  font-size: 14px;
  margin: 0;
}

/* 2FA Actions */
.2fa-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.setup-instructions {
  background: rgba(100, 50, 200, 0.1);
  border: 1px solid rgba(100, 50, 200, 0.2);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.setup-instructions h4 {
  color: #b86eff;
  margin: 0 0 15px 0;
  font-size: 14px;
  font-weight: 600;
}

.setup-instructions ol {
  margin: 0;
  padding-left: 20px;
  color: #e0e0e0;
  font-size: 14px;
  line-height: 1.8;
}

.setup-instructions li {
  margin-bottom: 10px;
}

/* QR Code Box */
.qr-box {
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(245, 166, 35, 0.2);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.qr-box h4 {
  color: #f5a623;
  margin: 0 0 15px 0;
  font-size: 14px;
}

.qr-box .qr-code {
  max-width: 250px;
  height: auto;
  margin-bottom: 15px;
  background: white;
  padding: 10px;
  border-radius: 4px;
}

.qr-box code {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
  margin-top: 10px;
  color: #00ff88;
}

/* Backup Codes */
.backup-codes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 15px 0;
}

.backup-codes-list code {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 4px;
  display: block;
  text-align: center;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 15px 0;
}

.form-group label {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(245, 166, 35, 0.2);
  color: #e0e0e0;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #f5a623;
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.1);
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: #f5a623;
  color: #000;
}

.btn-primary:hover {
  background: #ff6b6b;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(245, 166, 35, 0.1);
  color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.btn-secondary:hover {
  background: rgba(245, 166, 35, 0.2);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* API Keys Tab */
.keys-tab {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.api-keys-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.key-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 166, 35, 0.1);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.key-card.new-key {
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  border: 2px dashed rgba(245, 166, 35, 0.3);
}

.key-card.new-key:hover {
  border-color: #f5a623;
  background: rgba(245, 166, 35, 0.05);
}

.key-card.new-key .icon {
  font-size: 32px;
}

.key-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.key-name {
  color: #f5a623;
  font-weight: 600;
  font-size: 14px;
}

.key-status {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.key-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.key-info small {
  color: #a0a0a0;
  font-size: 12px;
}

.key-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sessions Tab */
.sessions-tab {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sessions-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.session-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 166, 35, 0.1);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-card.current {
  border-color: rgba(0, 255, 136, 0.3);
  background: rgba(0, 255, 136, 0.05);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.device-name {
  color: #f5a623;
  font-weight: 600;
  font-size: 14px;
}

.badge {
  background: rgba(100, 50, 200, 0.3);
  color: #b86eff;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.current {
  background: rgba(0, 255, 136, 0.3);
  color: #00ff88;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-info small {
  color: #a0a0a0;
  font-size: 12px;
}

.session-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.session-settings {
  background: rgba(100, 50, 200, 0.1);
  border: 1px solid rgba(100, 50, 200, 0.2);
  border-radius: 8px;
  padding: 20px;
}

.session-settings h4 {
  color: #b86eff;
  margin: 0 0 15px 0;
  font-size: 14px;
  font-weight: 600;
}

.session-settings label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
}

.session-settings input[type="checkbox"] {
  cursor: pointer;
}

/* Logs Tab */
.logs-tab {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logs-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.logs-filters input,
.logs-filters select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(245, 166, 35, 0.2);
  color: #e0e0e0;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  flex: 1;
  min-width: 150px;
}

.logs-loading {
  text-align: center;
  padding: 30px;
  color: #a0a0a0;
}

/* Audit Logs Table */
.audit-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 20px;
}

.audit-logs-table thead {
  background: rgba(245, 166, 35, 0.05);
  border-bottom: 2px solid rgba(245, 166, 35, 0.2);
}

.audit-logs-table th {
  padding: 12px;
  text-align: left;
  color: #f5a623;
  font-weight: 600;
}

.audit-logs-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(245, 166, 35, 0.1);
  color: #e0e0e0;
}

.audit-logs-table tbody tr:hover {
  background: rgba(245, 166, 35, 0.05);
}

.audit-logs-table tr.success {
  border-left: 3px solid #00ff88;
}

.audit-logs-table tr.error {
  border-left: 3px solid #ff6b6b;
}

.audit-logs-table tr.info {
  border-left: 3px solid #b86eff;
}

.audit-logs-table code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #00ff88;
}

.action-badge {
  background: rgba(184, 110, 255, 0.2);
  color: #b86eff;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-badge.success {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.status-badge.error {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.status-badge.info {
  background: rgba(184, 110, 255, 0.2);
  color: #b86eff;
}

/* Audit Viewer */
.audit-viewer {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.viewer-controls {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  color: #a0a0a0;
  font-size: 13px;
  white-space: nowrap;
}

.action-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.audit-table-container {
  overflow-x: auto;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
}

.page-info {
  color: #a0a0a0;
  font-size: 13px;
}

.page-info strong {
  color: #f5a623;
}

/* Alerts */
.alerts-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 90%;
  pointer-events: none;
}

.alert {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  max-width: 300px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.alert.alert-info {
  background: rgba(184, 110, 255, 0.2);
  color: #b86eff;
  border: 1px solid rgba(184, 110, 255, 0.3);
}

.alert.alert-success {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.alert.alert-error {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.alert.alert-warning {
  background: rgba(255, 166, 35, 0.2);
  color: #f5a623;
  border: 1px solid rgba(255, 166, 35, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .security-settings {
    padding: 20px;
  }

  .settings-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-tabs {
    flex-direction: column;
  }

  .security-cards {
    grid-template-columns: 1fr;
  }

  .api-keys-list,
  .sessions-list {
    grid-template-columns: 1fr;
  }

  .logs-filters {
    flex-direction: column;
  }

  .logs-filters input,
  .logs-filters select {
    width: 100%;
    min-width: 0;
  }

  .action-buttons {
    margin-left: 0;
    width: 100%;
  }

  .audit-logs-table {
    font-size: 11px;
  }

  .audit-logs-table th,
  .audit-logs-table td {
    padding: 8px;
  }

  .alerts-container {
    right: 10px;
    left: 10px;
  }

  .alert {
    max-width: none;
  }
}
