/* ListKing Design Variables */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* HSL Colors - Deep slate charcoal base with vibrant accents */
  --bg-dark: hsl(222, 47%, 9%);
  --bg-card: hsla(222, 38%, 14%, 0.7);
  --bg-card-elevated: hsla(222, 35%, 19%, 0.85);
  
  --primary: hsl(217, 91%, 60%);
  --primary-hover: hsl(217, 91%, 52%);
  --primary-glow: hsla(217, 91%, 60%, 0.15);

  --accent: hsl(271, 91%, 65%);
  --accent-hover: hsl(271, 91%, 58%);
  --accent-glow: hsla(271, 91%, 65%, 0.15);

  --success: hsl(142, 70%, 45%);
  --success-hover: hsl(142, 70%, 38%);
  --success-glow: hsla(142, 70%, 45%, 0.15);

  --danger: hsl(350, 89%, 60%);

  --text-main: hsl(210, 20%, 98%);
  --text-muted: hsl(218, 15%, 70%);
  --border-light: hsla(210, 20%, 98%, 0.08);
  --border-active: hsla(217, 91%, 60%, 0.3);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-body);
  color: var(--text-main);
  background-color: var(--bg-dark);
  font-size: 16px;
}

body {
  min-height: 100vh;
  padding-bottom: 95px; /* offset for bottom navbar */
  line-height: 1.5;
}

