/* ========== DESIGN TOKENS ========== */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1628;
  --bg-card: rgba(20, 30, 60, 0.7);
  --bg-glass: rgba(15, 25, 50, 0.6);
  --border-glass: rgba(0, 220, 255, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --cyan: #00dcff;
  --cyan-glow: rgba(0, 220, 255, 0.3);
  --cyan-soft: rgba(0, 220, 255, 0.1);
  --coral: #ff6b6b;
  --coral-glow: rgba(255, 107, 107, 0.3);
  --green: #00e676;
  --green-glow: rgba(0, 230, 118, 0.3);
  --yellow: #ffd740;
  --yellow-glow: rgba(255, 215, 64, 0.3);
  --purple: #b388ff;
  --orange: #ffab40;
  --pink: #ff80ab;
  --text-primary: #e8edf5;
  --text-secondary: rgba(232, 237, 245, 0.65);
  --text-muted: rgba(232, 237, 245, 0.4);
  --nav-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow-cyan: 0 0 20px var(--cyan-glow), 0 0 60px rgba(0, 220, 255, 0.1);
  --shadow-glow-green: 0 0 20px var(--green-glow);
  --shadow-glow-coral: 0 0 20px var(--coral-glow);
}

/* ========== RESET & BASE ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.3em;
}

h3 {
  font-size: 1.2rem;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: all 0.2s;
}

a:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--cyan-glow);
}

/* ========== UTILITY ========== */
.hidden {
  display: none !important;
}

.text-green {
  color: var(--green);
  font-weight: 600;
}

.text-yellow {
  color: var(--yellow);
  font-weight: 600;
}

.text-red {
  color: var(--coral);
  font-weight: 600;
}

/* ========== NAVIGATION ========== */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.3rem;
}

.nav-icon {
  font-size: 1.6rem;
}

.nav-title {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--cyan);
  transition: width 0.3s;
  box-shadow: 0 0 8px var(--cyan-glow);
}

.nav-links a:hover {
  color: #fff;
}

.nav-links a:hover::after {
  width: 100%;
}

#mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 1.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ========== HERO ========== */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2rem;
  background: radial-gradient(ellipse at 30% 50%, rgba(0, 220, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(179, 136, 255, 0.06), transparent 50%),
    var(--bg-primary);
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0, 220, 255, 0.2), rgba(0, 220, 255, 0.05));
  border: 1px solid rgba(0, 220, 255, 0.15);
  animation: float-up linear infinite;
}

.b1 {
  width: 20px;
  height: 20px;
  left: 10%;
  animation-duration: 12s;
}

.b2 {
  width: 14px;
  height: 14px;
  left: 25%;
  animation-duration: 9s;
  animation-delay: 2s;
}

.b3 {
  width: 28px;
  height: 28px;
  left: 45%;
  animation-duration: 15s;
  animation-delay: 1s;
}

.b4 {
  width: 10px;
  height: 10px;
  left: 60%;
  animation-duration: 10s;
  animation-delay: 3s;
}

.b5 {
  width: 18px;
  height: 18px;
  left: 75%;
  animation-duration: 11s;
  animation-delay: 0.5s;
}

.b6 {
  width: 24px;
  height: 24px;
  left: 88%;
  animation-duration: 14s;
  animation-delay: 4s;
}

.b7 {
  width: 12px;
  height: 12px;
  left: 35%;
  animation-duration: 8s;
  animation-delay: 5s;
}

.b8 {
  width: 16px;
  height: 16px;
  left: 55%;
  animation-duration: 13s;
  animation-delay: 2.5s;
}

@keyframes float-up {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }

  10% {
    opacity: 0.8;
  }

  90% {
    opacity: 0.3;
  }

  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

.wave {
  position: absolute;
  bottom: 0;
  left: -5%;
  width: 110%;
  height: 120px;
  background: var(--bg-secondary);
  border-radius: 100% 100% 0 0;
  opacity: 0.5;
}

.wave1 {
  animation: wave-move 8s ease-in-out infinite;
}

