/* ================================
   Base Styles & CSS Variables
   ================================ */
:root {
  --bg-primary: #DFF2EB;
  --bg-secondary: #B9E5E8;
  --text-primary: #4A628A;
  --accent: #7AB2D3;
  --surface: rgba(255, 255, 255, 0.7);
  --border-light: rgba(185, 229, 232, 0.3);
}

.dark {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --text-primary: #e2e8f0;
  --accent: #7AB2D3;
  --surface: rgba(30, 41, 59, 0.7);
  --border-light: rgba(255, 255, 255, 0.1);
}

/* ================================
   Base Elements
   ================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
  min-height: 100vh;
}

/* ================================
   Layout Components
   ================================ */
.bg-primary {
  background-color: var(--bg-primary);
}

.min-h-screen {
  min-height: 100vh;
}

.max-w-7xl {
  max-width: 80rem;
}

.max-w-2xl {
  max-width: 42rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-8 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: 1rem;
}

.hidden {
  display: none;
}

/* ================================
   Navigation
   ================================ */
nav {
  background-color: var(--surface);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
}

.nav-left,
.nav-right {
  flex: 1;
  display: flex;
  align-items: center;
}

.nav-left {
  justify-content: flex-start;
}

.nav-right {
  justify-content: flex-end;
}

.nav-center {
  flex: 0 0 auto;
}

.logo-link {
  text-decoration: none;
  color: inherit;
}

.logo-link:hover {
  opacity: 0.8;
}

.nav-clock {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.h-16 {
  height: 4rem;
}

.text-xl {
  font-size: 1.25rem;
}

.font-medium {
  font-weight: 500;
}

.text-accent {
  color: var(--accent);
}

/* ================================
   Main Content Area (Background)
   ================================ */
.main-content-area {
  position: relative;
  padding: 2rem 1.5rem;
  border-radius: 1rem;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.3s ease;
}

/* ================================
   Snow Globe / Particle Container
   ================================ */
.snowglobe-container {
  position: relative;
  width: 16rem;
  height: 16rem;
  margin: 0 auto 1.5rem;
}

.snow-globe {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(
    to bottom, 
    rgba(223, 242, 235, 0.3), 
    rgba(122, 178, 211, 0.2)
  );
  backdrop-filter: blur(8px);
  box-shadow: 
    inset 0 2px 10px rgba(255, 255, 255, 0.5),
    0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.particle-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.particle-container svg {
  width: 100%;
  height: 100%;
}

/* ================================
   Activity Controls
   ================================ */
.activity-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 0 auto;
  padding: 1rem;
  background-color: var(--surface);
  backdrop-filter: blur(8px);
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-width: fit-content;
}

.activity-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  background-color: white;
  color: var(--text-primary);
  font-size: 0.875rem;
  min-width: 12rem;
  transition: all 0.2s;
}

.dark .activity-select {
  background-color: var(--bg-secondary);
  border-color: var(--border-light);
}

.activity-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 178, 211, 0.1);
}

.activity-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ================================
   Buttons
   ================================ */
.btn-primary,
.btn-danger {
  padding: 0.5rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-primary:hover {
  background-color: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

/* ================================
   Hamburger Menu Button
   ================================ */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.menu-toggle:hover {
  background-color: var(--border-light);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s;
}

/* ================================
   Side Menu
   ================================ */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 100;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  background-color: var(--bg-primary);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 101;
  overflow-y: auto;
}

.side-menu.active {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--surface);
}

.side-menu-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-primary);
  border-radius: 4px;
  transition: background-color 0.3s;
}

.menu-close:hover {
  background-color: var(--border-light);
}

.side-menu-content {
  padding: 1rem;
}

.menu-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.menu-section:last-child {
  border-bottom: none;
}

.menu-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.menu-item {
  margin-bottom: 1rem;
}

.menu-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.3s;
  background-color: var(--border-light);
  color: var(--text-primary);
}

