/* JavaJudge - Global Styles
   Theme: Dark Industrial / Terminal aesthetic
   Font: JetBrains Mono + Noto Sans JP
*/
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  /* Colors */
  --bg-base:      #0d0f12;
  --bg-surface:   #151820;
  --bg-elevated:  #1c2028;
  --bg-hover:     #232834;
  --border:       #2a3040;
  --border-light: #3a4555;

  --text-primary:   #e8ecf2;
  --text-secondary: #8b9ab0;
  --text-muted:     #4a5568;
  --text-code:      #a8d8f0;

  --accent:       #3b82f6;
  --accent-hover: #60a5fa;
  --accent-dim:   rgba(59,130,246,0.15);

  /* Status colors */
  --ac:  #22c55e;
  --wa:  #f59e0b;
  --ce:  #f97316;
  --re:  #ef4444;
  --sv:  #a855f7;
  --tle: #06b6d4;
  --wj:  #6b7280;

  /* Layout */
  --sidebar-w: 220px;
  --header-h:  56px;
  --radius:    6px;
  --radius-lg: 10px;

  /* Fonts */
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-sans: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1rem;
}

.page-content {
  padding: 2rem 1.5rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h1 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent-hover);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.nav-icon { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  truncate: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ─── Status Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

.badge-AC  { background: rgba(34,197,94,.15);  color: var(--ac);  border: 1px solid rgba(34,197,94,.3); }
.badge-WA  { background: rgba(245,158,11,.15); color: var(--wa);  border: 1px solid rgba(245,158,11,.3); }
.badge-CE  { background: rgba(249,115,22,.15); color: var(--ce);  border: 1px solid rgba(249,115,22,.3); }
.badge-RE  { background: rgba(239,68,68,.15);  color: var(--re);  border: 1px solid rgba(239,68,68,.3); }
.badge-SV  { background: rgba(168,85,247,.15); color: var(--sv);  border: 1px solid rgba(168,85,247,.3); }
.badge-TLE { background: rgba(6,182,212,.15);  color: var(--tle); border: 1px solid rgba(6,182,212,.3); }
.badge-WJ  { background: rgba(107,114,128,.15);color: var(--wj);  border: 1px solid rgba(107,114,128,.3); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-hover); }

.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--re);
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.form-label .required { color: var(--re); margin-left: 0.2rem; }

.form-control {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s;
  width: 100%;
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b9ab0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.form-check-label { font-size: 0.875rem; color: var(--text-secondary); }

/* ─── File Drop Zone ─────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-base);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.75rem;
  color: var(--text-muted);
}

.drop-zone-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-family: var(--font-mono);
}

.drop-zone.has-file {
  border-color: var(--ac);
  background: rgba(34,197,94,0.05);
}

.drop-zone.error {
  border-color: var(--re);
  background: rgba(239,68,68,0.05);
}

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.data-table td {
  padding: 0.7rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); color: var(--text-primary); }

.data-table .mono { font-family: var(--font-mono); font-size: 0.8rem; }

/* ─── Code blocks ────────────────────────────────────────────────────────── */
.code-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-code);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
}

/* ─── Alert / Toast ──────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.alert-error   { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border-color: rgba(34,197,94,.3);  color: #86efac; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fde68a; }
.alert-info    { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #93c5fd; }

/* ─── Announcement Card ──────────────────────────────────────────────────── */
.announcement {
  padding: 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.75rem;
}

.announcement.pinned { border-left-color: var(--wa); }

.announcement-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.announcement-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.announcement-meta {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ─── Progress / Loading ─────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Result page pulse ──────────────────────────────────────────────────── */
.wj-pulse {
  animation: wj-blink 1.5s ease-in-out infinite;
}

@keyframes wj-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ─── Page transitions ───────────────────────────────────────────────────── */
.page-enter {
  animation: pageIn 0.2s ease;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
