/* ============================================================
   ACI Simulator — Shared Stylesheet
   Import this in every page:  <link rel="stylesheet" href="styles.css">
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --primary:        #667eea;
  --primary-dark:   #764ba2;
  --gradient:       linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-gradient:    linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --shadow-card:    0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Base ─────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg-gradient);
  min-height: 100vh;
}

/* ── Navigation ───────────────────────────────────────────── */
.sim-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sim-nav__brand {
  color: white;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  opacity: 0.95;
  flex-shrink: 0;
}

.sim-nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sim-nav__links::-webkit-scrollbar { display: none; }

.sim-nav__links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

.sim-nav__links a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.sim-nav__links a.active {
  color: white;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

/* ── Container (white card shell) ─────────────────────────── */
.container {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  padding: 40px;
}

/* ── Page header (used on pages without a container) ──────── */
.page-title {
  color: #333;
  margin-bottom: 10px;
  font-size: 28px;
}

.page-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 14px;
}

/* ── Form sections ────────────────────────────────────────── */
.section,
.form-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: var(--radius-md);
  margin-bottom: 25px;
}

.section h2,
.form-section h2 {
  color: #333;
  font-size: 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.section h2::before,
.form-section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--primary);
  margin-right: 10px;
  border-radius: 2px;
}

/* ── Form layout ──────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width,
.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin-bottom: 8px;
}

input,
select,
textarea {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: white;
  color: #333;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

input::placeholder,
textarea::placeholder {
  color: #aaa;
}

/* ── Buttons ──────────────────────────────────────────────── */
button {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: #6c757d;
}

button.danger {
  background: #dc3545;
}

/* ── Alert / feedback boxes ───────────────────────────────── */
.error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
}

.success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
}

.info {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #1565c0;
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  color: #856404;
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 25px;
  font-size: 14px;
  line-height: 1.6;
}

.warning strong {
  display: block;
  margin-bottom: 8px;
}

/* ── Spinner / loading ────────────────────────────────────── */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.spinner.dark {
  border-color: #f3f3f3;
  border-top-color: var(--primary);
}

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

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading .spinner {
  margin: 0 auto 20px;
}

/* ── Test mode toggle (segmented control) ─────────────────── */
.test-mode-toggle {
  display: flex;
  align-items: center;
  background: #e9ecef;
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.test-mode-toggle input[type="radio"] {
  display: none;
}

.test-mode-toggle label {
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  transition: all 0.2s;
  margin: 0;
  user-select: none;
}

.test-mode-toggle input[type="radio"]:checked + label {
  background: white;
  color: #333;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#testModeExternal:checked + label { color: #1565c0; }
#testModeInternal:checked + label { color: #6a1b9a; }
#envTestUat:checked + label { color: #2e7d32; }
#envProd:checked + label { color: #c62828; }

.test-mode-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.test-mode-row > label,
.test-mode-row > span {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin: 0;
}

/* ── Back link ────────────────────────────────────────────── */
.back-link {
  margin-top: 20px;
  text-align: center;
}

.back-link a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 20px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  display: inline-block;
  transition: all 0.2s;
}

.back-link a:hover {
  background: white;
  color: var(--primary);
  border-color: white;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 20px;
  }

  .sim-nav__brand span {
    display: none;
  }
}
