/* ==========================================================================
   Homey - Cozy Home Assistant Web Styling
   Designed with Bright Warm Pastels, Rounded Cards, and Sweet Transitions
   ========================================================================== */

:root {
  /* Cozy Warm Color Palette */
  --bg-cozy-cream: #faf7f2;
  --white-pure: #ffffff;
  --border-cozy: #f0eada;
  --border-focus: #fca5a5;
  
  /* Friendly Warm Accents */
  --cozy-peach: #f472b6; /* Friendly sweet rose pink */
  --cozy-peach-hover: #db2777;
  --cozy-peach-light: #fce7f3;
  --cozy-peach-glow: rgba(244, 114, 182, 0.15);
  
  --happy-green: #10b981;
  --happy-green-bg: #e6fcf5;
  --happy-green-text: #099268;
  
  --alert-orange: #f76707;
  --alert-orange-bg: #fff4e6;
  --alert-orange-text: #d9480f;
  
  --sweet-coral: #fa5252;
  --sweet-coral-bg: #fff5f5;
  --sweet-coral-text: #e03131;

  --cozy-lavender: #845ef7;
  --cozy-lavender-bg: #f3f0ff;
  --cozy-lavender-text: #6741d9;
  
  /* Text Styles */
  --text-dark: #2b2d42;
  --text-muted: #868e96;
  --text-light-gray: #adb5bd;
  
  /* Layout Dimensions */
  --header-height: 70px;
  --sidebar-width: 250px;
  
  /* Roundness & Shadows */
  --border-radius-xl: 24px;
  --border-radius-lg: 20px;
  --border-radius-md: 14px;
  --border-radius-sm: 8px;
  
  --shadow-cozy: 0 10px 25px rgba(182, 172, 155, 0.12);
  --shadow-hover: 0 12px 30px rgba(182, 172, 155, 0.22);
  --transition-bubble: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   Base Structure
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-cozy-cream);
  color: var(--text-dark);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Custom Rounded Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-cozy-cream);
}
::-webkit-scrollbar-thumb {
  background: #e9e4d9;
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: #d8d2c4;
}

/* ==========================================================================
   Background Glow Circles
   ========================================================================== */
.bg-warm-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  animation: floatCircle 15s ease-in-out infinite alternate;
}

.blob-peach {
  background: #ffebd5;
  top: -150px;
  left: -150px;
}

.blob-lilac {
  background: #f3e8ff;
  bottom: -200px;
  right: -100px;
  animation-delay: 5s;
}

@keyframes floatCircle {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.1); }
}

/* ==========================================================================
   Cozy Header bar
   ========================================================================== */
.homey-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-cozy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 15px rgba(182, 172, 155, 0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.homey-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-emoji {
  font-size: 1.6rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.header-status {
  background: var(--happy-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 6px 14px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator-dot.green {
  background-color: var(--happy-green);
  box-shadow: 0 0 8px var(--happy-green);
  animation: heartPulse 2.5s infinite;
}

@keyframes heartPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-indicator-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--happy-green-text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Rounded Header Button */
.icon-circle-btn {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  color: var(--text-dark);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-bubble);
}

.icon-circle-btn:hover {
  background: #fbf9f4;
  border-color: var(--cozy-peach);
  transform: scale(1.05);
}

.icon-circle-btn i {
  width: 20px;
  height: 20px;
}

.icon-circle-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--sweet-coral);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white-pure);
}

/* Avatar button to trigger Side drawer */
.profile-avatar-btn {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-xl);
  padding: 4px 14px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-bubble);
}

.profile-avatar-btn:hover {
  border-color: var(--cozy-peach);
  background: var(--cozy-peach-light);
  transform: scale(1.02);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fed7aa;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* ==========================================================================
   App Side Navigation Layout
   ========================================================================== */
.app-layout {
  display: flex;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
  position: relative;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-cozy);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  transition: var(--transition-bubble);
  width: 100%;
}

.nav-item:hover {
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--border-cozy);
  transform: translateX(4px);
}

