/* ============================================
   買取依頼書作成フォーム - スタイルシート
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --accent: #f43f5e;
  --accent-light: #fb7185;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #16162a;
  --bg-hover: #252542;
  --border: #2a2a4a;
  --border-focus: #6366f1;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Noto Sans JP', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(244, 63, 94, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1e1e3a 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-sub {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Progress */
.progress-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: var(--transition);
}

.step.active {
  opacity: 1;
}

.step.completed {
  opacity: 0.8;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
}

.step.active .step-circle {
  background: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.step.completed .step-circle {
  background: var(--success);
}

.step span {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Main */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
}

/* Form Sections */
.form-section {
  display: none;
  animation: fadeSlideIn 0.4s ease;
}

.form-section.active {
  display: block;
}

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

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  font-size: 24px;
}

/* Form Groups */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 0 1 auto;
}

.flex-1 {
  flex: 1 1 200px !important;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--accent);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:invalid.touched {
  border-color: var(--accent);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Radio & Checkbox */
.radio-group, .checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.radio-label:hover, .checkbox-label:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.radio-label input, .checkbox-label input {
  display: none;
}

.radio-custom, .checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-custom {
  border-radius: 4px;
}

.radio-label input:checked ~ .radio-custom,
.checkbox-label input:checked ~ .checkbox-custom {
  border-color: var(--primary);
  background: var(--primary);
}

.radio-custom::after, .checkbox-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: var(--transition);
}

.radio-custom::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.checkbox-custom::after {
  width: 10px;
  height: 6px;
  border: 2px solid #fff;
  border-top: none;
  border-right: none;
  transform: translate(-50%, -60%) rotate(-45deg) scale(0);
}

.radio-label input:checked ~ .radio-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.checkbox-label input:checked ~ .checkbox-custom::after {
  transform: translate(-50%, -60%) rotate(-45deg) scale(1);
}

/* Items */
.items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.item-row {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  animation: fadeSlideIn 0.3s ease;
  position: relative;
}

.item-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.item-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-light);
  background: var(--primary-glow);
  padding: 2px 10px;
  border-radius: 20px;
}

.item-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.item-delete:hover {
  background: rgba(244, 63, 94, 0.2);
}

.item-fields {
  display: grid;
  grid-template-columns: 1fr 100px 120px 80px 120px;
  gap: 10px;
  align-items: end;
}

.item-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.item-field input, .item-field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.item-field input:focus, .item-field select:focus {
  border-color: var(--border-focus);
}

.item-field input[readonly] {
  background: var(--bg-hover);
  color: var(--primary-light);
  font-weight: 600;
}

/* Responsive items */
@media (max-width: 640px) {
  .item-fields {
    grid-template-columns: 1fr 1fr;
  }
  .item-fields .item-field:first-child {
    grid-column: 1 / -1;
  }
}

.totals-bar {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1e1e3a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 40px;
  margin-bottom: 20px;
}

.total-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.total-label {
  font-size: 12px;
  color: var(--text-muted);
}

.total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.total-amount {
  color: var(--primary-light);
}

/* Buttons */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-submit {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  padding: 14px 36px;
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-add {
  width: 100%;
  padding: 14px;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--primary-light);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-add:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.btn-arrow {
  font-size: 18px;
}

.btn-icon {
  font-size: 18px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Confirmation */
.confirmation-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.confirmation-title {
  color: var(--accent);
  font-size: 16px;
  margin-bottom: 16px;
}

.confirmation-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirmation-list li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.confirmation-list li::before {
  content: '・';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.confirmation-list li small {
  color: var(--text-muted);
  font-size: 12px;
}

.agreement-box {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.05), rgba(99, 102, 241, 0.05));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.agreement-check {
  font-size: 15px !important;
  font-weight: 600;
  color: var(--text) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.signature-section {
  margin-bottom: 8px;
}

.signature-input {
  font-size: 20px !important;
  padding: 16px !important;
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
  border: 2px solid var(--border) !important;
}

.signature-input:focus {
  border-color: var(--primary) !important;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.success-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.success-modal h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.success-modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.7;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn-pdf-download {
  padding: 14px 28px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-pdf-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

/* CSV Import Section */
.csv-section {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(16, 185, 129, 0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.csv-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.csv-icon {
  font-size: 28px;
}

.csv-info strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.csv-info p {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.csv-actions {
  display: flex;
  gap: 8px;
}

.btn-csv-import {
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-csv-import:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-csv-export {
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-csv-export:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.csv-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  animation: fadeSlideIn 0.3s ease;
}

/* Responsive */
@media (max-width: 480px) {
  .header { padding: 16px; }
  .logo-text { font-size: 18px; }
  .main { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .totals-bar { flex-direction: column; gap: 12px; align-items: flex-end; }
  .form-actions { flex-direction: column-reverse; }
  .btn { justify-content: center; }
  .progress-steps { gap: 4px; }
  .step span { font-size: 10px; }
  .csv-section { flex-direction: column; align-items: stretch; text-align: center; }
  .csv-info { justify-content: center; }
  .csv-actions { justify-content: center; }
}