.toggle-btn.active {
  background-color: var(--accent);
  color: white;
}

/* Cheer Button */
.cheer-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.3s;
  background-color: #f472b6;
  color: white;
}

.cheer-btn:hover:not(:disabled) {
  background-color: #ec4899;
  transform: scale(1.05);
}

.cheer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cheer Particles Container */
.cheer-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

/* Seasonal Particle Animation */
.cheer-particle {
  position: absolute;
  pointer-events: none;
  animation: cheerFall linear forwards;
}

@keyframes cheerFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100%) rotate(360deg);
    opacity: 0;
  }
}

.menu-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.menu-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-primary);
  opacity: 0.6;
  margin-top: 0.25rem;
}

/* 背景設定コントロール */
.background-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-select-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background-color: var(--accent);
  color: white;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s;
}

.file-select-btn:hover {
  opacity: 0.9;
}

.bg-reset-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s;
}

.bg-reset-btn:hover {
  background-color: var(--border-light);
}

/* テーマ選択 */
.theme-select {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.875rem;
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  cursor: pointer;
}

.dark .theme-select {
  background-color: var(--bg-secondary);
}

/* カスタムカラーパネル */
.custom-color-panel {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
}

.color-picker-item {
  margin-bottom: 0.625rem;
}

.color-picker-item:last-of-type {
  margin-bottom: 0.75rem;
}

.color-picker-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-input-group input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-hex-input {
  width: 5.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-family: monospace;
  border: 1px solid var(--border-light);
  border-radius: 0.25rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.custom-color-reset-btn {
  width: 100%;
  padding: 0.375rem;
  font-size: 0.8rem;
  background-color: var(--border-light);
  color: var(--text-primary);
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.custom-color-reset-btn:hover {
  background-color: var(--accent);
  color: white;
}

/* メニューリンク */
.menu-link {
  display: block;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s;
}

.menu-link:hover {
  color: var(--accent);
}

.menu-link-disabled {
  opacity: 0.5;
  cursor: default;
}

/* ================================
   Activity Display
   ================================ */
.activity-display {
  max-width: 32rem;
  margin: 2rem auto;
  padding: 1rem;
  background-color: var(--surface);
  backdrop-filter: blur(8px);
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#total-users {
  margin-bottom: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.activity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.activity-chip {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background-color: rgba(255, 255, 255, 0.6);
  color: var(--text-primary);
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.3s;
}

.dark .activity-chip {
  background-color: rgba(255, 255, 255, 0.1);
}

.activity-chip.active {
  background-color: rgba(122, 178, 211, 0.2);
  border-color: rgba(122, 178, 211, 0.3);
  font-weight: 600;
}

.dark .activity-chip.active {
  background-color: rgba(122, 178, 211, 0.3);
  border-color: rgba(122, 178, 211, 0.4);
  color: rgba(255, 255, 255, 0.9);
}

.activity-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* ================================
   Particle Animations
   ================================ */
@keyframes float {
  0%, 100% { 
    transform: translate(0, 0); 
  }
  25% { 
    transform: translate(10px, -10px); 
  }
  50% { 
    transform: translate(-5px, 5px); 
  }
  75% { 
    transform: translate(-10px, -5px); 
  }
}

/* ================================
   Scrollbar
   ================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(122, 178, 211, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(122, 178, 211, 0.5);
}

/* ================================
   Utility Classes
   ================================ */
.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
}

.text-gray-600 {
  color: #4b5563;
}

.dark .text-gray-600 {
  color: #9ca3af;
}

.rounded-full {
  border-radius: 9999px;
}

.transition-colors {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* ================================
   Responsive Design
   ================================ */
@media (min-width: 640px) {
  .sm\:px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .lg\:px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-width: 640px) {
  .snowglobe-container {
    width: 14rem;
    height: 14rem;
  }
  
  .activity-controls {
    flex-direction: column;
    width: 100%;
    max-width: 20rem;
  }
  
  .activity-select {
    width: 100%;
  }
}