.nav-item.active {
  color: var(--cozy-peach-hover);
  background: var(--white-pure);
  border-color: #fbcfe8;
  box-shadow: 0 4px 14px rgba(244, 114, 182, 0.1);
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-badge {
  margin-left: auto;
  background: var(--sweet-coral);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(250, 82, 82, 0.25);
}

.sidebar-footer {
  border-top: 1px solid var(--border-cozy);
  padding-top: 16px;
  text-align: center;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-light-gray);
  font-weight: 500;
}

/* ==========================================================================
   Workspace Pane
   ========================================================================== */
.workspace {
  flex-grow: 1;
  padding: 30px;
  overflow-y: auto;
  position: relative;
}

.tab-content {
  display: none;
  animation: slideFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@keyframes slideFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Welcome Banner Overview
   ========================================================================== */
.welcome-banner {
  background: linear-gradient(135deg, #fce7f3 0%, #fae8ff 100%);
  border: 1px solid rgba(244, 114, 182, 0.1);
  border-radius: var(--border-radius-xl);
  padding: 26px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(244, 114, 182, 0.04);
}

.welcome-text-container h2 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-dark);
}

.welcome-text-container p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.welcome-date {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  padding: 8px 18px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cozy-peach);
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

/* ==========================================================================
   Cards & Grids - Cozy white Panels
   ========================================================================== */
.white-panel {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-cozy);
  transition: var(--transition-bubble);
  position: relative;
  overflow: hidden;
}

.white-panel:hover {
  border-color: #fbcfe8;
  box-shadow: var(--shadow-hover);
}

.panel-header {
  border-bottom: 1px solid var(--border-cozy);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h3 i {
  width: 18px;
  height: 18px;
}

.text-peach { color: var(--cozy-peach); }
.text-yellow { color: #fcc419; }
.text-pink { color: #f783ac; }

/* Dashboard Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.summary-card {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-xl);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-cozy);
  position: relative;
  overflow: hidden;
  transition: var(--transition-bubble);
}

.summary-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon i {
  width: 22px;
  height: 22px;
}

.summary-card.peach { border-left: 5px solid #f472b6; }
.summary-card.peach .card-icon { background: #fce7f3; color: #db2777; }

.summary-card.coral { border-left: 5px solid #fa5252; }
.summary-card.coral .card-icon { background: #fff5f5; color: #e03131; }

.summary-card.purple { border-left: 5px solid #845ef7; }
.summary-card.purple .card-icon { background: #f3e0f9; color: #6741d9; }

.summary-card.green { border-left: 5px solid #10b981; }
.summary-card.green .card-icon { background: #e6fcf5; color: #099268; }

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.card-subtext {
  font-size: 0.75rem;
  color: var(--text-light-gray);
  font-weight: 500;
}

/* Dashboard Action details layout */
.dashboard-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .dashboard-widgets {
    grid-template-columns: 1fr;
  }
}

.actions-buttons-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.pantry-summary-preview {
  background: var(--bg-cozy-cream);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-md);
  padding: 16px;
}

.pantry-summary-preview h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-cozy);
  padding-bottom: 6px;
}

.preview-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 0;
}

.preview-value {
  color: var(--cozy-peach-hover);
}

/* Tip panel cute graphics */
.tip-panel {
  display: flex;
  flex-direction: column;
}

.tip-body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: auto;
  margin-bottom: auto;
}

.tip-graphic {
  font-size: 3rem;
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tip-text strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: block;
  margin-bottom: 6px;
}

.tip-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 500;
}

/* ==========================================================================
   Table & Grid Panel Designs
   ========================================================================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.table-panel {
  padding: 0;
}

.table-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-cozy);
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light-gray);
}

.search-box input {
  width: 100%;
  background: var(--bg-cozy-cream);
  border: 1px solid var(--border-cozy);
  color: var(--text-dark);
  padding: 10px 16px 10px 42px;
  border-radius: var(--border-radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-bubble);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--white-pure);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.1);
}

.filter-group {
  display: flex;
  gap: 8px;
}

.table-wrapper {
  overflow-x: auto;
}

.homey-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.homey-table th {
  background: rgba(182, 172, 155, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-cozy);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.homey-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-cozy);
  color: var(--text-dark);
  font-weight: 500;
  vertical-align: middle;
}

.homey-table tbody tr {
  transition: var(--transition-bubble);
}

.homey-table tbody tr:hover {
  background: rgba(182, 172, 155, 0.02);
}

/* Badges & Pills */
.category-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f8f6f0;
  border: 1px solid var(--border-cozy);
  color: var(--text-muted);
}

