/**
 * MUGnet User Portal - スタイルシート
 * MUGnetデザインガイドラインに準拠
 */

/* ===== 基本設定 ===== */
:root {
  /* カラー設定（モノトーン） */
  --color-bg: #ffffff;
  --color-text: #1A1A1A;
  --color-text-light: #333333;
  --color-border: #e2e8f0;
  --color-hover: #f5f5f5;
  --color-success: #4a5568;
  --color-error: #2d3748;
  --color-info: #718096;
  
  /* フォント設定 */
  --font-family: 'Noto Serif JP', Georgia, serif;
  
  /* サイズ設定 */
  --content-width: 720px;
  --section-spacing: 80px;
}

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

/* ===== 基本スタイル ===== */
body {
  font-family: var(--font-family);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  letter-spacing: 0.03em;
}

a {
  color: var(--color-text);
  text-decoration: underline;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--color-text-light);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  margin-bottom: 1rem;
  line-height: 1.4;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
}

h3 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}

p {
  margin-bottom: 1.5rem;
}

button, .submit-button {
  font-family: var(--font-family);
  font-size: 1rem;
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover, .submit-button:hover {
  background: var(--color-hover);
}

input, select, textarea {
  font-family: var(--font-family);
  font-size: 1rem;
  padding: 0.7rem;
  border: 1px solid var(--color-border);
  width: 100%;
  margin-bottom: 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
}

textarea {
  min-height: 150px;
  line-height: 1.7;
}

/* ===== レイアウト ===== */
.site-header, .site-content, .site-footer {
  width: 100%;
}

.header-container, .footer-container, 
.login-container, .dashboard-container, 
.register-container, .interpret-container,
.interpretations-container, .ranking-container,
.archive-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.site-content {
  min-height: calc(100vh - 200px);
  padding: var(--section-spacing) 0;
}

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.9rem;
}

/* ===== ヘッダー ===== */
.site-logo {
  text-align: center;
}

.logo-img {
  max-height: 50px;
}

.main-nav {
  margin-top: 1.5rem;
}

.nav-menu {
  display: flex;
  justify-content: center;
  list-style: none;
  flex-wrap: wrap;
}

.nav-menu li {
  margin: 0 1rem;
}

/* ===== メッセージ ===== */
.message {
  padding: 1rem;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
  text-align: center;
}

.message-success {
  border-color: var(--color-success);
}

.message-error {
  border-color: var(--color-error);
}

.message-info {
  border-color: var(--color-info);
}

/* ===== ログインページ ===== */
.login-container {
  text-align: center;
}

.login-container h2 {
  margin-bottom: 2rem;
}

.login-container p {
  margin-bottom: 2rem;
}

.oauth-login {
  margin: 2rem 0;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 250px;
  padding: 0.8rem 1rem;
  text-decoration: none;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  background-color: white;
  color: #757575;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-google:hover {
  background-color: #f5f5f5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-google img {
  width: 24px;
  height: 24px;
}

/* ===== ダッシュボード ===== */
.user-profile-section {
  margin-bottom: var(--section-spacing);
  text-align: center;
}

.fan-level-box {
  margin: 2rem 0;
  padding: 2rem;
  border: 1px solid var(--color-border);
}

.level-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-label {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.level-value {
  font-size: 3rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.user-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 1rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 400;
}

.action-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.action-button {
  display: inline-block;
  padding: 1rem 2rem;
  text-decoration: none;
  border: 1px solid var(--color-text);
}

.activity-list {
  list-style: none;
  margin: 2rem 0;
}

.activity-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
}

.view-all {
  text-align: center;
  margin-top: 2rem;
}

.logout-section {
  text-align: center;
  margin-top: var(--section-spacing);
}

/* ===== シリアル登録 ===== */
.register-section, .register-qr-section, .archive-import-section {
  margin-bottom: var(--section-spacing);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.qr-scan-area {
  margin-top: 2rem;
  text-align: center;
}

#qr-video-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 1rem;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

#qr-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* QRコード全画面表示用スタイル */
#qr-video:fullscreen {
  object-fit: contain;
  background-color: black;
}

