/* =========================================================
   Components — Plan Table, Inputs, Submit Button, Orient
   ========================================================= */

/* --- Orientation Toggle ---------------------------------- */
.orient-toggle {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  justify-content: center;
}

.orient-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-6);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-ink-subtle);
  background: transparent;
  border: 1px solid var(--color-rule-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.orient-btn:hover {
  background: var(--color-surface);
  color: var(--color-ink);
}

.orient-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
}

/* Portrait grid override */
.result-section.portrait .result-grid {
  grid-template-columns: 1fr 2fr 2fr 1fr;
}

.result-section.portrait .result-image-frame {
  grid-column: 2;
  max-width: unset;
  width: auto;
}

/* --- Plan Table ------------------------------------------ */
.plan-table-wrap {
  background: var(--color-white);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.plan-table col.col-label { width: 26%; }
.plan-table col.col-input { width: 74%; }

.plan-table thead tr {
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-accent);
}

.plan-table thead th {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-ink-subtle);
  padding: var(--sp-3) var(--sp-6);
  text-align: left;
}

.plan-table thead th.th-input {
  color: var(--color-accent);
}

.plan-table tbody tr {
  border-bottom: 1px solid var(--color-rule);
  transition: background var(--dur-fast) var(--ease-smooth);
}

.plan-table tbody tr:last-child {
  border-bottom: none;
}

.plan-table tbody tr:hover {
  background: var(--color-surface);
}

.plan-table tbody tr:hover .cell-label {
  color: var(--color-ink);
}

.cell-label {
  padding: var(--sp-4) var(--sp-6);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-ink-subtle);
  vertical-align: middle;
  white-space: nowrap;
  user-select: none;
  transition: color var(--dur-fast);
  border-right: 1px solid var(--color-rule);
  line-height: var(--leading-normal);
}

.cell-label .label-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  margin-right: var(--sp-2);
  opacity: 0.7;
}

.cell-input {
  padding: var(--sp-2) var(--sp-4);
  vertical-align: middle;
}

/* --- Textarea Input ------------------------------------- */
.field-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  outline: none;
  resize: none;
  overflow: hidden;
  transition:
    border-color var(--dur-base) var(--ease-smooth),
    background var(--dur-fast) var(--ease-smooth);
  border-radius: 0;
}

.field-input::placeholder {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-style: italic;
}

.field-input:focus {
  background: var(--color-surface);
  border-bottom-color: var(--color-accent);
}

.field-input.error {
  border-bottom-color: #c0392b;
  background: #fff5f4;
}

/* --- Submit Button --------------------------------------- */
.submit-area {
  margin-top: var(--sp-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
}

.btn-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-12);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  color: var(--color-white);
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition:
    background var(--dur-base) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-base) var(--ease-smooth);
  box-shadow: 0 2px 8px rgba(139,37,0,0.3), 0 0 0 0 rgba(139,37,0,0);
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.btn-submit::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--dur-slow) var(--ease-smooth), height var(--dur-slow) var(--ease-smooth), opacity var(--dur-slow);
  opacity: 0;
}

.btn-submit:hover {
  background: var(--color-accent-mid);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139,37,0,0.35), 0 0 0 0 rgba(139,37,0,0);
}

.btn-submit:active::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(139,37,0,0.3);
}

.btn-submit:disabled {
  background: var(--color-ink-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-submit .btn-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--dur-base) var(--ease-gallery);
}

.btn-submit:hover .btn-icon {
  transform: translateX(3px);
}

.btn-hint {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  letter-spacing: 0.04em;
}

/* --- Validation Error ------------------------------------ */
.form-error-msg {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: #c0392b;
  margin-top: var(--sp-2);
  text-align: center;
  display: none;
}

.form-error-msg.visible {
  display: block;
}