.tracking-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tracking-pill.auto {
  background: var(--cozy-peach-light);
  border: 1px solid #fbcfe8;
  color: var(--cozy-peach-hover);
}

.tracking-pill.manual {
  background: var(--cozy-lavender-bg);
  border: 1px solid #dcd3ff;
  color: var(--cozy-lavender-text);
}

.stock-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.stock-status-pill.instock {
  background: var(--happy-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--happy-green-text);
}

.stock-status-pill.low {
  background: var(--alert-orange-bg);
  border: 1px solid rgba(247, 103, 7, 0.2);
  color: var(--alert-orange-text);
}

.stock-status-pill.outofstock {
  background: var(--sweet-coral-bg);
  border: 1px solid rgba(250, 82, 82, 0.2);
  color: var(--sweet-coral-text);
}

/* Custom rounded stock bar */
.stock-level-bar-container {
  width: 120px;
  background: #f0ede6;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.stock-level-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stock-level-bar.green { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.stock-level-bar.yellow { background: linear-gradient(90deg, #f76707 0%, #ffa94d 100%); }
.stock-level-bar.red { background: linear-gradient(90deg, #fa5252 0%, #ff8787 100%); }

.stock-qty-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 4px;
  display: block;
}

/* Adjust Stock controls */
.inventory-controller {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ctrl {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  color: var(--text-dark);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  transition: var(--transition-bubble);
}

.btn-ctrl:hover {
  background: var(--cozy-peach-light);
  border-color: var(--cozy-peach);
  transform: scale(1.08);
}

.inventory-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inventory-slider {
  -webkit-appearance: none;
  appearance: none;
  background: #f0ede6;
  height: 6px;
  border-radius: 3px;
  outline: none;
  width: 90px;
}

.inventory-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cozy-peach);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(244, 114, 182, 0.3);
  transition: var(--transition-bubble);
}

.inventory-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* ==========================================================================
   Weekly Planner Card Elements
   ========================================================================== */
.weekly-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
  min-height: 380px;
}

@media (max-width: 1300px) {
  .weekly-board {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.day-card {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-cozy);
  transition: var(--transition-bubble);
}

.day-card:hover {
  border-color: #fbcfe8;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.day-card.active-meal {
  border-color: #fbcfe8;
  background: linear-gradient(180deg, var(--white-pure) 0%, rgba(244, 114, 182, 0.01) 100%);
}

.day-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-cozy);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.day-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.day-status-badge.empty {
  background: var(--bg-cozy-cream);
  color: var(--text-muted);
}

.day-status-badge.planned {
  background: var(--alert-orange-bg);
  border: 1px solid rgba(247, 103, 7, 0.15);
  color: var(--alert-orange-text);
}

.day-status-badge.consumed {
  background: var(--happy-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: var(--happy-green-text);
}

.day-body {
  flex-grow: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.empty-day-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  gap: 8px;
  color: var(--text-light-gray);
  text-align: center;
  padding: 16px 0;
}

.empty-day-content i {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

.empty-day-content p {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Day Active Meal layout */
.day-meal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.day-meal-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.day-meal-servings {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-cozy-cream);
  padding: 3px 8px;
  border-radius: var(--border-radius-sm);
  width: fit-content;
}

.day-meal-servings i {
  width: 12px;
  height: 12px;
}

/* Day checklist layout */
.day-ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-cozy-cream);
  padding: 8px;
  border-radius: var(--border-radius-md);
  margin-top: 2px;
}

.day-ing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 0;
}

