/* LUSH Green Hub - Scrap-o-Matic Design System */
:root {
  --lush-black: #121212;
  --lush-dark-surface: #1e1e1e;
  --lush-dark-border: #2e2e2e;
  --lush-white: #ffffff;
  --lush-bg: #f8f9fa;
  --lush-card-bg: #ffffff;
  --lush-border: #e5e7eb;
  --lush-border-subtle: #f1f3f5;
  --lush-text-primary: #111827;
  --lush-text-secondary: #4b5563;
  --lush-text-muted: #9ca3af;
  --lush-text-inverse: #f9fafb;

  /* Status Colors */
  --status-incoming-bg: #e0f2fe;
  --status-incoming-text: #0284c7;
  --status-incoming-border: #bae6fd;

  --status-received-bg: #dcfce7;
  --status-received-text: #16a34a;
  --status-received-border: #bbf7d0;

  --status-sorted-bg: #f3e8ff;
  --status-sorted-text: #9333ea;
  --status-sorted-border: #e9d5ff;

  --status-donated-bg: #ccfbf1;
  --status-donated-text: #0d9488;
  --status-donated-border: #99f6e4;

  --status-disposed-bg: #f1f5f9;
  --status-disposed-text: #475569;
  --status-disposed-border: #cbd5e1;

  --status-cancelled-bg: #ffe4e6;
  --status-cancelled-text: #e11d48;
  --status-cancelled-border: #fecdd3;

  --status-pending-bg: #fef3c7;
  --status-pending-text: #d97706;
  --status-pending-border: #fde68a;

  --status-shop-bg: #e0e7ff;
  --status-shop-text: #4338ca;
  --status-shop-border: #c7d2fe;

  /* Touch & Screen Variables (Safe Area Insets) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  --min-touch-target: 48px;
}

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

html, body {
  height: 100%;
  width: 100%;
  background-color: var(--lush-bg);
  color: var(--lush-text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

/* Ensure mobile inputs do not trigger Blink/WebKit auto-zoom */
input, select, textarea {
  font-size: 16px !important;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--lush-bg);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: calc(1.5rem + var(--sat)) calc(2rem + var(--sar)) calc(2rem + var(--sab)) calc(2rem + var(--sal));
}

/* Common Pill Buttons */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  min-height: var(--min-touch-target);
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-pill-primary {
  background-color: var(--lush-black);
  color: var(--lush-white);
  border-color: var(--lush-black);
}

.btn-pill-primary:hover {
  background-color: #262626;
  border-color: #262626;
}

.btn-pill-primary:active {
  transform: scale(0.98);
}

.btn-pill-secondary {
  background-color: var(--lush-white);
  color: var(--lush-text-primary);
  border-color: var(--lush-border);
}

.btn-pill-secondary:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

.btn-pill-secondary:active {
  background-color: #e5e7eb;
}

/* Status Pill Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.025em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-badge.status-incoming {
  background-color: var(--status-incoming-bg);
  color: var(--status-incoming-text);
  border-color: var(--status-incoming-border);
}

.status-badge.status-received {
  background-color: var(--status-received-bg);
  color: var(--status-received-text);
  border-color: var(--status-received-border);
}

.status-badge.status-sorted {
  background-color: var(--status-sorted-bg);
  color: var(--status-sorted-text);
  border-color: var(--status-sorted-border);
}

.status-badge.status-donated {
  background-color: var(--status-donated-bg);
  color: var(--status-donated-text);
  border-color: var(--status-donated-border);
}

.status-badge.status-disposed {
  background-color: var(--status-disposed-bg);
  color: var(--status-disposed-text);
  border-color: var(--status-disposed-border);
}

.status-badge.status-cancelled {
  background-color: var(--status-cancelled-bg);
  color: var(--status-cancelled-text);
  border-color: var(--status-cancelled-border);
}

.status-badge.status-pending {
  background-color: var(--status-pending-bg);
  color: var(--status-pending-text);
  border-color: var(--status-pending-border);
}

.status-badge.status-shop {
  background-color: var(--status-shop-bg);
  color: var(--status-shop-text);
  border-color: var(--status-shop-border);
}

/* Modal Backdrops & Overlays */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(1.5rem + var(--sab));
  right: calc(1.5rem + var(--sar));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--lush-black);
  color: var(--lush-white);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
}

.toast.toast-error {
  background-color: #991b1b;
  color: #fef2f2;
}

.toast.toast-success {
  background-color: #065f46;
  color: #ecfdf5;
}

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

/* Responsive Breakpoints & Mobile Optimization (Samsung Galaxy A15: 360 x 780 dp) */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }

  .main-content {
    padding: 1rem 1rem calc(1.5rem + var(--sab)) 1rem;
    overflow-x: hidden;
  }

  .toast-container {
    bottom: calc(1rem + var(--sab));
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: 100%;
  }
}
