/* Record Flow Styles - 10–15秒録音フロー */

/* ========================================
   Main Layout
   ======================================== */
.record-main {
  min-height: 100vh;
  padding: 80px 0 120px;
}

/* ========================================
   Header
   ======================================== */
.record-header {
  text-align: center;
  margin-bottom: 48px;
}

.record-header__title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.record-header__desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   Section & Card
   ======================================== */
.record-section {
  margin-bottom: 32px;
}

.record-section__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   Prompt Preview (Step2)
   ======================================== */
.prompt-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: color-mix(in oklab, var(--brand) 8%, var(--surface));
  border: 2px solid color-mix(in oklab, var(--brand) 20%, transparent);
  border-radius: 12px;
  position: sticky;
  top: 80px;
  z-index: 10;
}

.prompt-preview__content {
  flex: 1;
  min-width: 0;
}

.prompt-preview__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.prompt-preview__text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-preview__text.placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
  font-style: italic;
}

/* ========================================
   Status & Timer
   ======================================== */
.record-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: color-mix(in oklab, var(--surface) 95%, var(--brand));
  border-radius: 12px;
}

.record-status__label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.record-status__timer {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  display: none; /* Hidden by default */
}

.record-status__timer.is-visible {
  display: block;
}

.record-status__timer.is-hidden {
  display: none !important;
}

/* Timer color states */
.record-status__timer.timer--under10 {
  color: var(--text-tertiary);
}

.record-status__timer.timer--good {
  color: var(--brand);
}

.record-status__timer.timer--over {
  color: #d97706; /* Amber warning */
}

/* ========================================
   Level Meter
   ======================================== */
.record-meter {
  height: 80px;
  background: color-mix(in oklab, var(--surface) 90%, #000);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.record-meter__bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 70%, #fff));
  border-radius: 8px;
  transition: width 100ms ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .record-meter__bar {
    transition: none;
  }
}

/* ========================================
   Guide
   ======================================== */
.record-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.record-guide__icon {
  font-size: 1.125rem;
}

/* ========================================
   Control Buttons
   ======================================== */
.record-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn--large {
  min-height: 56px;
  padding: 0 32px;
  font-size: 1.0625rem;
  min-width: 200px;
}

.btn__icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 1.25rem;
}

/* ========================================
   Error
   ======================================== */
.record-error {
  margin-top: 24px;
  padding: 16px;
  background: color-mix(in oklab, #dc2626 8%, var(--surface));
  border: 1px solid color-mix(in oklab, #dc2626 20%, transparent);
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.record-error__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.record-error p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ========================================
   Preview
   ======================================== */
.record-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.record-preview__audio {
  width: 100%;
  max-width: 400px;
}

.record-preview__meta {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0;
}

#duration-display {
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   Notice
   ======================================== */
.record-notice {
  text-align: center;
  margin-top: 48px;
  padding: 24px;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-tertiary);
}

.record-notice p {
  margin: 0 0 8px;
}

.record-notice p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Fixed Mobile CTA
   ======================================== */
.record-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 28px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 16px));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

.record-cta .btn {
  width: 100%;
  min-height: 56px;
}

/* ========================================
   Toast
   ======================================== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 400px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  animation: toast-slide-in 300ms ease-out;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.toast__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast__message {
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

/* ========================================
   Stepper UI
   ======================================== */
.record-stepper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  padding: 16px;
}

.record-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.4;
  transition: opacity 200ms;
}

.record-stepper__step.is-current,
.record-stepper__step.is-completed {
  opacity: 1;
}

.record-stepper__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 200ms;
}

.record-stepper__step.is-current .record-stepper__number {
  background: var(--brand);
  color: white;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 20%, transparent);
}

.record-stepper__step.is-completed .record-stepper__number {
  background: var(--success);
  color: white;
}

.record-stepper__step.is-completed .record-stepper__number::after {
  content: '✓';
}

.record-stepper__label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
}

.record-stepper__step.is-current .record-stepper__label {
  color: var(--text-primary);
  font-weight: 600;
}

/* ========================================
   Prompt Selection (Step1)
   ======================================== */

/* Search */
.prompt-search {
  margin-bottom: 20px;
}

.prompt-search__input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color 200ms;
}

.prompt-search__input:focus {
  outline: none;
  border-color: var(--brand);
}

.prompt-search__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* Tabs */
.prompt-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.prompt-tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 200ms;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.prompt-tab:hover {
  color: var(--text-primary);
}

.prompt-tab[aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.prompt-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Prompt List */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
}

.prompt-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface) 98%, var(--bg));
  cursor: pointer;
  transition: all 200ms;
  text-align: left;
}

.prompt-item:hover {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 12%, var(--surface));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.prompt-item__text {
  font-size: 0.9375rem;
  color: #ffffff;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 4px;
}

.prompt-item__meta {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.prompt-item:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.empty-hint {
  text-align: center;
  padding: 32px;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.empty-hint.error {
  color: var(--error);
}

/* Selected Prompt Display */
.prompt-selected {
  margin-top: 16px;
  padding: 16px;
  background: color-mix(in oklab, var(--success) 15%, var(--surface));
  border: 2px solid var(--success);
  border-radius: 8px;
}

.prompt-selected__label {
  font-size: 0.8125rem;
  color: color-mix(in oklab, var(--success) 80%, black);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.prompt-selected__text {
  font-size: 1rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ========================================
   Step3: Confirmation & Submit
   ======================================== */

.title-preview {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.title-preview__label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.title-preview__text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.voista-form {
  margin-top: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 200ms;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

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

.tag-input-container {
  margin-bottom: 12px;
}

.tag-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.9375rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color 200ms;
}

.tag-input:focus {
  outline: none;
  border-color: var(--brand);
}

.tag-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--brand);
  color: white;
  border-radius: 16px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.tag-pill__remove {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 200ms;
}

.tag-pill__remove:hover {
  background: rgba(255, 255, 255, 0.2);
}

.record-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Submit button loading state */
#btn-submit[data-loading="true"] {
  position: relative;
  pointer-events: none;
}

#btn-submit[data-loading="true"] .btn__text {
  opacity: 0.5;
}

#btn-submit[data-loading="true"] .btn__spinner {
  display: inline !important;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
  .record-main {
    padding: 64px 0 140px;
  }
  
  .record-header__title {
    font-size: 1.625rem;
  }
  
  .record-card {
    padding: 24px;
  }
  
  .record-status__timer {
    font-size: 1.75rem;
  }
  
  .btn--large {
    min-width: 100%;
  }
  
  .toast {
    min-width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
  }
}

@media (min-width: 641px) {
  .record-cta {
    /* Show on desktop too for consistency */
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    justify-content: center;
    margin-top: 32px;
  }
}

/* ========================================
   Focus Visible
   ======================================== */
button:focus-visible,
audio:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 4px;
}
