/* ==========================================================
   Design Tokens
   ========================================================== */

:root {
  /* Brand */
  --primary: #1f3a8a;
  --primary-hover: #1e40af;

  /* Surfaces */
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-muted: #f1f5f9;

  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5f5;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Status */
  --success: #16a34a;
  --danger: #dc2626;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);

  /* Focus */
  --focus-ring: 0 0 0 3px rgba(31, 58, 138, 0.25);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
}

/* ==========================================================
   Base
   ========================================================== */

body {
  min-height: 100vh;
  background: var(--surface-alt);
  color: var(--text-primary);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  line-height: 1.5;
}

/* ==========================================================
   Layout
   ========================================================== */

.mui-container {
  max-width: 960px;
  padding: 2rem 1rem;
}

.mui-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================
   Header
   ========================================================== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header .mui--text-subhead {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.header a:hover {
  text-decoration: underline;
}

/* ==========================================================
   Typography
   ========================================================== */

.mui--text-headline {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.mui--text-subhead {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.mui--text-body1 {
  padding: 1rem;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  font-size: 1rem;
}

.mui--text-caption {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==========================================================
   Terms / Content
   ========================================================== */

.terms-wrap {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.terms {
  max-height: 60vh;
  overflow-y: auto;
  padding: 2rem;
  color: var(--text-primary);
}

.terms h1,
.terms h2,
.terms h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.terms p,
.terms ul,
.terms ol {
  margin-bottom: 1rem;
}

/* ==========================================================
   Buttons
   ========================================================== */

.mui-btn {
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}

.mui-btn--primary {
  background: var(--primary);
  color: #ffffff;
}

.mui-btn--primary:hover {
  background: var(--primary-hover);
}

.mui-btn--flat {
  background: transparent;
  color: var(--text-secondary);
}

.mui-btn--flat:hover {
  background: var(--surface-muted);
}

/* ==========================================================
   Inputs
   ========================================================== */

.mui-textfield input,
.mui-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  margin: 0;
}

.mui-textfield input:focus,
.mui-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* ==========================================================
   Tables
   ========================================================== */

.mui-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mui-table thead {
  background: var(--surface-muted);
}

.mui-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.mui-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.mui-table tbody tr:hover {
  background: var(--surface-muted);
}

/* ==========================================================
   Status
   ========================================================== */

.mui--text-danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-left: 3px solid var(--danger);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================
   Code
   ========================================================== */

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-muted);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .mui-panel {
    padding: 1.5rem;
  }

  .terms {
    padding: 1.5rem;
  }
}

/* ==========================================================
   Skeleton Loaders
   ========================================================== */

.skeleton {
  background-color: var(--surface-muted);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.5),
    rgba(255, 255, 255, 0)
  );
  background-size: 200px 100%;
  background-repeat: no-repeat;
  border-radius: var(--radius-sm);
  display: inline-block;
  line-height: 1;
  width: 100%;
  animation: skeleton-loading 1.5s infinite linear;
}

.skeleton-text {
  height: 0.8rem;
  margin-bottom: 0.5rem;
}

.skeleton-button {
  height: 30px;
  width: 60px;
}

.skeleton-table td {
  padding: 1rem;
}

@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}
