/* ============================================
   受付システム PWA - Style
   ============================================ */

:root {
  --primary: #BE1128;
  --primary-dark: #8B0D1E;
  --primary-light: #E8394D;
  --bg: #F0F2F5;
  --card-bg: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --shadow: 0 8px 30px rgba(0,0,0,0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-overflow-scrolling: touch;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  transition: all 0.4s ease-out;
}

.card.hidden {
  display: none;
  opacity: 0;
  visibility: hidden;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 28px;
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
}

.mode-btn {
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 10px;
  color: var(--text-muted);
  transition: all 0.25s ease;
}

.mode-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(190, 17, 40, 0.3);
}

/* Camera Section */
.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanning-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 60%;
  pointer-events: none;
  z-index: 10;
  display: none;
}

.camera-container.scanning .scanning-frame {
  display: block;
}

.frame-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 4px solid rgba(255,255,255,0.9);
}

.top-left { top: 0; left: 0; border-right: none; border-bottom: none; }
.top-right { top: 0; right: 0; border-left: none; border-bottom: none; }
.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; }
.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; }

.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  box-shadow: 0 0 20px 3px rgba(255,255,255,0.4);
  animation: scan 2s linear infinite;
  display: none;
}

@keyframes scan {
  0% { top: 0; }
  100% { top: 100%; }
}

.camera-container.scanning .scan-line { display: block; }

.camera-status {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  z-index: 15;
  display: none;
  white-space: nowrap;
}

.ocr-start-btn {
  position: absolute;
  z-index: 20;
  padding: 16px 32px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}

.ocr-start-btn:active { transform: scale(0.95); }

.ocr-start-btn svg {
  width: 24px;
  height: 24px;
}

.manual-capture-btn {
  position: absolute;
  bottom: 16px;
  z-index: 20;
  padding: 14px 28px;
  background: rgba(255,255,255,0.95);
  color: var(--text);
  border: none;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.manual-capture-btn:active { transform: scale(0.92); }

.ocr-overlay-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  z-index: 30;
  border-radius: 16px;
  gap: 12px;
  font-weight: 700;
}

/* Divider */
.divider {
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin: 28px 0;
  line-height: 0.1em;
}

.divider span {
  background: var(--card-bg);
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Form Inputs */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}

.required {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(190, 17, 40, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

.optional {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
  -webkit-appearance: none;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(190, 17, 40, 0.1);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s, opacity 0.2s;
  box-shadow: 0 6px 20px rgba(190, 17, 40, 0.3);
}

.submit-btn:active { transform: scale(0.97); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.disabled { display: none; }

@keyframes spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* Success Card */
.success-card {
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--success), #34D399);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: popIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.success-icon svg {
  width: 40px;
  height: 40px;
  color: #fff;
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-card h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text);
}

.success-card p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 32px;
  line-height: 1.6;
}

.back-btn {
  padding: 14px 32px;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:active { transform: scale(0.96); }