.wave2 {
  animation: wave-move 6s ease-in-out infinite reverse;
  bottom: -10px;
  opacity: 0.3;
}

@keyframes wave-move {

  0%,
  100% {
    transform: translateX(-2%) scaleY(1);
  }

  50% {
    transform: translateX(2%) scaleY(0.85);
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
}

.hero-content h1 {
  margin-bottom: 1rem;
}

.text-glow {
  background: linear-gradient(135deg, var(--cyan), #00ffc3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px var(--cyan-glow));
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 550px;
  margin-inline: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2.2rem;
  background: linear-gradient(135deg, var(--cyan), #0099cc);
  color: #000;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  box-shadow: 0 4px 20px var(--cyan-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  color: #000;
  box-shadow: 0 6px 30px var(--cyan-glow), 0 0 60px rgba(0, 220, 255, 0.15);
}

.btn-arrow {
  transition: transform 0.3s;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-secondary {
  padding: 0.6rem 1.4rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
}

/* ========== SECTIONS ========== */
section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0.5rem auto 0;
}

/* ========== TANK CARDS ========== */
.tank-manager {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.btn-add-tank {
  font-size: 1rem;
}

.tank-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  width: 100%;
}

.tank-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
  position: relative;
}

.tank-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 220, 255, 0.3);
  box-shadow: var(--shadow-glow-cyan);
}

.tank-card.active {
  border-color: var(--cyan);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.tank-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.tank-card-header h3 {
  font-size: 1.1rem;
}

.tank-card-actions {
  display: flex;
  gap: 0.4rem;
}

.tank-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.tank-action-btn:hover {
  color: var(--cyan);
  background: rgba(0, 220, 255, 0.1);
}

.tank-action-btn.delete:hover {
  color: var(--coral);
  background: rgba(255, 107, 107, 0.1);
}

.tank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.tank-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  background: rgba(0, 220, 255, 0.08);
  color: var(--cyan);
  border: 1px solid rgba(0, 220, 255, 0.15);
}

.tank-livestock-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.tank-livestock-preview span {
  display: inline-block;
  margin-right: 0.8rem;
}

.tank-select-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.5rem;
  background: rgba(0, 220, 255, 0.08);
  border: 1px solid rgba(0, 220, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.tank-select-btn:hover {
  background: rgba(0, 220, 255, 0.15);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.tank-card.active .tank-select-btn {
  background: var(--cyan);
  color: #000;
  font-weight: 700;
}

/* ========== ACTIVE TANK BAR ========== */
.active-tank-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 500;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.6rem 2rem;
}

.active-tank-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.active-tank-bar label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.active-tank-bar select {
  background: var(--bg-card);
  color: var(--cyan);
  border: 1px solid var(--border-glass);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.3rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--coral);
}

.modal .form-group {
  margin-bottom: 1rem;
}

.modal .form-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

/* ========== LIVESTOCK ========== */
.livestock-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

.livestock-section h4 {
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.livestock-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
}

.livestock-row {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  gap: 0.5rem;
  align-items: center;
}

.livestock-row input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}

.livestock-row input:focus {
  outline: none;
  border-color: var(--cyan);
}

.livestock-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s;
  padding: 0.3rem;
}

.livestock-remove:hover {
  color: var(--coral);
}

/* ========== GAUGE GRID ========== */
.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
}

.gauge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.gauge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cyan);
  opacity: 0.5;
  transition: opacity 0.3s;
}

.gauge-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 220, 255, 0.3);
  box-shadow: var(--shadow-glow-cyan);
}

.gauge-card:hover::before {
  opacity: 1;
}

.gauge-card.status-optimal::before {
  background: var(--green);
}

.gauge-card.status-warning::before {
  background: var(--yellow);
}

.gauge-card.status-danger::before {
  background: var(--coral);
}

.gauge-card.status-optimal:hover {
  box-shadow: var(--shadow-glow-green);
}

.gauge-card.status-warning:hover {
  box-shadow: 0 0 20px var(--yellow-glow);
}

