/* =========================================================
   Global reset & variables
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f5f6fa;
  --color-surface: #ffffff;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-error: #dc2626;
  --color-success: #16a34a;
  --color-border: #d1d5db;
  --color-text: #111827;
  --color-muted: #6b7280;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  padding: 2rem 1rem;
}

/* =========================================================
   Layout
   ========================================================= */
.container {
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.subtitle {
  color: var(--color-muted);
  margin-bottom: 2rem;
}

/* =========================================================
   Card
   ========================================================= */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

/* =========================================================
   Form
   ========================================================= */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .95rem;
}

input[type="text"],
input[type="number"],
input[type="file"] {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-bg);
  transition: border-color .15s;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

input[type="file"] {
  padding: .45rem .6rem;
  cursor: pointer;
}

.field-hint {
  font-size: .82rem;
  color: var(--color-muted);
  margin-top: .3rem;
}

.field-error {
  font-size: .85rem;
  color: var(--color-error);
  margin-top: .3rem;
  display: none;
}

.field-error.visible {
  display: block;
}

input.invalid {
  border-color: var(--color-error);
}

/* =========================================================
   Submit button
   ========================================================= */
.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .7rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  justify-content: center;
  margin-top: .5rem;
}

.btn-submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* =========================================================
   Submission result banner
   ========================================================= */
#result-banner {
  display: none;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
  font-weight: 500;
}

#result-banner.success {
  display: block;
  background: #dcfce7;
  color: var(--color-success);
  border: 1px solid #86efac;
}

#result-banner.error {
  display: block;
  background: #fee2e2;
  color: var(--color-error);
  border: 1px solid #fca5a5;
}

/* =========================================================
   Index page nav list
   ========================================================= */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.nav-list a {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: background .12s;
}

.nav-list a:hover {
  background: #eff6ff;
}

/* =========================================================
   Down modal
   ========================================================= */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.visible {
  display: flex;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
}

.modal h2 {
  font-size: 1.2rem;
  margin-bottom: .75rem;
}

.modal p {
  color: var(--color-muted);
  margin-bottom: 1.25rem;
  font-size: .95rem;
}

.modal .btn-close {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .55rem 1.2rem;
  font-size: .95rem;
  cursor: pointer;
  font-weight: 600;
}

.modal .btn-close:hover {
  background: var(--color-primary-hover);
}