.day-ing-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.day-ing-item-left i {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.day-ing-item-left i.text-success { color: var(--happy-green); }
.day-ing-item-left i.text-danger { color: var(--sweet-coral); }

.day-ing-item-left span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dark);
}

.day-ing-qty {
  color: var(--text-muted);
  flex-shrink: 0;
}

.day-meal-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.day-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.day-card-badge.ok {
  background: var(--happy-green-bg);
  color: var(--happy-green-text);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.day-card-badge.missing {
  background: var(--sweet-coral-bg);
  color: var(--sweet-coral-text);
  border: 1px solid rgba(250, 82, 82, 0.15);
}

/* ==========================================================================
   Global Button Styling (Cute rounded design)
   ========================================================================== */
.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: var(--border-radius-md);
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-bubble);
}

.btn-primary {
  background: var(--cozy-peach);
  color: white;
  border: 1px solid rgba(244, 114, 182, 0.2);
  box-shadow: 0 4px 10px var(--cozy-peach-glow);
}

.btn-primary:hover {
  background: var(--cozy-peach-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px var(--cozy-peach-glow);
}

.btn-outline {
  background: var(--white-pure);
  color: var(--text-dark);
  border: 1px solid var(--border-cozy);
}

.btn-outline:hover {
  background: #fbf9f4;
  border-color: var(--cozy-peach);
}

.btn-outline.active {
  background: var(--cozy-peach-light);
  border-color: var(--cozy-peach);
  color: var(--cozy-peach-hover);
}

.btn-success {
  background: var(--happy-green);
  color: white;
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
}

.btn-success:hover {
  background: #099268;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.2);
}

.btn-danger {
  background: var(--sweet-coral);
  color: white;
  border: 1px solid rgba(250, 82, 82, 0.2);
}

.btn-danger:hover {
  background: #c22525;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

/* ==========================================================================
   Modals & Interaction Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(43, 45, 66, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-bubble);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  border-color: var(--border-cozy);
  box-shadow: 0 20px 40px rgba(182, 172, 155, 0.25);
  transform: scale(0.92);
  transition: var(--transition-bubble);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-cozy);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-bubble);
}

.modal-close:hover {
  background: var(--bg-cozy-cream);
  color: var(--text-dark);
}

/* Modals sizing constraints */
.max-w-lg { max-width: 560px; }
.max-w-sm { max-width: 380px; }

/* ==========================================================================
   Form Input Elements
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
select {
  background: var(--bg-cozy-cream);
  border: 1px solid var(--border-cozy);
  color: var(--text-dark);
  border-radius: var(--border-radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-bubble);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--white-pure);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.15);
}

select option {
  background-color: var(--white-pure);
  color: var(--text-dark);
}

.input-helper-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--border-cozy);
  padding-top: 14px;
}

/* ==========================================================================
   Meal plan ingredient picker inside Modal
   ========================================================================== */
.ingredients-selection-list {
  background: var(--bg-cozy-cream);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-md);
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredient-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(182, 172, 155, 0.05);
}

.ing-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
}

.ing-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--cozy-peach);
}

.ing-qty-configurator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ing-qty-configurator span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ing-qty-configurator input {
  width: 50px;
  padding: 4px 6px;
  font-size: 0.8rem;
  text-align: center;
}

/* Ingredient Check Preview */
.mrp-live-preview-box {
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
  margin-top: 14px;
}

.mrp-preview-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.mrp-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.mrp-badge.text-success { color: var(--happy-green-text); }
.mrp-badge.text-danger { color: var(--sweet-coral-text); }

.mrp-preview-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mrp-line-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
}

.mrp-line-status.in-stock { color: var(--happy-green-text); }
.mrp-line-status.missing { color: var(--sweet-coral-text); }

/* ==========================================================================
   Alerts & Reminders Banner
   ========================================================================== */
.alerts-banner-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-banner {
  background: var(--sweet-coral-bg);
  border: 1px solid rgba(250, 82, 82, 0.15);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: bannerSlideDown 0.3s ease-out;
}

