/* ============================================================
   管理画面 スタイルシート (css/admin.css)
   星乃ルナ Official LP - データ管理コンソール
   ============================================================ */

:root {
  --bg-main: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(18, 25, 44, 0.85);
  --bg-card-hover: rgba(28, 38, 66, 0.95);
  --bg-input: rgba(15, 23, 42, 0.9);
  --bg-modal: #111827;
  
  --primary: #7c3aed;
  --primary-hover: #9061f9;
  --primary-light: rgba(124, 58, 237, 0.15);
  --accent-cyan: #38bdf8;
  --accent-pink: #f43f5e;
  --accent-gold: #fbbf24;
  --accent-green: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(124, 58, 237, 0.5);
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.35);

  --font-base: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-en: 'Outfit', sans-serif;

  --sidebar-width: 270px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-base);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- ヘッダー --- */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ハンバーガーボタン */
.btn-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  gap: 5px;
  transition: all var(--transition);
}

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

.btn-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: #fff;
  border-radius: 2px;
  transition: all var(--transition);
}

.btn-hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.btn-hamburger.active span:nth-child(2) {
  opacity: 0;
}
.btn-hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.admin-logo-symbol {
  color: var(--accent-gold);
}

.admin-badge {
  font-size: 0.72rem;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-view-lp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.3);
  transition: all var(--transition);
}

.btn-view-lp:hover {
  background: rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.btn-reset-data {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-pink);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(244, 63, 94, 0.25);
  transition: all var(--transition);
}

.btn-reset-data:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* --- サイドバーナビゲーション --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: 95;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}

.admin-sidebar.open {
  transform: translateX(0);
}

/* PC（1024px以上）ではサイドバーを常時表示可能に */
@media (min-width: 1024px) {
  .admin-sidebar {
    transform: translateX(0);
  }
  .admin-sidebar.collapsed {
    transform: translateX(-100%);
  }
  .admin-main {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
  }
  .admin-main.expanded {
    margin-left: 0;
  }
  .sidebar-overlay {
    display: none;
  }
}

.sidebar-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-category-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 12px 6px;
  font-weight: 700;
}

.nav-link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
}

.nav-link-btn .btn-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link-btn .icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-link-btn .badge-pill {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-weight: 600;
}

.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-link-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
}

.nav-link-btn.active .badge-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-export-json, .btn-export-sql {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  font-size: 0.8rem;
  transition: all var(--transition);
}

.btn-export-json:hover, .btn-export-sql:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* --- メインコンテンツ領域 --- */
.admin-main {
  margin-top: var(--header-height);
  padding: 24px 20px 60px;
  flex: 1;
  max-width: 1200px;
  width: 100%;
}

@media (min-width: 768px) {
  .admin-main {
    padding: 32px 36px 80px;
  }
}

.admin-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.admin-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* セクションヘッダー */
.section-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.section-title-group h2 {
  font-size: 1.45rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* --- カード・パネルUI --- */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-main);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
}

/* --- フォームコンポーネント --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 768px) {
  .form-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.span-2 {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .req-tag {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-pink);
  font-weight: 700;
}

.form-label .opt-tag {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

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

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-submit-row {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* --- データリスト / テーブルUI --- */
.data-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-action-edit, .btn-action-delete {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-action-edit {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn-action-edit:hover {
  background: rgba(56, 189, 248, 0.3);
}

.btn-action-delete {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-pink);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-action-delete:hover {
  background: rgba(244, 63, 94, 0.3);
}

/* グリッドカード表示（ギャラリーなど） */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.item-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.item-card-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  position: relative;
}

.item-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.item-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.item-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-status {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-published {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-scheduled {
  background: rgba(251, 191, 36, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-draft {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* --- セクション設定（並替・表示切替）専用スタイル --- */
.section-reorder-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 600px;
}

.section-reorder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.section-reorder-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.section-reorder-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.section-reorder-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.section-reorder-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-move {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all var(--transition);
}

.btn-move:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* --- モーダルダイアログ --- */
.modal-wrapper {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-wrapper.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), var(--shadow-glow);
  transform: scale(0.95);
  transition: transform var(--transition);
}

.modal-wrapper.is-open .modal-box {
  transform: scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* --- トースト通知 --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: #1e293b;
  color: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
}

.toast.success {
  border-color: var(--accent-green);
  background: #064e3b;
}

.toast.error {
  border-color: var(--accent-pink);
  background: #881337;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 区分タグ管理用の小さなインラインエリア */
.tag-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.tag-badge-item .btn-remove-tag {
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.tag-badge-item .btn-remove-tag:hover {
  color: var(--accent-pink);
}

