/* ============================================================
   MI6.TF — Shared Design System
   Canonical styles used across all pages.
   ============================================================ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --color-primary:       #00ff88;
  --color-primary-dark:  #00cc6a;
  --color-primary-hover: #00ffaa;
  --color-secondary:     #00c8ff;
  --color-accent-blue:   #66bbff;
  --color-danger:        #ff6b6b;
  --color-danger-dark:   #ff3333;
  --color-warning:       #ffa500;

  --color-bg:            #0a0a0a;
  --color-surface:       rgba(18, 18, 18, 0.95);
  --color-surface-alt:   rgba(25, 25, 25, 0.90);
  --color-border:        rgba(0, 255, 136, 0.25);
  --color-border-subtle: rgba(255, 255, 255, 0.10);

  --color-text:          #e0e0e0;
  --color-text-muted:    rgba(255, 255, 255, 0.60);
  --color-text-dim:      rgba(255, 255, 255, 0.40);

  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  --card-radius:  12px;
  --card-padding: 48px;
  --input-radius: 6px;
}

/* ── Reset ───────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body Base ───────────────────────────────────────────── */
body {
  font-family: var(--font-mono);
  background: var(--color-bg);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 200, 255, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.04) 0%, transparent 60%);
  min-height: 100vh;
  padding: 20px;
  color: var(--color-text);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* ── Grid Overlay ────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

/* ── Container Variants ──────────────────────────────────── */
.container {
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.container--narrow     { max-width: 550px;  padding-top: 60px; }
.container--wide       { max-width: 800px;  padding-top: 40px; padding-bottom: 60px; }
.container--dashboard  { max-width: 1400px; padding-top: 40px; }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 20px 60px rgba(0, 255, 136, 0.10);
  position: relative;
  overflow: hidden;
}

/* Animated shimmer top bar */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #00ff88, #00c8ff, #00ff88, transparent);
  opacity: 0.8;
  animation: shimmer 3s linear infinite;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.logo {
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, #00ff88 0%, #00c8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: 4px;
  position: relative;
  display: inline-block;
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00ff88;
  border-radius: 50%;
  margin-left: 12px;
  box-shadow: 0 0 10px #00ff88;
  animation: pulse 2s infinite;
  position: absolute;
  top: 8px;
  right: -20px;
}

.tagline {
  font-size: 13px;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.9;
}

.description {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto;
  font-weight: 400;
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group { margin-bottom: 24px; position: relative; }

label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-primary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--input-radius);
  color: var(--color-text);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(0, 0, 0, 0.7);
  box-shadow:
    0 0 0 3px rgba(0, 255, 136, 0.15),
    0 4px 12px rgba(0, 255, 136, 0.20),
    inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

input::placeholder { color: rgba(255, 255, 255, 0.35); }
textarea { min-height: 80px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
  border: none;
  color: #000;
  border-radius: var(--input-radius);
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
  font-family: inherit;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}
.btn:hover::before { left: 100%; }
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 255, 136, 0.5);
  background: linear-gradient(135deg, #00ffaa 0%, #00dd7a 100%);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 255, 136, 0.4);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.20);
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.10);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
  color: #000;
  box-shadow: none;
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); }

.btn-warning {
  background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
  color: #000;
  box-shadow: none;
}
.btn-warning:hover { box-shadow: 0 6px 20px rgba(255, 165, 0, 0.4); }

.btn-small {
  padding: 10px 18px;
  font-size: 12px;
  width: auto;
  margin-right: 8px;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.10);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.20);
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
}
.btn-small:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(0, 255, 136, 0.4);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.toggle-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 12px 28px;
  border-radius: var(--input-radius);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.3s ease;
  width: auto;
  box-shadow: none;
}
.toggle-btn:hover {
  color: var(--color-primary);
  border-color: rgba(0, 255, 136, 0.5);
  background: rgba(0, 255, 136, 0.08);
  transform: translateY(-1px);
}

/* ── Feedback Messages ───────────────────────────────────── */
.error {
  background: rgba(255, 107, 107, 0.08);
  color: var(--color-danger);
  padding: 20px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  margin-top: 24px;
  display: none;
  line-height: 1.5;
  animation: slideIn 0.3s ease;
}
.error.security {
  background: rgba(255, 165, 0, 0.08);
  color: var(--color-warning);
  border-color: rgba(255, 165, 0, 0.3);
}
.error.ban {
  background: rgba(255, 51, 51, 0.08);
  color: var(--color-danger-dark);
  border-color: rgba(255, 51, 51, 0.3);
}

.success {
  background: rgba(0, 255, 136, 0.08);
  color: var(--color-primary);
  padding: 20px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 8px;
  margin-top: 24px;
  display: none;
  animation: slideIn 0.3s ease;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}
.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: linear-gradient(135deg, rgba(18, 18, 18, 0.98) 0%, rgba(25, 25, 25, 0.95) 100%);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: var(--card-radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.3s ease;
  backdrop-filter: blur(10px);
}
.modal-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  color: var(--color-primary);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 4px;
}
.modal-close:hover {
  color: var(--color-danger);
  background: rgba(255, 107, 107, 0.1);
}
.modal-body { padding: 24px; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  margin: 0 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}
.footer a:hover {
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

/* ── Back Links ──────────────────────────────────────────── */
/* Button-style (bottom of content pages) */
.back-link {
  display: inline-block;
  margin-top: 40px;
  color: var(--color-primary);
  text-decoration: none;
  border: 1px solid rgba(0, 255, 136, 0.4);
  padding: 14px 28px;
  border-radius: var(--input-radius);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: rgba(0, 255, 136, 0.05);
}
.back-link:hover {
  background: var(--color-primary);
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

/* Badge-style (inside page header) */
.back-link--header {
  position: absolute;
  left: 0;
  top: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--input-radius);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
}
.back-link--header:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--color-primary);
  border-color: rgba(0, 255, 136, 0.3);
  transform: translateX(-2px);
}

/* ── Loading Spinner ─────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 60px 20px;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
.loading-text {
  font-size: 13px;
  color: var(--color-text-dim);
  letter-spacing: 0.5px;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.2); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Shared Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .card { padding: 32px 24px; }
  .container--narrow    { padding-top: 20px; }
  .container--dashboard { padding-top: 20px; }
}

@media (max-width: 600px) {
  .logo         { font-size: 28px; }
  .description  { font-size: 13px; }
  .modal-content {
    margin: 10px;
    max-height: 95vh;
  }
}
