/* /css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

/* ============================
   カラーテーマの一元管理
============================ */
:root {
  --primary-color: #3CB371;
  --primary-text: #ffffff;
  --background-color: #f9f9f9;
  --text-color: #333333;
  --footer-link: #e0e0e0;
  --footer-link-hover: #ffffff;
  --btn-bg: #007bff;
  --btn-hover-bg: #0056b3;
  --btn-text: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================
   共通スタイル
============================ */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
}

main {
  padding: 2rem;
  max-width: 1200px;
  margin: auto;
}

h1, h2 {
  text-align: center;
  margin-bottom: 1rem;
}

form {
  text-align: center;
  margin-bottom: 2rem;
}

input[type="text"] {
  padding: 0.6rem;
  font-size: 1rem;
  width: 60%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button, .btn-toggle {
  background-color: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
}

button:hover, .btn-toggle:hover {
  background-color: var(--btn-hover-bg);
}

/* ============================
   ヘッダー
============================ */
header {
  background-color: var(--primary-color);
  color: var(--primary-text);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header .logo {
  flex-shrink: 0;
}

.logo-img {
  height: auto;
  max-height: 60px;
  width: auto;
  display: block;
  max-width: 100%;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.select-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

select {
  padding: 0.4rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  min-width: 80px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lang-select {
  max-width: 150px;
}

/* ============================
   検索ボックス（ヘッダー）
============================ */
.search-box {
  display: flex;
  gap: 0.5rem;
  flex-grow: 1;
  max-width: 300px;
}
.search-box input {
  flex-grow: 1;
  padding: 0.4rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.search-box button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* ============================
   映画カード（index.html）
============================ */
#movie-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5rem;
  padding-top: 1rem;
}

.movie-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
  padding: 1rem;
}

.movie-card img {
  width: 100%;
  border-radius: 6px;
}

.movie-card p {
  font-weight: 600;
  margin: 0.5rem 0 0;
  color: var(--text-color);
}

.movie-card a {
  text-decoration: none;
}

/* ============================
   フッター
============================ */
footer {
  text-align: center;
  padding: 1rem;
  background-color: var(--primary-color);
  color: var(--primary-text);
  margin-top: 2rem;
  font-size: 0.9rem;
}

footer a {
  color: var(--footer-link);
  text-decoration: underline;
}

footer a:hover {
  color: var(--footer-link-hover);
  text-decoration: none;
}

.footer-copy,
.footer-note {
  color: var(--primary-text);  /* ← コピーライトや補足の文字も白に */
}
/* 
.footer-link {
  color: #555;
  text-decoration: underline;
}

.footer-link:hover {
  color: #333;
}
 */
/* ============================
   movie.html 用スタイル
============================ */
.movie-detail-grid {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.poster-container {
  flex-shrink: 0;
  width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.poster-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 0.5em;
}

.info-section {
  flex-grow: 1;
  min-width: 300px;
}

.info-section p {
  margin-bottom: 0.5rem;
}

.overview-section {
  margin-top: 1.5rem;
}

.overview-content {
  margin-top: 0.5rem;
  line-height: 1.6;
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.user-votes-section h2 {
  text-align: left;
  margin-bottom: 1.5rem;
}

.vote-group {
  background-color: #f5f5f5;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #eee;
}

.vote-group .results {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #555;
}

.vote-group label {
  display: inline-flex;
  align-items: center;
  margin-right: 1.5rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.vote-group input[type="radio"] {
  margin-right: 0.5rem;
  transform: scale(1.2);
}

#toggle-poster-button {
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  box-sizing: border-box;
  border-radius: 4px;
  align-self: center;
}

#poster,
#poster-placeholder {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  box-sizing: border-box;
  display: block;
  margin: 0;
}

#poster {
  border: none;
  object-fit: cover;
  box-shadow: var(--shadow);
}

#poster-placeholder {
  border: 2px solid #888;
  background-color: #f0f0f0;
  color: #555;
  font-weight: bold;
  font-size: 1.2em;
  user-select: none;
  position: relative;
  box-shadow: var(--shadow);
}

#poster-placeholder span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* ============================
   レスポンシブ対応
============================ */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.5rem;
  }

  .search-box {
    width: 100%;
    max-width: none;
    gap: 0.5rem;
  }

  main {
    padding: 1rem;
  }

  input[type="text"] {
    width: 90%;
  }
/* 
  .movie-detail-grid {
    flex-direction: column;
    align-items: center;
  }

  .poster-container, .info-section {
    width: 100%;
    text-align: center;
  }
 */
  .poster-container img {
    max-width: 200px;
  }
}

@media (min-width: 500px) {
  .movie-detail-grid {
    flex-wrap: wrap;  /* ← まず wrap にする。強制横並びはやめる */
  }

  .poster-container {
    flex: 0 0 200px;
  }

  .info-section {
    flex: 1 1 0;
    min-width: 0; /* ← 300px ではなく、0 にして縮められるように */
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

.element-toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.5em;
}

.element-toggle-button {
  padding: 6px 12px;
  margin: 4px 4px 8px 0;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #f0f0f0;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.element-toggle-button:hover {
  background-color: #e0e0ff;
  color: #111;
  border-color: #888;
}

.element-toggle-button:active,
.element-toggle-button.selected {
  background-color: #d0e0ff;
  color: #000;
  border-color: #333;
  font-weight: bold;
}

/* ============================
   問い合わせフォーム
============================ */

  #contact-form {
    max-width: 500px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: sans-serif;
    background-color: #fafafa;
  }

  #contact-form input,
  #contact-form textarea {
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #bbb;
    width: 100%;
    box-sizing: border-box;
  }

#contact-form button {
  padding: 0.6rem 1.5rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  align-self: center;
}

#contact-form button:hover {
  background-color: #0056b3;
}

#result-message {
  text-align: center;
  font-weight: bold;
  margin-top: 1rem;
}
  
/* ===== Loading Spinner Overlay ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 共通スピナー */
.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #333;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;

  box-sizing: border-box;
  flex-shrink: 0;
}

/* 全画面ローディングオーバーレイ */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

/* ローカル埋め込み or オーバーレイ */
.loading-local,
.local-loading-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: rgba(255, 255, 255, 0.7); /* 適度な透過背景 */
  /* padding: 20px; */
  z-index: 10;

  box-sizing: border-box;
  pointer-events: none;
}

/* オーバーレイの場合の絶対位置指定 */
.local-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