.gauge-card.status-danger:hover {
  box-shadow: var(--shadow-glow-coral);
}

.gauge-emoji {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.gauge-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.gauge-value {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.gauge-value.status-optimal {
  color: var(--green);
}

.gauge-value.status-warning {
  color: var(--yellow);
}

.gauge-value.status-danger {
  color: var(--coral);
}

.gauge-value.status-none {
  color: var(--text-muted);
}

.gauge-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gauge-range-bar {
  margin-top: 0.8rem;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.gauge-range-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.3s;
}

.gauge-range-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ========== ALERTS ========== */
.alerts-panel {
  margin-top: 2rem;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.alerts-panel h3 {
  color: var(--coral);
  margin-bottom: 0.8rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-dot.danger {
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral-glow);
}

.alert-dot.warning {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow-glow);
}

/* ========== LOG FORM ========== */
.log-form {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft), 0 0 20px var(--cyan-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.form-row {
  margin-top: 1.2rem;
}

.form-group-wide {
  width: 100%;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.btn-log {
  padding: 0.9rem 3rem;
  font-size: 1.1rem;
}

.log-form.success {
  animation: flash-success 0.6s ease;
}

@keyframes flash-success {

  0%,
  100% {
    border-color: var(--border-glass);
  }

  50% {
    border-color: var(--green);
    box-shadow: 0 0 30px var(--green-glow);
  }
}

/* ========== PHOTO GALLERY ========== */
.gallery-upload {
  text-align: center;
  margin-bottom: 2rem;
}

.btn-upload {
  cursor: pointer;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: all 0.3s;
  aspect-ratio: 1;
}

.photo-card:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-glow-cyan);
  border-color: var(--cyan);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.8rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.photo-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.photo-delete-btn {
  background: rgba(255, 107, 107, 0.2);
  border: none;
  color: var(--coral);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0;
}

.photo-card:hover .photo-delete-btn {
  opacity: 1;
}

.photo-delete-btn:hover {
  background: rgba(255, 107, 107, 0.4);
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
}

.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: var(--coral);
}

.lightbox-caption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ========== PARAMETER GUIDE ========== */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  backdrop-filter: blur(10px);
  transition: all 0.4s;
}

.guide-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 220, 255, 0.2);
}

.guide-card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.guide-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.guide-card h3 {
  font-size: 1.15rem;
}

.guide-what,
.guide-why,
.guide-how,
.guide-when,
.guide-fix {
  margin-bottom: 0.8rem;
}

.guide-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}

.guide-label.what {
  color: var(--cyan);
}

.guide-label.why {
  color: var(--coral);
}

.guide-label.how {
  color: var(--green);
}

.guide-label.when {
  color: var(--yellow);
}

.guide-label.fix {
  color: var(--purple);
}

.guide-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.range-bar-visual {
  margin: 1rem 0 0.5rem;
  height: 28px;
  border-radius: 14px;
  display: flex;
  overflow: hidden;
  font-size: 0.7rem;
  font-weight: 600;
}

.range-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.7);
  transition: all 0.3s;
  min-width: 30px;
}

.range-zone.danger {
  background: var(--coral);
}

.range-zone.warning {
  background: var(--yellow);
}

.range-zone.optimal {
  background: var(--green);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 0.3rem;
}

/* ========== SPECIES CARDS ========== */
.species-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.species-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(10px);
  transition: all 0.4s;
  position: relative;
  overflow: hidden;
}

.species-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-cyan);
}

.species-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.species-emoji {
  font-size: 2.5rem;
}

.species-card h3 {
  font-size: 1.2rem;
}

