/* ===================================
エディターセクション
=================================== */
.editor-section {
  display: none;
}

/* ===================================
ファイル情報セクション
=================================== */
.file-info {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-info-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-name {
  font-weight: bold;
  color: var(--text-primary);
  font-size: 18px;
}

.file-details {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-secondary);
}

.file-detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-detail-item i {
  color: var(--text-secondary);
  font-size: 14px;
}

.new-file-btn {
  background-color: var(--accent);
  color: var(--primary);
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.new-file-btn:hover {
  background-color: var(--accent-dark);
}

/* ===================================
設定パネル
=================================== */
.settings-panel {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
}

.settings-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===================================
スライダー
=================================== */
.slider {
  width: 100%;
  height: 6px;
  background: var(--gray-300);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: all 0.3s;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--accent-dark);
  transform: scale(1.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

/* ===================================
メーターセクション
=================================== */
.meters-section {
  background: var(--primary);
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  position: relative;
}

.meters-container {
  display: flex;
  justify-content: space-around;
  gap: 0;
  margin-top: 20px;
}

.meter-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.meter-title {
  font-weight: bold;
  color: var(--text-light);
  margin-bottom: 15px;
  font-size: 14px;
  text-align: center;
}

.vertical-meter-container {
  position: relative;
  height: 200px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.meter-scale {
  position: relative;
  height: 100%;
  width: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: #bdc3c7;
}

.scale-mark {
  position: absolute;
  right: 0;
  transform: translateY(50%);
}

.vertical-meter-bar {
  width: 40px;
  height: 100%;
  background: var(--primary-dark);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.vertical-meter-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to top, 
    #28a745 0%,
    #28a745 60%,
    #ffc107 75%,
    #ff6b6b 90%,
    #dc3545 100%
  );
  transition: height 0.05s ease-out;
  height: 0%;
}

/* Gain reduction meter specific */
.gr-meter {
  background: #1a252f;
}

.gr-fill {
  background: linear-gradient(to bottom,
    #16a085 0%,
    #138d75 50%,
    #0e6655 100%
  );
  top: 0;
  bottom: auto;
}

.vertical-peak-marker {
  position: absolute;
  width: 100%;
  height: 2px;
  background: #ff0000;
  bottom: 0;
  display: none;
  z-index: 10;
}

.meter-value {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-light);
  font-family: monospace;
  font-weight: bold;
}

.peak-value {
  font-size: 12px;
  color: #e74c3c;
  font-family: monospace;
  margin-top: 5px;
}

/* ===================================
オーディオプレーヤーセクション
=================================== */
.audio-players-section {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.audio-player {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 15px;
}

.audio-player:last-child {
  margin-bottom: 0;
}

.player-title {
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-title i {
  color: var(--text-primary);
}

.audio-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

.play-btn, .stop-btn {
  border: none;
  border-radius: 5px;
  width: 40px;
  height: 40px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.play-btn {
  background: var(--info);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 20px;
}

.play-btn:hover {
  background: var(--info-hover);
  transform: scale(1.05);
}

.play-btn.playing {
  background: var(--danger);
}

.play-btn.playing:hover {
  background: var(--danger-hover);
}

.stop-btn {
  background: var(--gray-500);
}

.stop-btn:hover {
  background: var(--gray-700);
}

.play-btn:disabled, .stop-btn:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
}

.audio-time {
  font-size: 14px;
  color: var(--text-secondary);
  font-family: monospace;
  margin-left: 10px;
}

.audio-player .progress-container {
  width: 100%;
  height: 8px;
  background: var(--gray-300);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: visible;
  padding: 8px 0; /* クリック領域を拡大 */
  margin: -8px 0; /* パディングの補正 */
  display: block; /* 明示的に表示 */
}

.audio-player .progress-bar {
  height: 100%;
  background: var(--info);
  border-radius: 4px;
  width: 0%;
  transition: width 0.1s;
}

.audio-player .progress-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--info);
  border: 2px solid white;
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  left: 0%;
  display: none;
}

.audio-player .progress-thumb:active {
  cursor: grabbing;
}

.audio-player .progress-container:hover .progress-thumb {
  transform: translate(-50%, -50%) scale(1.2);
}

/* ===================================
プリセットボタン
=================================== */
.preset-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.preset-label {
  font-weight: bold;
  color: var(--text-primary);
  margin-right: 10px;
  font-size: 14px;
}

.preset-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-btn:hover {
  background: var(--gray-100);
  border-color: var(--accent);
}

.preset-btn.active {
  background: var(--accent);
  color: var(--primary);
  border-color: var(--accent);
}

/* ===================================
設定グリッド
=================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.setting-item {
  background: white;
  border-radius: 6px;
  padding: 20px;
  border: 1px solid var(--gray-300);
  transition: all 0.3s;
}

.setting-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.1);
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.setting-label {
  font-weight: bold;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-value {
  color: var(--info);
  font-weight: bold;
  font-size: 14px;
  font-family: monospace;
}

.setting-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.4;
}

/* ===================================
波形表示
=================================== */
.waveform-section {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
  display: none;
}

.waveform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.waveform-box {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 15px;
  position: relative;
}

.waveform-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-align: center;
  font-weight: bold;
}

.waveform-canvas {
  width: 100%;
  height: 120px;
  background: var(--bg-primary);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}

.waveform-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-size: 14px;
  display: none;
  background: rgba(255,255,255,0.9);
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: var(--shadow-sm);
}

.processing-indicator {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* 自動更新インジケーター */
.auto-update-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  color: var(--success);
  display: none;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  border-radius: 3px;
}

/* ===================================
エクスポートセクション
=================================== */
.export-section {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  margin-top: 30px;
}

/* フォーマット選択 */
.format-selection {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.format-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
}

.format-option:hover {
  border-color: var(--accent);
  background: rgba(243, 156, 18, 0.05);
}

.format-option input[type="radio"] {
  display: none;
}

.format-option input[type="radio"]:checked + span {
  color: var(--accent);
  font-weight: bold;
}

.format-option:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: rgba(243, 156, 18, 0.1);
}

.export-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 5px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.export-btn:hover {
  background: var(--success-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.export-btn:disabled {
  background: var(--gray-500);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===================================
処理中オーバーレイ
=================================== */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.processing-modal {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
}

.processing-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--gray-100);
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.processing-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.processing-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.processing-progress {
  width: 100%;
  height: 6px;
  background: var(--gray-300);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.processing-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
  width: 0%;
}

/* ===================================
レスポンシブ対応
=================================== */
@media (max-width: 768px) {
  .file-info {
    flex-direction: column;
    gap: 15px;
  }
  
  .file-details {
    gap: 15px;
  }
  
  .new-file-btn {
    width: 100%;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .meters-container {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  
  .vertical-meter-container {
    height: 150px;
  }
  
  .waveform-grid {
    grid-template-columns: 1fr;
  }
  
  .audio-controls {
    flex-wrap: wrap;
  }
  
  .preset-container {
    justify-content: center;
  }
  
  .settings-panel {
    padding: 20px;
  }
}

/* ===================================
アニメーション
=================================== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}