/* ==========================================================================
   ゼロナレッジ・暗号化作品トラッカー スタイルシート
   洗練されたダーク/ネオンサイバー・モダンデザイン
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-card: rgba(22, 27, 46, 0.7);
  --bg-card-hover: rgba(28, 35, 60, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(168, 85, 247, 0.12) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.6;
  padding-bottom: 60px;
}

/* --- コンテナ --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* --- ヘッダー --- */
.header {
  text-align: center;
  margin-bottom: 35px;
  position: relative;
}

.site-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  color: #a5b4fc;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.site-badge .dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

.site-title {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.site-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- ナビゲーション・アクションバー --- */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.nav-link-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.admin-trigger-btn {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}

.admin-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* --- 鑑賞を許可バナー / モーダル --- */
.permission-gate {
  background: linear-gradient(135deg, rgba(22, 27, 46, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  border-radius: 16px;
  padding: 35px 25px;
  text-align: center;
  margin-bottom: 40px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.permission-gate::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
}

.gate-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.gate-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.gate-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.grant-btn {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 14px 36px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.25s ease;
}

.grant-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.6);
}

.grant-btn:active {
  transform: translateY(0);
}

/* 許可済み状態表示 */
.permission-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 30px;
}

.permission-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #34d399;
}

.revoke-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.revoke-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* --- 絞り込みフィルターバー --- */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
  background: var(--primary-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* --- 作品カード一覧 --- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.work-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.work-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.genre-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.genre-anime {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.genre-manga {
  background: rgba(236, 72, 153, 0.18);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.genre-cg {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.genre-game {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.genre-other {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

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

.work-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-main);
  line-height: 1.4;
}

.work-title a {
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline;
}

.work-title a:hover {
  color: #818cf8;
  text-decoration: underline;
}

.work-author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* マスク（暗号化）表示状態 */
.work-card.encrypted-view .work-title,
.work-card.encrypted-view .work-author-row span,
.work-card.encrypted-view .genre-badge {
  filter: blur(5px);
  user-select: none;
  opacity: 0.5;
}

.work-card.encrypted-view::after {
  content: "暗号化保護中";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #cbd5e1;
  pointer-events: none;
}

/* --- 管理者登録モーダル --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

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

.modal-card {
  background: #131a2e;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  padding: 30px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  transform: scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal-btn:hover {
  color: var(--text-main);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* 暗号化プレビューエリア */
.crypto-preview {
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #818cf8;
  word-break: break-all;
}

.crypto-preview-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: #a5b4fc;
}

.submit-btn {
  width: 100%;
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.submit-btn:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

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

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

.empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.6;
}

/* 汎用表示制御クラス（インラインstyle排除用） */
.is-hidden {
  display: none !important;
}
