/* ================================================================
   style.css - 釧路コミュニティチャット グローバルスタイル
   テーマ: 釧路の夜景・港の灯り・霧
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;500;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg-deep:       #060c18;
  --bg-dark:       #0a0e1a;
  --bg-surface:    #0f1525;
  --bg-card:       #141b2d;
  --bg-elevated:   #1a2340;
  --bg-hover:      #1e2a4a;

  --amber:         #f4a620;
  --amber-dim:     #c17d0f;
  --amber-glow:    rgba(244, 166, 32, 0.15);
  --amber-subtle:  rgba(244, 166, 32, 0.06);

  --cyan:          #4dd0e1;
  --cyan-dim:      #26a7ba;
  --cyan-glow:     rgba(77, 208, 225, 0.12);

  --text-primary:  #e8eaf6;
  --text-secondary:#9aa5c4;
  --text-muted:    #5a6585;
  --text-dim:      #3a4460;

  --border:        rgba(255, 255, 255, 0.06);
  --border-amber:  rgba(244, 166, 32, 0.2);
  --border-cyan:   rgba(77, 208, 225, 0.15);

  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md:     0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.8);
  --shadow-amber:  0 0 20px rgba(244, 166, 32, 0.2);
  --shadow-cyan:   0 0 20px rgba(77, 208, 225, 0.15);

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --font-serif:    'Noto Serif JP', 'Georgia', serif;
  --font-sans:     'Noto Sans JP', 'Helvetica Neue', sans-serif;

  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--amber-dim); }

/* ---- Selection ---- */
::selection { background: var(--amber-glow); color: var(--amber); }

/* ---- Typography ---- */
h1, h2, h3 { font-family: var(--font-serif); letter-spacing: 0.02em; }
h1 { font-size: 2.2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 500; }
h3 { font-size: 1.1rem; font-weight: 500; }
p  { font-size: 0.9rem; color: var(--text-secondary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--amber);
  color: var(--bg-deep);
  box-shadow: 0 0 15px rgba(244, 166, 32, 0.3);
}
.btn-primary:hover {
  background: #ffbe45;
  box-shadow: 0 0 25px rgba(244, 166, 32, 0.5);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-amber);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--bg-elevated); color: var(--amber); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ---- Form Elements ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 3px var(--amber-subtle);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a6585' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-textarea { resize: vertical; min-height: 80px; }
option { background: var(--bg-card); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-amber { border-color: var(--border-amber); }
.card:hover { border-color: rgba(244, 166, 32, 0.15); }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-amber { background: var(--amber-subtle); color: var(--amber); border-color: var(--border-amber); }
.badge-cyan  { background: var(--cyan-glow); color: var(--cyan); border-color: var(--border-cyan); }

/* ---- Modal Overlay ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-amber);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg), var(--shadow-amber);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ---- Notifications / Toast ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-amber);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slideInToast 0.3s ease;
  max-width: 320px;
}
.toast.success { border-color: var(--cyan); }
.toast.error   { border-color: #ef5350; }
@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---- Loading ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 16px 0;
}

/* ---- Avatar ---- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid transparent;
  font-family: var(--font-sans);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.avatar-xs { width: 30px; height: 30px; font-size: 0.75rem; border-width: 2px !important; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.85rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.3rem; }

/* ---- Stars / Night particles ---- */
.night-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.night-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: url('../images/bg-night.svg') center/cover no-repeat;
  opacity: 0.15;
}

/* ---- Ambient glow effects ---- */
.glow-amber { box-shadow: var(--shadow-amber); }
.glow-cyan  { box-shadow: var(--shadow-cyan); }

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 8px rgba(244, 166, 32, 0.3); }
  50%       { box-shadow: 0 0 20px rgba(244, 166, 32, 0.6); }
}
.fade-in { animation: fadeIn 0.35s ease forwards; }
.pulse-amber { animation: pulse-amber 2s ease-in-out infinite; }

/* ---- Utilities ---- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-amber { color: var(--amber); }
.text-cyan  { color: var(--cyan); }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 0.8rem; }
.text-xs    { font-size: 0.72rem; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  h1 { font-size: 1.6rem; }
  .modal { padding: 24px 20px; }
}
