/* 管理ダッシュボード スタイル */
:root {
  --color-bg: #f5f0e6;
  --color-card-bg: #ffffff;
  --color-primary: #b35917;
  --color-primary-hover: #d97724;
  --color-secondary: #5c4d3e;
  --color-text-main: #2b221a;
  --color-text-muted: #736252;
  --color-border: #e0d5c3;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-info: #17a2b8;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  padding: 1.5rem;
}

.admin-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

/* ヘッダー */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-card-bg);
  padding: 1.2rem 1.8rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border-left: 5px solid var(--color-primary);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.2rem;
}

.admin-header h1 {
  font-size: 1.35rem;
  color: var(--color-text-main);
  font-weight: 700;
}

.admin-header .subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.btn-visit-site {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #fdfbf7;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-visit-site:hover {
  background: var(--color-primary);
  color: #fff;
}

/* カードセクション */
.admin-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.8rem;
  border: 1px solid var(--color-border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.9rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--color-border);
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.desc-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.2rem;
  line-height: 1.6;
}

/* バッジ */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: #faf8f5;
  color: var(--color-text-main);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

.btn-toggle-mask {
  background: #eadecf;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0 0.8rem;
  cursor: pointer;
  font-size: 1rem;
}

.helper-text {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ボタン */
.btn-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: #e8ded1;
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background: #ded1c0;
}

.btn-danger-outline {
  background: #fff;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

.btn-danger-outline:hover {
  background: var(--color-danger);
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 4px;
}

/* テスト結果ボックス */
.test-result-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.test-result-box.success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
}

.test-result-box.error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

/* 統計バー */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.stat-pill {
  background: #f7f3ec;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.stat-label {
  color: var(--color-text-muted);
}

/* テーブル */
.table-container {
  overflow-x: auto;
}

.letters-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.letters-table th,
.letters-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.letters-table th {
  background: #faf6ef;
  color: var(--color-text-muted);
  font-weight: 600;
}

.letters-table tr:hover {
  background: #fcfaf6;
}

.sender-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.content-snippet {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #554433;
}

.music-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.music-title-text {
  font-weight: 600;
  color: var(--color-text-main);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
}

/* モーダル */
.admin-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.admin-modal.active {
  display: flex;
}

.admin-modal-content {
  background: #ffffff;
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.4rem;
  background: #faf6ef;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  font-size: 1.05rem;
  color: var(--color-text-main);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.modal-body {
  padding: 1.4rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

/* 試聴プレーヤー */
.preview-player-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  margin: 1rem 0;
}

.preview-player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.preview-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.preview-info {
  font-size: 0.85rem;
  color: var(--color-text-main);
  background: #fdfaf5;
  padding: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

/* トースト */
.admin-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #33271d;
  color: #fff;
  padding: 0.8rem 1.4rem;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  font-size: 0.9rem;
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ログインカード */
.login-card {
  max-width: 480px;
  margin: 3.5rem auto;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--color-primary);
}

.login-error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.6rem;
}