.species-sci {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.species-difficulty {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.diff-easy {
  background: rgba(0, 230, 118, 0.15);
  color: var(--green);
}

.diff-moderate {
  background: rgba(255, 215, 64, 0.15);
  color: var(--yellow);
}

.diff-hard {
  background: rgba(255, 107, 107, 0.15);
  color: var(--coral);
}

.species-params {
  margin-top: 1rem;
}

.species-param-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.species-param-row:last-child {
  border-bottom: none;
}

.species-param-name {
  color: var(--text-secondary);
}

.species-param-value {
  font-weight: 600;
  color: var(--cyan);
}

.species-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  line-height: 1.5;
}

/* ========== COMPARISON TABLE ========== */
.comparison-table-wrap {
  margin-top: 1rem;
}

.comparison-table-wrap h3 {
  margin-bottom: 1rem;
  text-align: center;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  font-size: 0.88rem;
}

.comparison-table th,
.comparison-table td {
  padding: 0.8rem 1rem;
  text-align: center;
}

.comparison-table thead {
  background: rgba(0, 220, 255, 0.08);
}

.comparison-table th {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan);
}

.comparison-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
}

.comparison-table tbody tr:hover {
  background: rgba(0, 220, 255, 0.04);
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ========== HISTORY ========== */
.history-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.history-controls select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container canvas {
  max-height: 350px;
}

/* ========== LOG LIST ========== */
.log-list-wrap h3 {
  margin-bottom: 1rem;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.log-entry-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  transition: all 0.2s;
}

.log-entry-card:hover {
  border-color: rgba(0, 220, 255, 0.2);
}

.log-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.log-params-preview {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.log-param-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.log-param-pill .label {
  color: var(--text-muted);
}

.log-param-pill .value {
  font-weight: 600;
}

.log-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  transition: color 0.2s;
}

.log-delete-btn:hover {
  color: var(--coral);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ========== TIPS ========== */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.3s;
}

.tip-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 220, 255, 0.2);
}

.tip-icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.tip-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.tip-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========== FOOTER ========== */
footer {
  border-top: 1px solid var(--border-glass);
  padding: 3rem 2rem;
  text-align: center;
}

.footer-content {
  max-width: 500px;
  margin: 0 auto;
}

.footer-brand {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
}

footer p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 2000;
  animation: slide-in 0.4s ease, fade-out 0.4s ease 2.6s forwards;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
}

.toast.error {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid var(--coral);
  color: var(--coral);
}

@keyframes slide-in {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ========== SPECIES ID GUIDE ========== */
.id-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 3rem;
}

.id-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.id-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 220, 255, 0.3);
  box-shadow: var(--shadow-glow-cyan);
}

.id-card-color {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.id-card-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.id-card h4 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.id-card-sci {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.8rem;
}

.id-card-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.id-feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.id-card-colors {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.id-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.id-card-size {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.id-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 0.6rem;
}

/* Expanded card detail */
.id-card-detail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
}

.id-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.3rem 0;
  color: var(--text-secondary);
}

.id-detail-value {
  color: var(--cyan);
  font-weight: 600;
}

/* ID Wizard */
.id-wizard {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.id-wizard-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.id-wizard-header h3 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.id-wizard-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.id-wizard-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.id-tab {
  padding: 0.6rem 1.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.3s;
}

.id-tab.active {
  background: rgba(0, 220, 255, 0.1);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.id-tab:hover:not(.active) {
  border-color: rgba(0, 220, 255, 0.3);
  color: var(--text-primary);
}

.id-panel {
  min-height: 200px;
}

/* Upload zone */
.id-upload-zone {
  border: 2px dashed rgba(0, 220, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 1.5rem;
}

.id-upload-zone:hover,
.id-upload-zone.dragover {
  border-color: var(--cyan);
  background: rgba(0, 220, 255, 0.05);
  box-shadow: 0 0 30px var(--cyan-glow);
}

.id-upload-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
}

.id-upload-zone p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.id-preview {
  text-align: center;
  margin-bottom: 1.5rem;
}

.id-preview img {
  max-width: 400px;
  max-height: 300px;
  width: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 0.8rem;
}

.id-upload-tips {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: rgba(0, 220, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 220, 255, 0.1);
}

.id-upload-tips h4 {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: var(--cyan);
}

.id-upload-tips ul {
  list-style: none;
  padding: 0;
}

.id-upload-tips li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.id-upload-tips li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* Quiz */
.quiz-step {
  text-align: center;
  margin-bottom: 1rem;
}

.quiz-step h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.quiz-step p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
}

.quiz-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  font-family: inherit;
  color: var(--text-primary);
}