#qr-video:-webkit-full-screen {
  object-fit: contain;
  background-color: black;
}

#qr-video:-ms-fullscreen {
  object-fit: contain;
  background-color: black;
}

/* スキャンボタン */
.scan-button {
  margin-top: 1rem;
}

/* QRスキャン中のオーバーレイ */
.qr-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
}

.qr-overlay.active {
  display: flex;
}

.qr-overlay-message {
  margin-top: 1rem;
  font-size: 1.2rem;
}

.qr-scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  max-width: 300px;
  height: 80vw;
  max-height: 300px;
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ===== 解釈投稿 ===== */
.interpret-form {
  margin-bottom: var(--section-spacing);
}

.form-check {
  display: flex;
  align-items: center;
}

.form-check input {
  width: auto;
  margin-right: 0.5rem;
}

.form-note {
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ===== 解釈一覧 ===== */
.filter-section {
  margin-bottom: 2rem;
}

.interpretation-item {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.interpretation-header {
  margin-bottom: 1.5rem;
}

.interpretation-meta {
  font-size: 0.9rem;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.interpretation-body {
  margin-bottom: 1.5rem;
}

.interpretation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  border: 1px solid var(--color-border);
}

/* ===== ランキング ===== */
.ranking-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tab-link {
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.tab-link.active {
  border-bottom: 2px solid var(--color-text);
}

.my-ranking {
  margin-bottom: 3rem;
}

.my-rank-card {
  padding: 2rem;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.rank-number {
  font-size: 2.5rem;
  font-weight: 400;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

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

.ranking-table th {
  font-weight: 400;
}

.is-me {
  background-color: var(--color-hover);
}

/* ===== アーカイブ ===== */
.archive-section {
  margin-bottom: var(--section-spacing);
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 768px) {
  :root {
    --section-spacing: 60px;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.2rem;
  }
  
  .user-stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-button {
    width: 100%;
    text-align: center;
  }
  
  .my-rank-card {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .ranking-table th, .ranking-table td {
    padding: 0.8rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* プロフィール編集ページ */
.profile-edit-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.profile-edit-form .form-group {
    margin-bottom: 20px;
}

.profile-edit-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.profile-edit-form .required {
    color: #e74c3c;
}

.profile-edit-form .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

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

.profile-edit-form .form-text {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #777;
}

.profile-edit-form .form-check {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.profile-edit-form .form-check-input {
    margin-right: 10px;
}

.profile-edit-form .form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 30px;
}

.profile-edit-form .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.profile-edit-form .btn-primary {
    background-color: #3498db;
    color: white;
}

.profile-edit-form .btn-primary:hover {
    background-color: #2980b9;
}

.profile-edit-form .btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.profile-edit-form .btn-secondary:hover {
    background-color: #7f8c8d;
}

/* ダッシュボードのプロフィール編集リンク */
.profile-edit-link {
    margin-top: 15px;
}

.profile-edit-link .btn-outline-primary {
    padding: 5px 10px;
    border: 1px solid #3498db;
    border-radius: 4px;
    background-color: transparent;
    color: #3498db;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.profile-edit-link .btn-outline-primary:hover {
    background-color: #3498db;
    color: white;
}

/* ユーザープロフィールの自己紹介 */
.user-bio {
    margin: 15px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
}

/* 本棚ページ */
.bookshelf-container {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f5f0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bookshelf {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
    position: relative;
    min-height: 300px;
}

/* 本棚の棚板 */
.shelf {
    position: absolute;
    left: 0;
    right: 0;
    height: 15px;
    background-color: #8b5a2b;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.shelf:nth-child(1) {
    bottom: 0;
}

.shelf:nth-child(2) {
    bottom: 33%;
}

.shelf:nth-child(3) {
    bottom: 66%;
}

.book-item {
    position: relative;
    width: 150px;
    margin-bottom: 20px;
    z-index: 1;
}

.book {
    width: 100%;
    height: 220px;
    perspective: 1000px;
    transition: transform 0.3s ease;
    margin-bottom: 10px;
}

.book:hover {
    transform: translateY(-10px);
}

.book img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.book-cover {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0d8c0, #c4b59d);
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 15px;
    text-align: center;
}

.book-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    word-break: break-word;
}

.book-author {
    font-size: 14px;
    color: #666;
}

.book-info {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    text-align: center;
}

.book-item:hover .book-info {
    display: block;
}

.book-info h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #333;
}

.empty-bookshelf {
    text-align: center;
    width: 100%;
}

.empty-message {
    margin-top: 30px;
    padding: 20px;
}

.empty-message p {
    margin-bottom: 15px;
    color: #666;
    font-size: 16px;
}

.back-link {
    margin-top: 20px;
    text-align: center;
}

.back-link a {
    color: #3498db;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .bookshelf {
        justify-content: center;
    }
    
    .book-item {
        width: 120px;
    }
    
    .book {
        height: 180px;
    }
    
    .book-info {
        width: 180px;
    }
    
    .book-title {
        font-size: 14px;
    }
    
    .book-author {
        font-size: 12px;
    }
}

/* ===== 管理者パネル ===== */
.admin-panel, .admin-users, .admin-serials, .admin-works, .admin-logs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.admin-header h2 {
  margin-bottom: 0;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
}

.admin-content {
  margin-top: 2rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  border: 1px solid var(--color-border);
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 400;
  margin: 1rem 0;
}

.stat-detail {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.stat-link {
  display: inline-block;
  margin-top: 0.5rem;
  text-decoration: none;
}

.admin-link {
  font-weight: bold;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.data-table th {
  background-color: var(--color-hover);
  font-weight: 400;
}

.data-table tr:hover {
  background-color: var(--color-hover);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 2px;
  background-color: var(--color-border);
}

.badge-admin {
  background-color: var(--color-text);
  color: white;
}

.badge-user {
  background-color: var(--color-border);
  color: var(--color-text);
}

.badge-used {
  background-color: var(--color-info);
  color: white;
}

.badge-unused {
  background-color: var(--color-success);
  color: white;
}

.badge-info {
  background-color: var(--color-info);
  color: white;
}

.pagination {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  gap: 0.5rem;
}

.page-link {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  text-decoration: none;
}

.page-link.active {
  background-color: var(--color-text);
  color: white;
  border-color: var(--color-text);
}

.page-link:hover:not(.active) {
  background-color: var(--color-hover);
}

.admin-filters {
  margin: 2rem 0;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.user-count, .code-count {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-hover);
}

.admin-tools {
  margin-top: 3rem;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  border: 1px solid var(--color-border);
  padding: 1.5rem;
}

.tool-card h3 {
  margin-bottom: 1rem;
}

.tool-card p {
  margin-bottom: 1.5rem;
}

.admin-form-container {
  max-width: 600px;
  margin: 0 auto;
}

.admin-form {
  border: 1px solid var(--color-border);
  padding: 2rem;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}

.inline-form {
  display: inline-block;
}

.serial-codes-result {
  border: 1px solid var(--color-border);
  padding: 2rem;
  margin-bottom: 2rem;
}

.code-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.code-item {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  background-color: var(--color-hover);
  font-family: monospace;
  font-size: 1rem;
}

.used-code {
  color: var(--color-text-light);
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

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

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

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}

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

.btn-warning {
  background-color: var(--color-info);
  color: white;
  border-color: var(--color-info);
}

.btn-warning:hover {
  opacity: 0.9;
}

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

.btn-danger:hover {
  opacity: 0.9;
}

@media (max-width: 768px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .admin-actions {
    flex-wrap: wrap;
  }
  
  .stat-cards {
    grid-template-columns: 1fr;
  }
  
  .tool-cards {
    grid-template-columns: 1fr;
  }
  
  .data-table {
    display: block;
    overflow-x: auto;
  }
  
  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
} 