/* ==============================================================================
   Növénygondozó PWA - Fő Alkalmazás Stíluslap (Material 3 Expressive)
   ============================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  scroll-behavior: smooth;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  padding-bottom: env(safe-area-inset-bottom, 24px);
  overflow-x: hidden;
}

/* Material Symbols Rounded beállítás */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-rounded.filled {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Alkalmazás keret - M3 Expressive tágas elrendezés */
.app-container {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--md-sys-color-background);
  overflow-x: hidden;
}

/* ==============================================================================
   Top App Bar (Material 3 Expressive - Full Width & Lekerekített Konténer)
   ============================================================================== */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  left: 0;
  right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 14px;
  background-color: var(--md-sys-color-background);
  border: none;
  border-bottom: none;
  border-radius: 0 0 24px 24px;
  box-shadow: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color var(--transition-speed);
}

@media (min-width: 768px) {
  .top-app-bar {
    padding: 20px 32px 16px;
    border-radius: 0 0 24px 24px;
  }
}

.top-bar-content {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Material 3 Expressive Desktop Navigáció */
.top-desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .top-desktop-nav {
    display: flex;
    align-items: center;
    gap: 6px;
  }
}

.desktop-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.desktop-nav-link:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.desktop-nav-link.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 700;
}

.desktop-nav-link .material-symbols-rounded {
  font-size: 20px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.back-btn:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
  transform: scale(1.06);
}

.back-btn:active {
  transform: scale(0.92);
}

.app-branding {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 4px;
  gap: 2px;
  min-width: 0;
}

.household-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.household-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  display: none;
  padding-top: 2px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  animation: pulse-sync 2.5s infinite;
}

.sync-dot.demo {
  background-color: var(--md-sys-color-secondary, #B75D35);
  animation: none;
  opacity: 0.85;
}

@keyframes pulse-sync {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-auth-btn-guest {
  border-radius: 999px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  transition: opacity 0.2s, transform 0.15s;
}

.top-auth-btn-guest:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.top-auth-btn-logged {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-primary);
  text-decoration: none;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-button:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
  transform: scale(1.06);
}

.icon-button:active {
  transform: scale(0.94);
}

/* ==============================================================================
   Nézetek, Router & Desktop Elrendezés
   ============================================================================== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
}

@media (min-width: 1024px) {
  .main-content {
    max-width: 1140px;
    padding: 24px 32px;
    padding-bottom: 72px;
  }
}

/* Külön Desktop 2-oszlopos Dashboard Grid */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.dashboard-col-left,
.dashboard-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 28px;
    align-items: start;
  }

  .dashboard-col-left {
    position: sticky;
    top: 80px;
  }
}

.view-section {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.24s cubic-bezier(0.2, 0, 0, 1), transform 0.24s cubic-bezier(0.2, 0, 0, 1);
}

.view-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ==============================================================================
   M3 Kártyák (Expressive 26px lekerekítés, lágy árnyékok, konténer szintek)
   ============================================================================== */
.m3-card {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-card);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--md-sys-elevation-1);
  border: 1px solid var(--md-sys-color-surface-container-high);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s var(--transition-smooth), box-shadow 0.22s var(--transition-smooth), background-color var(--transition-speed);
}

.m3-card:hover {
  box-shadow: var(--md-sys-elevation-2);
}

.m3-card.interactive:active {
  transform: scale(0.99);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 16px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

.card-icon.accent {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-secondary);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--md-sys-color-on-surface);
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.card-badge.urgent {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.card-action-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-sys-color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 9999px;
  transition: background-color 0.15s;
}

.card-action-link:hover {
  background-color: var(--md-sys-color-primary-container);
}

/* ==============================================================================
   M3 Expressive Bottom Navigation Bar (Mobil / Tablet)
   ============================================================================== */
.m3-bottom-nav {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 85;
  background-color: var(--md-sys-color-surface);
  border-top: 1px solid var(--md-sys-color-surface-container-high);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

@media (min-width: 768px) {
  .m3-bottom-nav {
    display: none;
  }
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 64px;
  max-width: 540px;
  margin: 0 auto;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  flex: 1;
  padding: 4px 0;
  transition: color 0.15s ease;
  user-select: none;
}

.nav-icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s ease;
}

.nav-icon-container .material-symbols-rounded {
  font-size: 22px;
}