.quiz-option:hover {
  border-color: var(--cyan);
  background: rgba(0, 220, 255, 0.08);
  transform: translateY(-2px);
}

.quiz-option.selected {
  border-color: var(--cyan);
  background: rgba(0, 220, 255, 0.12);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.quiz-option-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.4rem;
}

.quiz-option-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.quiz-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.quiz-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s;
}

.quiz-dot.active {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.quiz-dot.done {
  background: var(--green);
}

/* Results */
.id-result {
  margin-top: 1.5rem;
}

.id-result-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.id-result-header h3 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.id-match-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.id-match-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  transition: all 0.3s;
}

.id-match-card:first-child {
  border-color: var(--green);
  background: rgba(0, 230, 118, 0.05);
}

.id-match-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.id-match-info {
  flex: 1;
}

.id-match-info h4 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.id-match-sci {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.id-match-pct {
  font-size: 1.4rem;
  font-weight: 900;
  flex-shrink: 0;
}

.id-match-pct.high {
  color: var(--green);
}

.id-match-pct.med {
  color: var(--yellow);
}

.id-match-pct.low {
  color: var(--text-muted);
}

.id-match-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 0.5rem;
  overflow: hidden;
}

.id-match-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.id-match-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.id-retry-hint {
  text-align: center;
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 215, 64, 0.08);
  border: 1px solid rgba(255, 215, 64, 0.2);
  border-radius: var(--radius-md);
  color: var(--yellow);
  font-size: 0.88rem;
}

.id-retry-hint a {
  color: var(--cyan);
  text-decoration: underline;
  cursor: pointer;
}

.id-use-btn {
  margin-top: 0.5rem;
  padding: 0.3rem 0.8rem;
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.id-use-btn:hover {
  background: rgba(0, 230, 118, 0.2);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  #mobile-menu-btn {
    display: block;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    gap: 1.2rem;
    border-bottom: 1px solid var(--border-glass);
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .gauge-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .species-cards {
    grid-template-columns: 1fr;
  }

  .tips-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tank-cards {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .log-entry-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .comparison-table {
    font-size: 0.75rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 0.5rem;
  }

  section {
    padding: 3rem 1rem;
  }

  .modal {
    padding: 1.2rem;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .livestock-row {
    grid-template-columns: 1fr 60px 30px;
  }
}

/* ========== SPECIES PHOTO MODAL ========== */
.id-card-click-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--cyan);
  margin-top: 0.8rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.id-card:hover .id-card-click-hint {
  opacity: 1;
}

.spm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
  overflow-y: auto;
}

.spm-overlay.open {
  opacity: 1;
}

.spm-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 1.2rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 220, 255, 0.08);
}

.spm-overlay.open .spm-content {
  transform: translateY(0) scale(1);
}

.spm-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.spm-close:hover {
  background: rgba(255, 107, 107, 0.3);
  border-color: var(--coral);
}

.spm-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.2rem;
  margin-bottom: 1.5rem;
}

.spm-emoji {
  font-size: 2.8rem;
}

.spm-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.spm-sci {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.spm-diff {
  margin-left: auto;
  padding: 0.3rem 0.8rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spm-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.spm-photo-card {
  border-radius: 0.8rem;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s, box-shadow 0.2s;
}

.spm-photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.spm-photo-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.03);
}

.spm-photo-caption {
  padding: 0.6rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
}

.spm-photo-fallback {
  width: 100%;
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.spm-photo-fallback br+* {
  font-size: 0.8rem;
}

.spm-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 0.8rem;
  border: 1px solid var(--border-subtle);
}

.spm-info-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.spm-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 80px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spm-section {
  margin-bottom: 1.2rem;
}

.spm-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cyan);
  margin: 0 0 0.5rem 0;
}

