/* ベーススタイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
}

/* ヘッダー */
header {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 2rem 0;
}

header h1 {
  margin-bottom: 0.5rem;
}

header p {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* メインコンテンツ */
main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.download-section {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* フォーム */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  color: #2c3e50;
}

input[type="url"] {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

input[type="url"]:focus {
  outline: none;
  border-color: #3498db;
}

/* ボタン */
button {
  padding: 0.75rem 1.5rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #2980b9;
}

button:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

/* ユーティリティクラス */
.hidden {
  display: none;
}

.error {
  color: #e74c3c;
  padding: 1rem;
  background-color: #fadbd8;
  border-radius: 4px;
  margin: 1rem 0;
}

/* フォーマットコンテナ */
#formats-container {
  margin-top: 2rem;
}

#formats-container h2 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* フォーマット凡例 */
.format-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border-left: 4px solid;
}

.legend-color.format-audio-video {
  border-left-color: #9b59b6;
}

.legend-color.format-video-only {
  border-left-color: #e74c3c;
}

.legend-color.format-audio-only {
  border-left-color: #f39c12;
}

.legend-label {
  font-size: 14px;
  color: #555;
}

/* フォーマット一覧 */
#formats-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.format-option {
  padding: 1rem;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  background-color: white;
}

.format-option:hover {
  border-color: #3498db;
  background-color: #ecf0f1;
}

.format-option.selected {
  border-color: #3498db;
  background-color: #d6eaf8;
}

.format-option.format-audio-video {
  border-left: 4px solid #9b59b6;
}

.format-option.format-audio-video:hover {
  background-color: #f4ecf7;
}

.format-option.format-audio-video.selected {
  background-color: #e8daef;
}

.format-option.format-video-only {
  border-left: 4px solid #e74c3c;
}

.format-option.format-video-only:hover {
  background-color: #fadbd8;
}

.format-option.format-video-only.selected {
  background-color: #f5b7b1;
}

.format-option.format-audio-only {
  border-left: 4px solid #f39c12;
}

.format-option.format-audio-only:hover {
  background-color: #fdebd0;
}

.format-option.format-audio-only.selected {
  background-color: #fad7a0;
}

/* ダウンロードコンテナ */
#download-container {
  margin-top: 2rem;
  text-align: center;
}

#download-btn {
  background-color: #27ae60;
}

#download-btn:hover {
  background-color: #229954;
}

/* 動画情報コンテナ */
#video-info-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.video-info {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.video-thumbnail {
  width: 320px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.video-details {
  flex: 1;
  min-width: 0;
}

.video-details h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  color: #2c3e50;
  word-wrap: break-word;
}

.video-id {
  margin: 0;
  font-size: 0.9rem;
  color: #7f8c8d;
  font-family: monospace;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .video-info {
    flex-direction: column;
    align-items: center;
  }

  .video-thumbnail {
    width: 100%;
    max-width: 480px;
    height: auto;
  }

  .video-details {
    text-align: center;
  }
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
  main {
    margin: 1rem auto;
  }

  .download-section {
    padding: 1.5rem;
  }

  header {
    padding: 1.5rem 0;
  }

  header h1 {
    font-size: 1.5rem;
  }
}
