/* ============================================================
   common.css – AI Skill Assessment System
   Shared styles across all pages
   ============================================================ */

/* ── Reset / Base ──────────────────────────────────────────── */

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

:root {
  --color-primary:        #4F46E5;
  --color-primary-hover:  #4338CA;
  --color-primary-light:  #EEF2FF;
  --color-primary-dark:   #3730A3;
  --color-gradient:       linear-gradient(135deg, #6D28D9 0%, #4F46E5 100%);
  --color-gradient-hero:  linear-gradient(135deg, #5B21B6 0%, #4F46E5 55%, #6D28D9 100%);

  --color-bg:             #F3F4F6;
  --color-surface:        #ffffff;
  --color-border:         #E5E7EB;
  --color-border-light:   #F3F4F6;

  --color-text-primary:   #111827;
  --color-text-secondary: #6B7280;
  --color-text-muted:     #9CA3AF;

  --color-success:        #10B981;
  --color-danger:         #EF4444;
  --color-warning:        #F59E0B;
  --color-info:           #3B82F6;

  /* Rank colors */
  --rank-c-bg:     #FEF3C7;
  --rank-c-text:   #92400E;
  --rank-c-color:  #D97706;
  --rank-b-bg:     #D1FAE5;
  --rank-b-text:   #065F46;
  --rank-b-color:  #059669;
  --rank-a-bg:     #e0f2fe;
  --rank-a-text:   #0c4a6e;
  --rank-a-color:  #0891b2;
  --rank-s-bg:     #EDE9FE;
  --rank-s-text:   #4C1D95;
  --rank-s-color:  #7C3AED;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:   0 4px 16px rgba(0,0,0,.12);

  --header-height: 56px;
  --content-max:   800px;
  --content-pad:   20px;
  --transition:    0.18s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans',
               'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

ul, ol { list-style: none; }

img, svg { display: block; }

/* ── Loading spinner ───────────────────────────────────────── */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Rank badges ───────────────────────────────────────────── */

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  padding: 0 6px;
}

.rank-badge.rank-c { background: var(--rank-c-bg); color: var(--rank-c-text); }
.rank-badge.rank-b { background: var(--rank-b-bg); color: var(--rank-b-text); }
.rank-badge.rank-a { background: var(--rank-a-bg); color: var(--rank-a-text); }
.rank-badge.rank-s { background: var(--rank-s-bg); color: var(--rank-s-text); }

.rank-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

/* ── Shared buttons ─────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 6px rgba(79,70,229,.25);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: background var(--transition), color var(--transition);
}

.btn-secondary:hover {
  background: var(--color-bg);
  color: var(--color-text-primary);
  text-decoration: none;
}

.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Error card ────────────────────────────────────────────── */

.error-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.error-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

.error-card p {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  white-space: pre-line;
}

/* ── Inline icons ──────────────────────────────────────────── */

.icon-inline {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 600px) {
  :root { --content-pad: 14px; }
}