.spm-section p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.spm-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.spm-section ul li {
  background: rgba(0, 220, 255, 0.08);
  border: 1px solid rgba(0, 220, 255, 0.15);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@media (max-width: 500px) {
  .spm-content {
    padding: 1.2rem;
  }

  .spm-photos {
    grid-template-columns: 1fr;
  }

  .spm-header {
    flex-wrap: wrap;
  }

  .spm-emoji {
    font-size: 2rem;
  }

  .spm-header h2 {
    font-size: 1.2rem;
  }
}

/* ========== AUTH SCREEN ========== */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#auth-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#auth-screen .auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 2rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 20px var(--cyan-glow));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.auth-brand h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.auth-tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

/* Auth Form */
.auth-form {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-form h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1.5rem 0;
  text-align: center;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 220, 255, 0.1);
}

.auth-field input::placeholder,
.auth-field textarea::placeholder {
  color: var(--text-dim);
}

.auth-field .disabled-input {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.auth-error {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: #ff4757;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: center;
}

.auth-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 220, 255, 0.3);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
}

.auth-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.auth-switch {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 1.2rem;
}

.auth-switch a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ========== NAV USER AVATAR ========== */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-nav {
  position: relative;
}

.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: 50px;
  padding: 0.35rem 0.8rem 0.35rem 0.35rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

.user-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--cyan);
}

.user-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  font-size: 1.1rem;
  overflow: hidden;
}

.user-avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-display-name {
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.2s;
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: dropIn 0.2s ease;
  z-index: 999;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  font-size: 1.4rem;
  flex-shrink: 0;
  overflow: hidden;
}

.dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.dropdown-email {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-glass);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(0, 220, 255, 0.08);
  color: var(--text-primary);
}

.dropdown-logout {
  color: #ff4757;
}

.dropdown-logout:hover {
  background: rgba(255, 71, 87, 0.1);
  color: #ff6b7a;
}

/* ========== PROFILE MODAL ========== */
.profile-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  width: 95%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
  animation: slideUp 0.3s ease;
}

.profile-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 0;
}

.profile-modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* Profile View Mode */
.profile-view {
  padding: 1.5rem;
}

.profile-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.profile-big-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
  border: 3px solid var(--border-glass);
  overflow: hidden;
}

.profile-big-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-hero h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.profile-username {
  color: var(--cyan);
  font-size: 0.9rem;
  margin: 0.2rem 0 0.6rem;
}

.profile-level-badge {
  display: inline-block;
  padding: 0.25rem 0.85rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-info-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem;
}

.profile-info-item.full-width {
  grid-column: 1 / -1;
}

.info-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-value {
  display: block;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 500;
}

.profile-socials {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.social-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.profile-meta {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Profile Edit Mode */
.profile-edit {
  padding: 1.5rem;
}

.profile-avatar-edit {
  text-align: center;
  margin-bottom: 1.5rem;
}

.avatar-upload-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.7rem;
  transition: background 0.2s ease;
}

.avatar-upload-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.emoji-picker-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.7rem;
}

.emoji-pick {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}

.emoji-pick:hover {
  border-color: var(--cyan);
  transform: scale(1.15);
}

.emoji-pick.active {
  border-color: var(--cyan);
  background: rgba(0, 220, 255, 0.1);
}

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-form-grid .full-width {
  grid-column: 1 / -1;
}

.section-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0.5rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-glass);
}

.profile-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Responsive auth */
@media (max-width: 600px) {
  .auth-row {
    grid-template-columns: 1fr;
  }

  .user-display-name {
    display: none;
  }

  .chevron {
    display: none;
  }

  .profile-form-grid {
    grid-template-columns: 1fr;
  }

  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-edit-actions {
    grid-template-columns: 1fr;
  }

  .user-dropdown {
    right: -60px;
  }
}
/* ========== APP SWITCHER ========== */
.nav-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  margin-left: 1rem;
  font-size: 0.85rem;
}

.nav-switch:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--cyan);
  text-decoration: none;
}

