/*
 * Japan 4 You — Main Stylesheet
 */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;
  --red-600:  #dc2626;
  --red-100:  #fee2e2;
  --white:    #ffffff;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 12px rgba(0,0,0,.10);
  --radius:    8px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ── Layout ─────────────────────────────────────────────── */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 32px 0; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: var(--blue-700);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar-brand img {
  height: 40px;
  width: auto;
  border-radius: 4px;
}

.navbar-brand span {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.navbar-nav a {
  color: rgba(255,255,255,.85);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(255,255,255,.15);
  color: var(--white);
}

.navbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.navbar-user {
  color: rgba(255,255,255,.85);
  font-size: 14px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: .88; text-decoration: none; }

.btn-primary   { background: var(--blue-600); color: var(--white); }
.btn-danger    { background: var(--red-600);  color: var(--white); }
.btn-outline   { background: transparent; border: 2px solid var(--blue-600); color: var(--blue-600); }
.btn-white     { background: var(--white); color: var(--blue-700); }
.btn-ghost     { background: transparent; color: var(--blue-600); padding: 8px 10px; }
.btn-sm        { padding: 5px 12px; font-size: 13px; }
.btn-paid      { background: #16a34a; color: var(--white); border: none; }
.btn-unpaid    { background: transparent; border: 2px solid var(--red-600); color: var(--red-600); }

/* ── Flash messages ─────────────────────────────────────── */
.flash-container { max-width: 1100px; margin: 0 auto; padding: 16px 24px 0; }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-notice { background: var(--blue-100); color: var(--blue-700); border-left: 4px solid var(--blue-600); }
.flash-alert  { background: var(--red-100);  color: var(--red-600);  border-left: 4px solid var(--red-600); }

/* ── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-subtitle {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  border-top: 3px solid var(--blue-600);
}

.stat-card.red-accent { border-top-color: var(--red-600); }

.stat-label { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--blue-50); }

tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

tbody tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 6px; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ── Badges / Status ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue     { background: var(--blue-100);  color: var(--blue-700); }
.badge-red      { background: var(--red-100);   color: var(--red-600); }
.badge-green    { background: #dcfce7; color: #166534; }
.badge-yellow   { background: #fef9c3; color: #854d0e; }
.badge-gray     { background: var(--gray-100);  color: var(--gray-700); }

.status-select {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.status-select--ordered          { background: var(--gray-100);  color: var(--gray-700); }
.status-select--received         { background: var(--blue-100);  color: var(--blue-700); }
.status-select--pending_shipment { background: #fef9c3; color: #854d0e; }
.status-select--shipped          { background: var(--red-100);   color: var(--red-600); }
.status-select--delivered        { background: #dcfce7; color: #166534; }

/* ── Detail view ────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.detail-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
}

.detail-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.detail-list { padding: 4px 0; }

.detail-row {
  display: flex;
  padding: 10px 20px;
  border-bottom: 1px solid var(--gray-50);
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
  min-width: 130px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 14px;
  color: var(--gray-900);
  font-weight: 500;
  word-break: break-word;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  padding: 28px;
  max-width: 680px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

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

.field .hint { font-size: 12px; color: var(--gray-500); }

.field-error input,
.field-error select,
.field-error textarea { border-color: var(--red-600); }

.error-message { font-size: 12px; color: var(--red-600); font-weight: 500; }

.form-errors {
  background: var(--red-100);
  border: 1px solid var(--red-600);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--red-600);
}

.form-errors ul { margin-left: 16px; margin-top: 4px; }

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--gray-100);
}

/* Checkbox list for multi-select items */
.checkbox-list {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .1s;
}

.checkbox-item:last-child { border-bottom: none; }
.checkbox-item:hover { background: var(--blue-50); }

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue-600);
  flex-shrink: 0;
}

.checkbox-item-label { font-size: 14px; color: var(--gray-700); }
.checkbox-item-meta  { font-size: 12px; color: var(--gray-500); }

/* ── Photo gallery ──────────────────────────────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.photo-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

/* ── Auth pages ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-700) 0%, #1e3a8a 100%);
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo img {
  height: 56px;
  width: auto;
  margin-bottom: 10px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.auth-logo p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 4px;
}

.auth-divider {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
  margin: 20px 0;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--blue-700);
  color: rgba(255,255,255,.75);
  padding: 20px 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--white);
  font-size: 14px;
}

.footer-brand img { height: 28px; border-radius: 3px; }

.footer-copy { font-size: 13px; }

/* ── Breadcrumbs ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
}

.breadcrumb a { color: var(--blue-600); }
.breadcrumb-sep { color: var(--gray-300); }

/* ── Item scraper ───────────────────────────────────────── */
.scraper-box {
  background: var(--blue-50);
  border: 1.5px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.scraper-box-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-700);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.scraper-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.scraper-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}

.scraper-row input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.scraper-status {
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.scraper-status--loading { color: var(--gray-500); }
.scraper-status--success { color: #166534; font-weight: 600; }
.scraper-status--error   { color: var(--red-600); font-weight: 600; }

/* ── Bulk item creation ─────────────────────────────────── */
.bulk-step-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.bulk-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.bulk-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-600);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bulk-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.bulk-item-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-50);
  padding: 3px 10px;
  border-radius: 20px;
}

.url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.url-row input[type="url"] {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.url-row input[type="url"]:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.bulk-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.bulk-item-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.bulk-item-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red-600);
  color: var(--white);
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  line-height: 1;
}

.bulk-item-image-wrap img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.bulk-item-no-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--gray-500);
}

.bulk-item-fields {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bulk-field-name,
.bulk-field-price {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: var(--white);
}

.bulk-field-name:focus,
.bulk-field-price:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Landing page ───────────────────────────────────────── */
.home-page { display: flex; flex-direction: column; min-height: 100vh; }

.hero {
  background: linear-gradient(135deg, var(--blue-700) 0%, #1e3a8a 100%);
  color: var(--white);
  padding: 80px 24px;
  text-align: center;
}

.hero-inner { max-width: 700px; margin: 0 auto; }

.hero-logo img {
  height: 72px;
  width: auto;
  border-radius: 8px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -.5px;
}

.hero-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,.85);
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn-outline-white {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: 2px solid rgba(255,255,255,.6);
  color: var(--white);
  background: transparent;
  transition: border-color .15s, background .15s;
  text-decoration: none;
}

.btn-outline-white:hover {
  border-color: var(--white);
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

.section { padding: 72px 0; }
.section-alt { background: var(--white); }

.section-title {
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  color: var(--gray-900);
  margin-bottom: 10px;
}

.section-subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: 16px;
  margin-bottom: 48px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.step-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  border-top: 4px solid var(--blue-600);
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-600);
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 10px;
}

.step-desc { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.feature-card {
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  text-align: center;
}

.feature-icon { font-size: 36px; margin-bottom: 14px; }

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.feature-card p { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

.cta-section {
  background: var(--red-600);
  color: var(--white);
  padding: 64px 24px;
  text-align: center;
}

.cta-title { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.cta-subtitle { font-size: 16px; color: rgba(255,255,255,.85); margin-bottom: 28px; }

.home-footer {
  background: var(--blue-700);
  color: rgba(255,255,255,.75);
  padding: 24px 0;
  margin-top: auto;
}

.home-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-nav { display: none; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