@keyframes bannerSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.alert-banner-left i {
  color: var(--sweet-coral);
  width: 20px;
  height: 20px;
}

.btn-alert-action {
  background: var(--sweet-coral);
  color: white;
  border: none;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition-bubble);
}

.btn-alert-action:hover {
  background: #c22525;
}

/* ==========================================================================
   Toast Notification Panel
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(182, 172, 155, 0.15);
  min-width: 280px;
  animation: bubblePopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: var(--transition-bubble);
}

@keyframes bubblePopIn {
  from { opacity: 0; transform: scale(0.8) translate(40px, 10px); }
  to { opacity: 1; transform: scale(1) translate(0, 0); }
}

.toast.removing {
  opacity: 0;
  transform: scale(0.9) translate(40px, 0);
}

.toast i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success { border-color: rgba(16, 185, 129, 0.35); }
.toast.success i { color: var(--happy-green); }

.toast.info { border-color: rgba(244, 114, 182, 0.35); }
.toast.info i { color: var(--cozy-peach); }

.toast.warning { border-color: rgba(247, 103, 7, 0.35); }
.toast.warning i { color: var(--alert-orange); }

.toast.danger { border-color: rgba(250, 82, 82, 0.35); }
.toast.danger i { color: var(--sweet-coral); }

.toast-message {
  font-size: 0.85rem;
  color: var(--text-dark);
  font-weight: 600;
}

/* ==========================================================================
   Sliding Drawer Overlay & Panel
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(43, 45, 66, 0.3);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-bubble);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.drawer-panel {
  width: 380px;
  background: var(--white-pure);
  height: 100%;
  border-left: 1px solid var(--border-cozy);
  box-shadow: -10px 0 30px rgba(182, 172, 155, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: var(--transition-bubble);
}

.drawer-overlay.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-cozy);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-bubble);
}

.drawer-close:hover {
  background: var(--bg-cozy-cream);
  color: var(--text-dark);
}

.drawer-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* User Card in drawer */
.drawer-profile-card {
  background: linear-gradient(135deg, #fdf2f8 0%, #fffbeb 100%);
  border: 1px solid rgba(244, 114, 182, 0.1);
  border-radius: var(--border-radius-xl);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.large-avatar {
  font-size: 2.8rem;
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.profile-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.profile-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--cozy-peach-light);
  color: var(--cozy-peach-hover);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-top: 6px;
}

/* Section styling in drawer */
.drawer-section {
  border-bottom: 1px solid var(--border-cozy);
  padding-bottom: 20px;
}

.drawer-section:last-child {
  border-bottom: none;
}

.drawer-section h5 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-section h5 i {
  width: 14px;
  height: 14px;
}

/* Stats Row in Drawer */
.drawer-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}

.stat-col {
  background: var(--bg-cozy-cream);
  border-radius: var(--border-radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Settings toggles in Drawer */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-label-block strong {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  display: block;
}

.setting-label-block p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Rounded CSS toggle switch */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e9e4d9;
  transition: .3s;
  border-radius: 24px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--cozy-peach);
}

input:focus + .slider-round {
  box-shadow: 0 0 1px var(--cozy-peach);
}

input:checked + .slider-round:before {
  transform: translateX(22px);
}

.btn-full {
  width: 100%;
  padding: 12px;
}

/* Pantry Counter and Slider layouts inside the Stock cells */
.pantry-counter-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-cozy-cream);
  padding: 4px 10px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-cozy);
  width: fit-content;
}

.pantry-counter-val {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  min-width: 60px;
  text-align: center;
}

.pantry-slider-cell-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 180px;
}

.slider-value-bubble {
  background: var(--cozy-peach-light);
  color: var(--cozy-peach-hover);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--border-radius-sm);
  min-width: 44px;
  text-align: center;
  border: 1px solid rgba(244, 114, 182, 0.15);
}

.slider-value-bubble.low {
  background: var(--alert-orange-bg);
  color: var(--alert-orange-text);
  border-color: rgba(247, 103, 7, 0.15);
}