/* AI Search */
.nav-btn-ai {
  background: var(--gradient);
  border: none;
  font-family: inherit;
  font-weight: 600;
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  margin-left: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 220, 255, 0.3);
  transition: all 0.3s ease;
}
.nav-btn-ai:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 220, 255, 0.5); }

/* AI Modal */
.ai-body { display: flex; flex-direction: column; height: 70vh; max-height: 600px; }
.ai-history { flex: 1; overflow-y: auto; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 0.5rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.ai-input-area { display: flex; gap: 0.5rem; }
.ai-input-area textarea { flex: 1; resize: none; border-radius: 0.5rem; padding: 0.8rem; border: 1px solid var(--border); background: var(--bg-body); color: var(--text); font-family: inherit; }
.ai-footer { padding-top: 0.5rem; text-align: center; color: var(--text-muted); font-size: 0.8rem; }
.ai-footer a { color: var(--primary); text-decoration: none; }

.ai-message { max-width: 85%; padding: 0.8rem 1rem; border-radius: 1rem; line-height: 1.5; font-size: 0.95rem; }
.ai-message.user { align-self: flex-end; background: var(--gradient); color: white; border-bottom-right-radius: 0.2rem; }
.ai-message.assistant { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 0.2rem; }
.ai-message.system { align-self: center; background: rgba(255, 107, 107, 0.1); color: var(--coral); font-size: 0.85rem; }

.msg-sources { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; }
.msg-sources ul { padding-left: 1.2rem; margin: 0.2rem 0 0 0; }
.msg-sources li a { color: var(--primary); }

/* Loading dots */
.ai-message.loading span { animation: blink 1.4s infinite both; }
.ai-message.loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-message.loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0% { opacity: 0.2; } 20% { opacity: 1; } 100% { opacity: 0.2; } }

/* GEO / About Section */
.geo-content { background: var(--bg-card); padding: 4rem 1rem; border-top: 1px solid var(--border); margin-top: 4rem; }
.geo-container { max-width: 900px; margin: 0 auto; color: var(--text-muted); }
.geo-content h2 { margin-bottom: 1rem; color: var(--text); font-size: 1.5rem; }
.geo-lead { font-size: 1.1rem; margin-bottom: 2rem; color: var(--primary); font-weight: 500; }
.geo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.geo-col h3 { font-size: 1rem; color: var(--text); margin-bottom: 0.5rem; }
.geo-col ul { list-style: disc; padding-left: 1.2rem; }
.geo-col li { margin-bottom: 0.5rem; line-height: 1.4; }
@media (max-width: 600px) { .geo-grid { grid-template-columns: 1fr; } }

/* ========== AI SEARCH STYLES ========== */
/* Ensure history and input areas have clear borders */
.ai-history {
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
}

.ai-input-area {
  border: 2px solid var(--cyan); /* Highlighted input area */
  border-radius: var(--radius-md);
  padding: 0.5rem;
  background: var(--bg-card);
  box-shadow: 0 0 10px rgba(0, 220, 255, 0.1);
}

.ai-input-area textarea {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  resize: vertical;
}

/* ========== FORM VISIBILITY UPDATES ========== */
/* Make dropdowns & inputs more visible with borders */
.auth-field input,
.auth-field select,
.auth-field textarea {
  border: 2px solid rgba(255, 255, 255, 0.15); /* Higher contrast border */
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  outline: none;
}

/* Ensure select dropdown arrow is visible */
.auth-field select {
  cursor: pointer;
  background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'none\' stroke=\'white\' stroke-width=\'2\' stroke-linecap=\'round\' stroke-linejoin=\'round\'%3e%3cpolyline points=\'6 9 12 15 18 9\'%3e%3c/polyline%3e%3c/svg%3e');
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  appearance: none;
  padding-right: 2.5rem;
}


/* High Contrast Dropdown Options */
.auth-field select option {
  background-color: #1a2030; /* Dark background matching theme */
  color: #ffffff; /* Bright white text */
  padding: 10px;
}

