/**
 * STUDIO Link 管理者ページ CSS
 */

/* ============================================
   変数
============================================ */
:root {
  --admin-primary: #1F48FF;
  --admin-primary-dark: #1a3cd9;
  --admin-danger: #dc3545;
  --admin-success: #28a745;
  --admin-warning: #ffc107;
  --admin-info: #17a2b8;
  --admin-dark: #343a40;
  --admin-light: #f8f9fa;
  --admin-border: #dee2e6;
  --admin-text: #212529;
  --admin-text-muted: #6c757d;
  --admin-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   リセット & ベース
============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--admin-light);
  color: var(--admin-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   ヘッダー
============================================ */
.admin-header {
  background: var(--admin-dark);
  color: white;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header__logo {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header__logo img {
  height: 32px;
}

/* デスクトップナビゲーション */
.admin-header__nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-header__link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.admin-header__link:hover,
.admin-header__link.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.admin-header__logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  margin-left: 12px;
}

.admin-header__logout:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   メインコンテンツ
============================================ */
.admin-main {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   カード
============================================ */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  margin-bottom: 24px;
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__title {
  font-size: 16px;
  font-weight: 600;
}

.card__body {
  padding: 20px;
}

.card__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
  background: var(--admin-light);
  border-radius: 0 0 8px 8px;
}

/* ============================================
   ボタン
============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

.btn--danger {
  background: var(--admin-danger);
  color: white;
}

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

.btn--success {
  background: var(--admin-success);
  color: white;
}

.btn--success:hover {
  background: #218838;
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
}

.btn--outline:hover {
  background: var(--admin-light);
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn--lg {
  padding: 12px 24px;
  font-size: 16px;
}

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

/* ============================================
   フォーム
============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--admin-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(31, 72, 255, 0.1);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-hint {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
}

.table th {
  background: var(--admin-light);
  font-weight: 600;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: #f8f9fa;
}

/* テーブル内のアクションボタン */
.btn-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ============================================
   ステータスバッジ
============================================ */
.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status--confirmed {
  background: #d4edda;
  color: #155724;
}

.status--cancelled {
  background: #f8d7da;
  color: #721c24;
}

.status--blocked {
  background: #fff3cd;
  color: #856404;
}

/* ============================================
   アラート
============================================ */
#alertContainer {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert {
  padding: 12px 40px 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  position: relative;
  animation: slideIn 0.3s ease;
  min-width: 300px;
  box-shadow: var(--admin-shadow);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.alert--success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid var(--admin-success);
}

.alert--error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid var(--admin-danger);
}

.alert--info {
  background: #d1ecf1;
  color: #0c5460;
  border-left: 4px solid var(--admin-info);
}

.alert--warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid var(--admin-warning);
}

.alert__close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.5;
}

.alert__close:hover {
  opacity: 1;
}

/* ============================================
   モーダル
============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  font-size: 18px;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--admin-text-muted);
}

.modal__body {
  padding: 20px;
}

.modal__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================
   ダッシュボード
============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
}

.stat-card__label {
  font-size: 14px;
  color: var(--admin-text-muted);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 600;
  color: var(--admin-primary);
}

.stat-card__sub {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

/* ============================================
   予約リスト（コンパクト版）
============================================ */
.reservation-list {
  list-style: none;
}

.reservation-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reservation-item:last-child {
  border-bottom: none;
}

.reservation-item__info {
  flex: 1;
}

.reservation-item__time {
  font-weight: 600;
  margin-bottom: 4px;
}

.reservation-item__name {
  font-size: 14px;
  color: var(--admin-text-muted);
}

/* ============================================
   フィルター
============================================ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--admin-light);
  border-radius: 8px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  font-size: 14px;
}

/* ============================================
   空状態
============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--admin-text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state__text {
  font-size: 16px;
}

/* ============================================
   ローディング
============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--admin-border);
  border-top-color: var(--admin-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   ログインページ
============================================ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-card__title {
  text-align: center;
  margin-bottom: 30px;
}

.login-card__title img {
  height: 50px;
  margin-bottom: 16px;
}

.login-card__title h1 {
  font-size: 20px;
  color: var(--admin-text);
}

.login-card__title p {
  font-size: 14px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

.login-card .btn--primary {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

.login-error {
  background: #f8d7da;
  color: #721c24;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

.login-error.show {
  display: block;
}

/* ============================================
   レスポンシブ
============================================ */
@media (max-width: 768px) {
  .admin-header {
    padding: 0 16px;
  }

  .admin-header__nav {
    display: none;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-title {
    font-size: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* テーブル操作ボタンを縦並びに */
  .table .btn-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .table .btn-actions .btn {
    width: 100%;
    white-space: nowrap;
  }

  /* フィルターのモバイル対応 */
  .filters {
    flex-direction: column;
    gap: 16px;
  }

  .filter-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-group label {
    width: 100%;
    margin-bottom: 4px;
  }

  .filter-group input,
  .filter-group select {
    flex: 1;
    min-width: 0;
  }

  /* 期間フィルターの日付入力 */
  .filter-group input[type="date"] {
    flex: 1;
    max-width: calc(50% - 16px);
  }

  .filter-group span {
    flex-shrink: 0;
  }

  /* フィルターボタンを横幅いっぱいに */
  .filters > .btn {
    width: 100%;
  }
}

/* ハンバーガーメニューボタン */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
}

/* ============================================
   モバイルメニューモーダル
============================================ */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: white;
  z-index: 201;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-menu-overlay.active .mobile-menu {
  right: 0;
}

.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--admin-dark);
  color: white;
}

.mobile-menu__title {
  font-size: 16px;
  font-weight: 600;
}

.mobile-menu__close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.mobile-menu__nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.mobile-menu__link {
  display: block;
  padding: 14px 24px;
  color: var(--admin-text);
  text-decoration: none;
  font-size: 16px;
  border-bottom: 1px solid var(--admin-border);
  transition: background 0.2s;
}

.mobile-menu__link:hover {
  background: var(--admin-light);
}

.mobile-menu__link.active {
  background: rgba(31, 72, 255, 0.1);
  color: var(--admin-primary);
  font-weight: 600;
}

.mobile-menu__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
}

.mobile-menu__logout {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--admin-danger);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.mobile-menu__logout:hover {
  background: #c82333;
}

/* ============================================
   ユーティリティ
============================================ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--admin-text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