.slider-value-bubble.depleted {
  background: var(--sweet-coral-bg);
  color: var(--sweet-coral-text);
  border-color: rgba(250, 82, 82, 0.15);
}

/* Form Settings custom alignments */
.form-group strong {
  font-size: 0.85rem;
  color: var(--text-dark);
}

/* ==========================================================================
   Mobile-First Responsive Adjustments
   ========================================================================== */
html, body {
  overflow: hidden !important; /* Prevent any outer document scrolling (both horizontal & vertical) */
  max-width: 100vw !important;
  width: 100% !important;
  height: 100vh !important;
  max-height: 100vh !important;
  position: relative !important;
}

@media (max-width: 768px) {
  /* Prevent horizontal overflow on top-level layout containers */
  .homey-header, .app-layout {
    max-width: 100vw !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  /* De-clutter Header Bar on mobile screen widths */
  .homey-header {
    padding: 0 16px !important;
  }

  .header-status {
    display: none !important; /* Hide header status bar */
  }

  .avatar-label {
    display: none !important; /* Hide Chief Chef text */
  }

  /* Turn the profile button into a perfectly centered round circle when text is hidden */
  .profile-avatar-btn {
    padding: 4px !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    justify-content: center !important;
  }

  /* Scale settings drawer to full screen overlay */
  .drawer-panel {
    width: 100% !important;
    max-width: 100vw !important;
    border-left: none !important;
  }

  /* Redefine layout grid: stack vertically instead of side-by-side */
  .app-layout {
    flex-direction: column !important;
    height: calc(100vh - var(--header-height)) !important;
    overflow: hidden !important;
  }

  /* Convert sidebar to a horizontal, scrollable navigation bar */
  .sidebar {
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    padding: 8px 16px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-cozy) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
    background: var(--white-pure) !important;
    /* Hide scrollbars */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row !important;
    gap: 10px !important;
    width: auto !important;
  }

  .nav-item {
    padding: 10px 16px !important;
    width: auto !important;
    font-size: 0.85rem !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .nav-item:hover {
    transform: none !important;
  }

  .sidebar-footer {
    display: none !important; /* Hide footer note to save space */
  }

  /* Compact workspace padding to maximize phone screen size utility */
  .workspace {
    padding: 16px !important;
    overflow-y: auto !important;
    height: 100% !important;
  }

  /* Stack multi-column forms into single-column layouts */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Wrap welcome banner vertically */
  .welcome-banner {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 18px 20px !important;
  }

  .welcome-date {
    align-self: flex-start !important;
    margin-top: 0 !important;
  }

  /* Stack quick actions buttons vertically on mobile to prevent overflow & cutting */
  .actions-buttons-grid {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .actions-buttons-grid .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Ensure pantry filter buttons wrap beautifully */
  .filter-group {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

/* ==========================================================================
   Login Gate
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--bg-cozy-cream);
  overflow: hidden;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--white-pure);
  border: 1px solid var(--border-cozy);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-cozy);
  padding: 40px 34px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-emoji {
  font-size: 52px;
  display: block;
  line-height: 1;
  margin-bottom: 10px;
}

.login-logo h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-logo p {
  font-size: 15px;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  padding-left: 4px;
}

.login-field input {
  font-family: inherit;
  font-size: 15px;
  color: var(--text-dark);
  background: var(--bg-cozy-cream);
  border: 2px solid var(--border-cozy);
  border-radius: var(--border-radius-md);
  padding: 13px 16px;
  transition: var(--transition-bubble);
}

.login-field input::placeholder {
  color: var(--text-light-gray);
}

.login-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--white-pure);
  box-shadow: 0 0 0 4px var(--cozy-peach-glow);
}

.login-error {
  min-height: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sweet-coral-text);
  text-align: center;
}

.login-error:empty {
  min-height: 0;
}

.login-submit {
  margin-top: 4px;
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.drawer-logout-btn {
  margin-top: 10px;
  color: var(--sweet-coral-text);
  border-color: var(--sweet-coral);
}

.drawer-logout-btn:hover {
  background: var(--sweet-coral-bg);
}

