/* ===========================================
   共通 UI コンポーネント
   =========================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-coral), #FF8A65);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 111, 97, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(255, 111, 97, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-light);
  border: 2px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-3px);
}

.btn-ar {
  background: linear-gradient(135deg, #7C4DFF, #536DFE);
  color: white;
  box-shadow: 0 4px 16px rgba(124, 77, 255, 0.4);
}

.btn-ar:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124, 77, 255, 0.5);
}

.btn-back {
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-text-light);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-lg);
}

.btn-icon {
  font-size: 1.2em;
}

/* --- Modal / Overlay --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: #546E7A;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: rotate(90deg);
}

/* --- Loading Spinner --- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--color-text-light);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-surface);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  animation: loadPulse 1.5s ease-in-out infinite;
}

@keyframes loadPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* --- Fish Info Tag --- */
.info-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  background: #E3F2FD;
  color: #0277BD;
}

.info-tag-habitat {
  background: #E8F5E9;
  color: #2E7D32;
}

.info-tag-size {
  background: #FFF3E0;
  color: #E65100;
}

/* --- Scroll to Top --- */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 800;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-surface), var(--color-shallow));
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  pointer-events: none;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: rgba(255, 255, 255, 0.5);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.empty-state-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

/* --- AdSense Containers --- */
.ad-container {
  max-width: 728px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  min-height: 90px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.2);
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  max-width: 500px;
  margin: 0 auto var(--space-xl);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 5;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-main);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  padding: var(--space-sm);
}

.search-bar input::placeholder {
  color: #B0BEC5;
}

.search-bar .search-icon {
  font-size: 1.3rem;
  color: #78909C;
  padding: var(--space-xs);
}
