/* ===================================
   Tool: beat-maker
   ビートメーカー - ステップシーケンサー
   =================================== */

/* ===================================
   Audio Overlay
   =================================== */
.audio-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.audio-overlay.hidden {
  display: none;
}

.audio-overlay-content {
  text-align: center;
  color: white;
  padding: var(--space-2xl);
}

.audio-overlay-icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.audio-overlay-content p {
  font-size: 1.2rem;
  margin-bottom: var(--space-xl);
  color: rgba(255, 255, 255, 0.8);
}

.audio-overlay-content .btn {
  font-size: 1.1rem;
  padding: var(--space-md) var(--space-xl);
}

/* ===================================
   Sequencer Card
   =================================== */
.sequencer-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* ===================================
   Transport Section
   =================================== */
.transport-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--space-lg);
}

.transport-left,
.transport-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

/* Play Button */
.play-btn {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(76, 175, 145, 0.4);
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(76, 175, 145, 0.5);
}

.play-btn:active {
  transform: scale(0.98);
}

.play-btn .play-icon,
.play-btn .stop-icon {
  font-size: 1.5rem;
  color: white;
}

.play-btn .stop-icon {
  display: none;
}

.play-btn.playing .play-icon {
  display: none;
}

.play-btn.playing .stop-icon {
  display: block;
}

/* BPM Control */
.bpm-control,
.swing-control,
.volume-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.bpm-control label,
.swing-control label,
.volume-control label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 600;
}

.bpm-control input[type="range"],
.swing-control input[type="range"],
.volume-control input[type="range"] {
  width: 100px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
}

.bpm-control input[type="range"]::-webkit-slider-thumb,
.swing-control input[type="range"]::-webkit-slider-thumb,
.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bpm-control input[type="number"] {
  width: 60px;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9rem;
  text-align: center;
}

.bpm-control input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

.swing-control span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  min-width: 40px;
}

/* ===================================
   Sequencer Grid
   =================================== */
.sequencer-container {
  overflow-x: auto;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
}

.sequencer-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 800px;
}

.sequencer-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sequencer-row.selected {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

/* Header Row */
.header-row {
  margin-bottom: var(--space-sm);
}

.track-controls-header {
  width: 200px;
  flex-shrink: 0;
}

.step-number {
  width: 40px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
  transition: all 0.1s;
}

.step-number.beat-start {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.step-number.current {
  background: rgba(76, 175, 145, 0.3);
  color: white;
}

/* Track Controls */
.track-controls {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding-right: var(--space-sm);
}

.track-name {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 80px;
}

.track-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.track-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.track-btn.active {
  color: white;
}

.mute-btn.active {
  background: #e74c3c;
}

.solo-btn.active {
  background: #f39c12;
}

.clear-btn {
  font-size: 0.9rem;
}

.clear-btn:hover {
  background: rgba(231, 76, 60, 0.5);
}

.track-volume {
  width: 50px !important;
  height: 4px !important;
}

.track-volume::-webkit-slider-thumb {
  width: 12px !important;
  height: 12px !important;
}

/* Step Cells */
.step-cell {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
  position: relative;
}

.step-cell.beat-start {
  margin-left: 8px;
}

.step-cell:first-of-type.beat-start {
  margin-left: 0;
}

.step-cell:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.step-cell.active {
  background: var(--track-color);
  box-shadow: 0 0 12px var(--track-color);
}

.step-cell.current {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.step-cell.active.current {
  box-shadow: 0 0 12px var(--track-color), inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* Beat separators */
.step-cell:nth-child(4n+2)::before {
  display: none;
}

/* ===================================
   Preset Section
   =================================== */
.preset-section {
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--space-lg);
}

.preset-section h3 {
  color: white;
  font-size: 1rem;
  margin-bottom: var(--space-md);
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.preset-btn {
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===================================
   Export Section
   =================================== */
.export-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.export-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.export-left label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.export-left select {
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

.export-left select option {
  background: #1a1a2e;
  color: white;
}

.export-buttons {
  display: flex;
  gap: var(--space-sm);
}

.export-buttons .btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ===================================
   Pattern Card
   =================================== */
.pattern-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.pattern-card h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: var(--space-lg);
}

.pattern-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.pattern-save,
.pattern-load {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.pattern-save input,
.pattern-load select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  min-width: 180px;
}

.pattern-save input:focus,
.pattern-load select:focus {
  outline: none;
  border-color: var(--accent);
}

.pattern-import {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.pattern-import textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.pattern-import textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #c0392b;
}

/* ===================================
   Sidebar
   =================================== */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.shortcut-item kbd {
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* ===================================
   Tips Section
   =================================== */
.tips-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.tips-header {
  margin-bottom: var(--space-lg);
}

.tips-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.tip-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  gap: var(--space-md);
}

.tip-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.tip-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.tip-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 1024px) {
  .tips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .transport-section {
    flex-direction: column;
    align-items: stretch;
  }

  .transport-left,
  .transport-right {
    justify-content: center;
  }

  .play-btn {
    width: 56px;
    height: 56px;
  }

  .track-controls {
    width: 160px;
    min-width: 160px;
  }

  .track-name {
    min-width: 60px;
    font-size: 0.75rem;
  }

  .step-cell {
    width: 32px;
    height: 32px;
  }

  .step-number {
    width: 32px;
    font-size: 0.7rem;
  }

  .step-cell.beat-start {
    margin-left: 6px;
  }

  .sequencer-grid {
    min-width: 650px;
  }

  .preset-grid {
    justify-content: center;
  }

  .export-section {
    flex-direction: column;
    align-items: stretch;
  }

  .export-left,
  .export-buttons {
    justify-content: center;
  }

  .pattern-actions {
    flex-direction: column;
  }

  .pattern-save,
  .pattern-load {
    flex-direction: column;
  }

  .pattern-save input,
  .pattern-load select {
    width: 100%;
  }

  .tips-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .sequencer-card {
    padding: var(--space-md);
  }

  .track-controls {
    width: 140px;
    min-width: 140px;
  }

  .track-name {
    min-width: 50px;
    font-size: 0.7rem;
  }

  .track-btn {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
  }

  .track-volume {
    width: 40px !important;
  }

  .step-cell {
    width: 28px;
    height: 28px;
  }

  .step-number {
    width: 28px;
    font-size: 0.65rem;
  }

  .step-cell.beat-start {
    margin-left: 4px;
  }

  .sequencer-grid {
    min-width: 560px;
  }

  .bpm-control input[type="range"],
  .swing-control input[type="range"],
  .volume-control input[type="range"] {
    width: 80px;
  }

  .shortcut-item {
    font-size: 0.85rem;
  }

  .shortcut-item kbd {
    font-size: 0.75rem;
  }
}

/* ===================================
   Touch Device Optimization
   =================================== */
@media (hover: none) {
  .step-cell {
    min-width: 44px;
    min-height: 44px;
  }

  .track-btn {
    min-width: 32px;
    min-height: 32px;
  }

  .preset-btn {
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
  }
}

/* ===================================
   Toast (ensure visibility on dark bg)
   =================================== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-md) var(--space-xl);
  background: var(--dark-forest);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: linear-gradient(135deg, var(--accent), var(--teal));
}

.toast.error {
  background: #e74c3c;
}

.toast.info {
  background: #3498db;
}
