/* ========================================
   EcoSmartPlay - Layout
   App Shell, Sidebar, Bottom Nav
   ======================================== */

/* App Shell */
#app {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a1a14 0%, #0d1f2d 50%, #0a1a14 100%);
}

/* Main Content */
.main-content {
  padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  padding-top: 1.5rem;
}

.main-content > .content-wrapper {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .main-content > .content-wrapper {
    padding: 0 1.5rem;
  }
}

@media (min-width: 768px) {
  .main-content {
    margin-right: 16rem;
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .main-content {
    margin-right: 18rem;
  }
}

/* Sidebar (Desktop Only) */
.sidebar {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 16rem;
  flex-direction: column;
  z-index: 40;
  background: rgba(16, 185, 129, 0.1);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-right: none;
  border-top: none;
  border-bottom: none;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
}

@media (min-width: 1024px) {
  .sidebar { width: 18rem; }
}

.sidebar-header {
  padding: 1.5rem;
  padding-bottom: 1rem;
}

.sidebar-header .logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sidebar-header .logo-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}

.sidebar-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  background: linear-gradient(to left, #34d399, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-header p {
  font-size: 0.625rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
  text-align: right;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--foreground);
}

.sidebar-nav-item.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.sidebar-nav-item .active-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #34d399;
  margin-right: auto;
}

.sidebar-footer {
  padding: 1rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(16, 185, 129, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.12);
}

.sidebar-user .avatar {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid rgba(16, 185, 129, 0.3);
}

.sidebar-version {
  text-align: center;
  margin-top: 0.75rem;
}

.sidebar-version .version-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.5625rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted-foreground);
}

.sidebar-version .version-dot {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.6);
}

.sidebar-version .copyright {
  font-size: 0.5625rem;
  color: rgba(138, 160, 152, 0.6);
  margin-top: 0.25rem;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: linear-gradient(to top, #0a1a14 60%, #0c1e18 85%, rgba(12, 30, 24, 0.98) 100%);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border-top: 1px solid rgba(16, 185, 129, 0.15);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4), 0 -1px 6px rgba(0, 0, 0, 0.3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

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

.bottom-nav-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0.5rem 0.5rem 0.5rem;
  position: relative;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  min-width: 3.5rem;
  transition: color 0.2s ease;
  color: var(--muted-foreground);
}

.nav-item:active {
  transform: scale(0.97);
}

.nav-item .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color 0.2s ease;
}

.nav-item .nav-label {
  font-size: 0.625rem;
  margin-top: 0.25rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-item.active {
  color: #34d399;
}

.nav-item.active .nav-label {
  font-weight: 700;
}

.nav-item .active-dot {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: #34d399;
  margin-top: 0.125rem;
}

/* Center Scan Button */
.nav-item-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-top: -2rem;
  z-index: 10;
}

.nav-item-center:active {
  transform: scale(0.88);
}

.nav-center-btn {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, #10b981, #14b8a6);
  transition: box-shadow 0.3s ease;
}

.nav-center-btn .nav-icon {
  width: 1.75rem;
  height: 1.75rem;
  stroke: white;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item-center.active .nav-center-btn {
  animation: glow-pulse 3s ease-in-out infinite;
}

.nav-item-center .nav-label {
  font-size: 0.625rem;
  margin-top: 0.375rem;
  font-weight: 500;
  transition: color 0.2s ease;
  color: var(--muted-foreground);
}

.nav-item-center.active .nav-label {
  color: #34d399;
  font-weight: 700;
}

/* Splash Screen */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a1a14 0%, #0d1f2d 50%, #0a1a14 100%);
  overflow: hidden;
}

.splash-screen.hiding {
  animation: splashExit 0.5s ease-in-out forwards;
}

@keyframes splashExit {
  to { opacity: 0; transform: scale(1.05); }
}

.splash-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.splash-particle {
  position: absolute;
  border-radius: 50%;
  animation: particle-float var(--dur) ease-in-out infinite;
  animation-delay: var(--del);
}

.splash-leaf {
  position: absolute;
  animation: leaf-sway var(--dur) ease-in-out infinite;
  animation-delay: var(--del);
}

.splash-leaf svg {
  color: rgba(16, 185, 129, 0.2);
}

.splash-glow-ring {
  position: absolute;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%);
  animation: glow-ring 2.5s ease-in-out infinite;
}

@media (min-width: 640px) {
  .splash-glow-ring { width: 16rem; height: 16rem; }
}

.splash-icon-container {
  position: relative;
  z-index: 10;
  animation: icon-entrance 1s ease-out forwards;
}

.splash-icon-outer-glow {
  position: absolute;
  inset: -1.25rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(20,184,166,0.1), rgba(245,158,11,0.1));
  filter: blur(14px);
  animation: glow-ring 2s ease-in-out infinite;
}

.splash-icon-box {
  position: relative;
  width: 6rem;
  height: 6rem;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(20,184,166,0.15), rgba(16,185,129,0.1));
  border: 1px solid rgba(16,185,129,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

@media (min-width: 640px) {
  .splash-icon-box { width: 7rem; height: 7rem; }
}

.splash-icon-box .icon {
  width: 3rem;
  height: 3rem;
  color: #34d399;
}

@media (min-width: 640px) {
  .splash-icon-box .icon { width: 3.5rem; height: 3.5rem; }
}

.splash-icon-spin {
  animation: spin 10s linear infinite;
  animation-delay: 1.2s;
}

.splash-title {
  margin-top: 2rem;
  text-align: center;
  position: relative;
  z-index: 10;
  animation: title-entrance 0.7s ease-out 0.6s both;
}

.splash-title h1 {
  font-size: 1.875rem;
  font-weight: 800;
  background: linear-gradient(to left, #34d399, #5eead4, #34d399);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: eco-gradient 4s ease infinite;
}

@media (min-width: 640px) {
  .splash-title h1 { font-size: 2.25rem; }
}

.splash-slogan {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  letter-spacing: 0.025em;
  position: relative;
  z-index: 10;
  animation: slogan-entrance 0.6s ease-out 1s both;
}

@media (min-width: 640px) {
  .splash-slogan { font-size: 1rem; }
}

.splash-loading {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  position: relative;
  z-index: 10;
  animation: fadeIn 0.5s ease 1.4s both;
}

.splash-loading-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #34d399;
}

.splash-loading-dot:nth-child(1) { animation: loading-dot 1s ease-in-out infinite 0s; }
.splash-loading-dot:nth-child(2) { animation: loading-dot 1s ease-in-out infinite 0.2s; }
.splash-loading-dot:nth-child(3) { animation: loading-dot 1s ease-in-out infinite 0.4s; }

.splash-version-badge {
  margin-top: 1.5rem;
  position: relative;
  z-index: 10;
  animation: badge-entrance 0.5s ease-out 1.6s both;
}

.splash-version-badge span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted-foreground);
}

.splash-version-badge .dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.7);
}

.splash-bottom-line {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  width: 6rem;
  height: 0.125rem;
  background: linear-gradient(to right, transparent, rgba(16,185,129,0.3), transparent);
  transform-origin: center;
  animation: line-expand 2.5s ease-in-out 1.2s both;
}

/* Chart Container */
.chart-container {
  width: 100%;
  height: 200px;
  direction: ltr;
}

@media (min-width: 640px) {
  .chart-container { height: 250px; }
}

.chart-container svg {
  width: 100%;
  height: 100%;
}