.container {
  max-width: 720px; /* Centered mobile screen width */
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.app-header {
  background-color: hsla(222, 47%, 9%, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 65px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
}

.brand-logo {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.cloud-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--border-light);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* Navigation Tabs (Bottom Sticky Menu) */
.app-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: hsla(222, 45%, 11%, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-light);
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.nav-flex {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 75px;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex-grow: 1;
  height: 100%;
  transition: var(--transition-smooth);
  padding: 4px;
}

@media (max-width: 360px) {
  .nav-tab-btn {
    font-size: 0.65rem;
  }
}

.nav-tab-icon {
  width: 22px;
  height: 22px;
  transition: var(--transition-smooth);
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn.active {
  color: var(--primary);
}

.nav-tab-btn.active .nav-tab-icon {
  transform: translateY(-2px);
}

/* Views Management */
.app-view {
  display: none;
  padding: 24px 0;
  animation: viewFadeIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.app-view.active {
  display: block;
}

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

/* Step Wizard Management */
.step-container {
  display: none;
  animation: viewFadeIn 0.3s ease-out;
}

.step-container.active {
  display: block;
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
}

@media (max-width: 768px) {
  .wizard-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.step-indicator {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
}

/* Meta Data Card (List Title) */
.list-meta-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.list-meta-card label,
.add-item-card label,
.order-notes-wrapper label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.list-meta-card input {
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: var(--transition-smooth);
}

.list-meta-card input:focus {
  outline: none;
  border-bottom-color: var(--primary);
}

/* Template Select Box */
.template-selector-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-selector-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.template-selector-group select {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  background-color: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

/* Add Item Form Card */
.add-item-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.add-item-card h4 {
  font-family: var(--font-heading);
  margin-bottom: 16px;
  font-size: 1rem;
}

.add-item-row-1 {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.add-item-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: flex-end;
}

.add-item-row-2 .input-group:nth-child(3) {
  grid-column: 1 / 2;
}

.add-item-row-2 .add-item-btn {
  grid-column: 2 / 3;
  width: 100%;
  height: 42px;
}

@media (min-width: 768px) {
  .add-item-row-2 {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
  .add-item-row-2 .input-group:nth-child(3) {
    grid-column: auto;
  }
  .add-item-row-2 .add-item-btn {
    grid-column: auto;
    width: 42px;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group.full-width {
  flex-grow: 1;
}

.input-group input {
  width: 100%;
  min-width: 0;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 12px;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.add-item-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.add-item-btn:hover {
  background-color: var(--primary-hover);
}

/* Draft Items Section */
.draft-items-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  padding: 20px;
  margin-bottom: 90px; /* spacing before sticky bottom buy button */
}

.draft-items-section h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.empty-draft-notice {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.draft-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.draft-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card-elevated);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.draft-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.draft-item-specs {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.draft-item-specs span::after {
  content: ' •';
}

.draft-item-specs span:last-child::after {
  content: '';
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
}

/* Sticky Wizard Action Footers */
.wizard-footer-action {
  position: fixed;
  bottom: 85px; /* just above bottom nav */
  left: 0;
  width: 100%;
  padding: 12px 16px;
  background-color: hsla(222, 47%, 9%, 0.9);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-light);
  z-index: 85;
}

.wizard-footer-action .container,
.wizard-footer-action button {
  max-width: 688px; /* matching container minus padding */
  margin: 0 auto;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--border-light);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background-color: rgba(255,255,255,0.15);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* STEP 2: Purchase Checklist View */
.active-list-header-card {
  background: linear-gradient(135deg, var(--bg-card) 30%, var(--bg-card-elevated));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.active-list-header-card h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.active-list-model-badge {
  background-color: var(--accent-glow);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
}

.purchase-checklist-container {
  margin-bottom: 90px;
}

.checklist-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 8px;
}

.purchase-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Checked Item styling */
.purchase-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: var(--transition-smooth);
}

.purchase-item-row.bought {
  border-color: var(--success);
  background-color: var(--success-glow);
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  flex-grow: 1;
  min-width: 0;
}

.custom-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-weight: bold;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.purchase-item-row.bought .custom-checkbox {
  border-color: var(--success);
  background-color: var(--success);
  color: #ffffff;
}

.item-buy-name {
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  word-break: break-word;
  white-space: normal;
  display: block;
}

.purchase-item-row.bought .item-buy-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.item-buy-spec {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* Actual Price Input inside Active Purchase card */
.purchase-price-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}

.purchase-price-input-group label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: bold;
}

.price-box-input {
  width: 75px;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: right;
  transition: var(--transition-smooth);
}

.price-box-input:focus {
  outline: none;
  border-color: var(--success);
}

/* STEP 3: Receipt Page */
.receipt-card {
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-md);
  padding: 30px 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 90px;
  position: relative;
}

/* Receipt jagged bottom mock edge */
.receipt-card::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 10px;
  background-image: linear-gradient(135deg, #ffffff 4px, transparent 0), linear-gradient(225deg, #ffffff 4px, transparent 0);
  background-position: left bottom;
  background-size: 10px 10px;
  background-repeat: repeat-x;
}

.receipt-header {
  text-align: center;
  margin-bottom: 24px;
  border-bottom: 1.5px dashed #dddddd;
  padding-bottom: 20px;
}

.receipt-badge-logo {
  width: 44px;
  height: 44px;
  color: var(--primary);
  margin-bottom: 12px;
}

.receipt-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
}

.receipt-date {
  font-size: 0.75rem;
  color: #777777;
  display: block;
  margin-top: 4px;
}

.receipt-table-wrapper {
  margin-bottom: 24px;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
}

.receipt-table th {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #777777;
  padding-bottom: 10px;
  border-bottom: 1px solid #eeeeee;
  text-align: left;
}

.receipt-table td {
  padding: 12px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #f9f9f9;
}

.receipt-table .text-right {
  text-align: right;
}

.receipt-item-details {
  color: #666666;
  font-size: 0.75rem;
}

.receipt-total-divider {
  border-top: 1.5px dashed #dddddd;
  margin: 16px 0;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: #000000;
}

#receipt-total-price {
  color: var(--success-hover);
}

/* View 2: Saved Lists Feed Card */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.view-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.view-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.saved-lists-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-saved-state {
  text-align: center;
  padding: 60px 10px;
  color: var(--text-muted);
}

.bill-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 20px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.bill-history-card:hover {
  border-color: var(--primary);
  background-color: var(--bg-card-elevated);
}

.bill-history-info h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.bill-history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bill-history-meta span::after {
  content: ' • ';
}

.bill-history-meta span:last-child::after {
  content: '';
}

.bill-history-totals {
  text-align: right;
}

.bill-amount-tag {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--success);
}

.view-bill-btn {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}

/* View 3: Explore Template Model Cards */
.models-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.model-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  background-color: var(--bg-card-elevated);
}

.model-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
}

.model-badge.green { background-color: var(--success-glow); color: var(--success); }
.model-badge.blue { background-color: var(--primary-glow); color: var(--primary); }
.model-badge.purple { background-color: var(--accent-glow); color: var(--accent); }
.model-badge.orange { background-color: hsla(28, 90%, 52%, 0.12); color: var(--orange); }

.model-icon {
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.model-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.model-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-grow: 1;
}

.model-fields-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

/* Lightbox Modal details */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(9, 11, 16, 0.85);
  backdrop-filter: blur(6px);
}

.modal-content {
  background-color: var(--bg-card-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  padding: 30px;
  position: relative;
  z-index: 1010;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  color: var(--text-main);
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--primary);
}

.modal-body h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.modal-body p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Text Colors utilities */
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-right { text-align: right; }

/* Responsive styles */
@media (max-width: 600px) {
  .models-grid {
    grid-template-columns: 1fr;
  }
}
