/* ============================================================
   toya_watcher - 雨量監視アプリ共通スタイル
   ライトテーマ（猫パターン背景）
   ============================================================ */

/* ---------- Google Fonts Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --color-bg: #FAFAF6;
  --color-bg-card: rgba(255, 255, 255, 0.92);
  --color-bg-glass: rgba(255, 255, 255, 0.7);
  --color-primary: #6B8E7B;
  --color-primary-light: #8DBFA3;
  --color-accent: #7FA68D;
  --color-text: #333333;
  --color-text-muted: #888888;
  --color-text-bright: #222222;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-danger: #D9534F;
  --color-warning: #E8A838;
  --color-safe: #5DAE61;
  --color-info: #5B9BD5;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --font-main: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  background-image: url('../images/cat_pattern.png');
  background-size: 320px 320px;
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 猫背景のオーバーレイで不透明度を調整 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 246, 0.55);
  pointer-events: none;
  z-index: 0;
}

body>* {
  position: relative;
  z-index: 1;
}

/* ---------- Layout ---------- */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  padding-bottom: 24px;
}

/* ---------- Header ---------- */
.header {
  text-align: center;
  padding: 8px 0 12px;
}

.header__icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-bright);
  letter-spacing: 0.5px;
}

.header__subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ---------- Card ---------- */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.card__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

/* ---------- Current Status ---------- */
.status-display {
  text-align: center;
  padding: 8px 0;
}

.status-display__value {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-text-bright);
  line-height: 1;
  margin-bottom: 4px;
}

.status-display__unit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 2px;
}

.status-display__time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ---------- Status Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 12px;
  transition: var(--transition);
}

.badge--safe {
  background: rgba(93, 174, 97, 0.12);
  color: #3D8B40;
  border: 1px solid rgba(93, 174, 97, 0.25);
}

.badge--light {
  background: rgba(91, 155, 213, 0.12);
  color: #3A7BBF;
  border: 1px solid rgba(91, 155, 213, 0.25);
}

.badge--moderate {
  background: rgba(232, 168, 56, 0.12);
  color: #B07D1A;
  border: 1px solid rgba(232, 168, 56, 0.25);
}

.badge--heavy {
  background: rgba(217, 83, 79, 0.12);
  color: #B94340;
  border: 1px solid rgba(217, 83, 79, 0.25);
}

/* ---------- Info Row ---------- */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row__label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.info-row__value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-bright);
}

/* ---------- Chart Container ---------- */
.chart-container {
  position: relative;
  width: 100%;
  height: 160px;
  margin-top: 4px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---------- Navigation Buttons ---------- */
.nav-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #FFFFFF;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(107, 142, 123, 0.35);
  transition: var(--transition);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nav-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(107, 142, 123, 0.5);
}

.nav-btn:active {
  transform: scale(0.95);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tab.active {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(107, 142, 123, 0.25);
}

.tab:hover:not(.active) {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

/* ---------- Select / Dropdown ---------- */
.select-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.select-wrapper {
  flex: 1;
  min-width: 100px;
}

.select-wrapper label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.select-wrapper select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(107, 142, 123, 0.15);
}

/* ---------- Loading ---------- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: var(--color-text-muted);
  gap: 12px;
}

.loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(107, 142, 123, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Error ---------- */
.error-msg {
  text-align: center;
  padding: 20px;
  color: var(--color-danger);
  font-size: 0.85rem;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.empty-state__text {
  font-size: 0.85rem;
}

/* ---------- Last Updated ---------- */
.last-updated {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  padding: 8px 0;
}

/* ---------- Back Link ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--color-primary-light);
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out both;
}

.animate-in:nth-child(1) {
  animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
  animation-delay: 0.1s;
}

.animate-in:nth-child(3) {
  animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
  animation-delay: 0.2s;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .container {
    max-width: 560px;
  }
}

/* ---------- Pulse Animation ---------- */
@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 4px rgba(107, 142, 123, 0.2);
  }

  50% {
    box-shadow: 0 0 20px rgba(107, 142, 123, 0.35);
  }
}

.pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ---------- Toggle Button (湿度・気圧) ---------- */
.toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.02);
  color: var(--color-text-muted);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
  border-color: rgba(0, 0, 0, 0.15);
}

.toggle-btn__icon {
  font-size: 1rem;
}

.toggle-btn__text {
  flex: 1;
  text-align: left;
}

.toggle-btn__arrow {
  font-size: 0.65rem;
  transition: transform 0.3s ease;
}

/* ---------- Expand Panel ---------- */
.expand-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    max-height: 600px;
    transform: translateY(0);
  }
}

/* ---------- Temperature Value Color ---------- */
.status-display__value--temp {
  font-size: 3rem;
  color: #E8915A;
}

/* ---------- Pressure Value Color ---------- */
.status-display__value--pressure {
  font-size: 2.5rem;
  color: #9B7EB8;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 4px 0;
}

.summary-grid--4col {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0px;
}

.summary-item__icon {
  font-size: 1.1rem;
}

.summary-item__value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text-bright);
  line-height: 1.1;
}

.summary-item__value--temp {
  color: #E8915A;
}

.summary-item__value--humi {
  color: #5B9BD5;
}

.summary-item__unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.summary-item__label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ---------- Summary Meta ---------- */
.summary-meta {
  padding: 4px 0 0;
}

/* ---------- Taller Chart Container ---------- */
.chart-container--tall {
  height: 220px;
}