/* DACTA Phishing Simulation Portal — CSS */

:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-width: 240px;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Auth Screen */
.auth-container {
  max-width: 420px;
  margin: 80px auto;
  padding: 0 20px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
}

.auth-header p {
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-form h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-toggle a { color: var(--accent); text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }

/* Forms */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  margin-top: 12px;
  color: var(--text-muted);
}

label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea { resize: vertical; }

.form-row {
  display: flex;
  gap: 12px;
}

.form-col { flex: 1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #cbd5e1; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 6px 10px; background: none; color: var(--text-muted); font-size: 16px; line-height: 1; }
.btn-icon:hover { color: var(--danger); }
.btn-full { width: 100%; margin-top: 16px; }
.btn-copy { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer; color: var(--text-muted); margin-left: 8px; }
.btn-copy:hover { background: var(--border); color: var(--text); }

/* Layout */
.screen { display: none; }
.screen.active { display: flex; }

#auth-screen { display: block; }
#auth-screen.active { display: block; }

#app-screen {
  display: none;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--primary-light);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
}

.org-badge {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 10px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

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

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--primary-light);
  font-size: 13px;
  color: #94a3b8;
}

.sidebar-footer a { color: #94a3b8; text-decoration: none; display: block; margin-top: 4px; }
.sidebar-footer a:hover { color: white; }

/* Content */
#content {
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  flex: 1;
  max-width: 1200px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.view-header h1 { font-size: 24px; font-weight: 700; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 { font-size: 16px; margin-bottom: 12px; }

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-header-row h3 { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.15s;
}

.template-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.template-card h4 { font-size: 14px; margin-bottom: 4px; }
.template-card .brand { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.template-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.stat-card .pct {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover { background: #f8fafc; }

.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}

.targets-table { font-size: 13px; }
.targets-table th, .targets-table td { padding: 6px 10px; }

.target-summary {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-draft { background: #e2e8f0; color: #475569; }
.badge-scheduled { background: #e0e7ff; color: #3730a3; }
.badge-active { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fef2f2; color: #991b1b; }
.badge-verified { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-failed { background: #fef2f2; color: #991b1b; }
.badge-pass { background: #dcfce7; color: #166534; }
.badge-missing { background: #fef2f2; color: #991b1b; }
.badge-unchecked { background: #e2e8f0; color: #475569; }

/* Group cards */
.group-card { padding: 0; overflow: hidden; }

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.group-header:hover { background: #f8fafc; }

.group-info h3 { font-size: 15px; margin-bottom: 2px; }
.group-count { font-size: 13px; color: var(--text-muted); }

.group-actions {
  display: flex;
  gap: 6px;
}

.group-targets {
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

/* File upload area */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.file-upload-area:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-area p { color: var(--text-muted); font-size: 14px; }

.upload-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 540px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 { font-size: 18px; }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.close-btn:hover { color: var(--text); }

/* DNS record display */
.dns-record {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  font-size: 13px;
}

.dns-record code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

/* Filter row */
.filter-row {
  display: flex;
  gap: 8px;
}

.filter-row select {
  width: auto;
  min-width: 140px;
}

/* Help text */
.help-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Empty states */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 12px;
  font-size: 14px;
}

.empty-state-large {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
}

.empty-state-large p + p { margin-top: 8px; }

/* Loading */
.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  font-size: 14px;
}

/* Report JSON */
.report-json {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  font-size: 12px;
  font-family: 'SF Mono', Consolas, monospace;
  overflow-x: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: white;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  max-width: 400px;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { width: 200px; }
  #content { margin-left: 200px; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-content { width: 95%; }
  .settings-grid { grid-template-columns: 1fr; }
  .group-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .group-actions { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
}