.bottom-nav-item.active .nav-icon-container {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  transform: scale(1.04);
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.01em;
  color: var(--md-sys-color-on-surface-variant);
  transition: color 0.15s;
}

.bottom-nav-item.active .nav-label {
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
}

.nav-task-badge {
  position: absolute;
  top: -2px;
  right: 6px;
  background-color: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ==============================================================================
   M3 Floating Action Button (FAB)
   ============================================================================== */
.fab-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  right: 20px;
  z-index: 90;
  transition: bottom 0.2s ease, right 0.2s ease;
}

@media (min-width: 768px) {
  .fab-container {
    bottom: 32px;
    right: max(24px, calc((100vw - 1080px) / 2 + 24px));
  }
}

.m3-fab {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 24px;
  border-radius: var(--md-sys-shape-corner-fab);
  border: none;
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-tertiary) 100%);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: var(--md-sys-elevation-fab);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--transition-bounce), box-shadow 0.2s ease;
}

.m3-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0px 10px 28px 0px rgba(45, 106, 79, 0.45);
}

.m3-fab:active {
  transform: translateY(1px) scale(0.97);
}

.m3-fab .material-symbols-rounded {
  font-size: 26px;
}

/* ==============================================================================
   Gombok & Interakciók
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

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

.btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

.btn-tonal {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.btn-tonal:hover {
  background-color: var(--md-sys-color-surface-container-highest);
}

.btn-outlined {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
}

.btn-outlined:hover {
  background-color: var(--md-sys-color-surface-container);
}

.btn-text {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  padding: 8px 12px;
}

.btn-text:hover {
  background-color: var(--md-sys-color-primary-container);
}

.btn-danger {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: var(--md-sys-shape-corner-full);
}

/* Ripple Hatás */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  background-color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

[data-theme="dark"] .ripple {
  background-color: rgba(255, 255, 255, 0.25);
}

@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==============================================================================
   Vízcsepp / Ünneplés Animáció
   ============================================================================== */
.splash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-bubble {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100, 181, 246, 0.85) 0%, rgba(45, 106, 79, 0.2) 70%, transparent 100%);
  animation: splash-pop 0.75s ease-out forwards;
}

.splash-particles {
  position: absolute;
  width: 140px;
  height: 140px;
}

.splash-drop {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--water-drop);
  animation: particle-spread 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes splash-pop {
  0% { transform: scale(0.2); opacity: 0; }
  40% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes particle-spread {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ==============================================================================
   Toast Értesítések
   ============================================================================== */
.toast-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 9999px;
  background-color: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--md-sys-elevation-3);
  animation: toast-slide 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  pointer-events: auto;
  max-width: 100%;
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toast-msg {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-action-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-primary);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.toast.success .toast-action-btn {
  color: var(--md-sys-color-on-primary-container);
  text-decoration: underline;
}

.toast-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.toast.success {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: 1px solid var(--md-sys-color-primary);
}

.toast.error {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border: 1px solid var(--md-sys-color-error);
}

@keyframes toast-slide {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Segédosztályok */
.hidden { display: none !important; }
.text-muted { color: var(--md-sys-color-on-surface-variant); font-size: 0.85rem; }

/* ==============================================================================
   Nyomtatási Stíluslap (Címke kinyomtatása kaspóra ragasztáshoz)
   ============================================================================== */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  body * {
    visibility: hidden;
  }

  #modal-plant-qr, #modal-plant-qr * {
    visibility: visible;
  }

  #modal-plant-qr {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    min-height: 100vh;
    background: #FFFFFF !important;
    display: flex !important;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 0 !important;
  }

  #modal-plant-qr .modal-sheet {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
    max-width: none !important;
  }

  #modal-plant-qr .modal-handle,
  #modal-plant-qr .modal-title,
  #modal-plant-qr .qr-url-box,
  #modal-plant-qr button,
  #modal-plant-qr [data-close-modal] {
    display: none !important;
  }

  #qr-label-card {
    visibility: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    border: 2px dashed #2D6A4F !important;
    border-radius: 16px !important;
    padding: 24px !important;
    width: 300px !important;
    page-break-inside: avoid;
    background: #FFFFFF !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  #qr-label-card * {
    visibility: visible !important;
    color: #000000 !important;
  }

  #qr-code-svg-container svg {
    width: 190px !important;
    height: 190px !important;
  }
}

