/* =====================================================
   🎨 HALEM FARM CUSTOM STYLES
   ===================================================== */

/* ===== ROOT VARIABLES ===== */
:root {
  --primary-green: #16a34a;
  --primary-green-hover: #15803d;
  --primary-green-light: #22c55e;
  --secondary-gray: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #d1d5db;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --border-radius: 0.5rem;
  --transition: all 0.2s ease-in-out;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Kanit', sans-serif;
  padding: 0.625rem;
  background: var(--secondary-gray);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 1rem 0;
}

p {
  margin: 0 0 1rem 0;
}

/* ===== CONTAINERS ===== */
.container {
  max-width: 30rem; /* 480px */
  margin: 0 auto;
  background: white;
  padding: 0.625rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.main-container {
  max-width: 42rem; /* 672px */
  margin: 0 auto;
  padding: 1rem;
}

/* ===== FORM ELEMENTS ===== */
input[type='number'],
input[type='text'],
input[type='date'],
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  transition: var(--transition);
  font-family: inherit;
}

input[type='number']:focus,
input[type='text']:focus,
input[type='date']:focus,
select:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgb(34 197 94 / 0.1);
}

input[type='number']:disabled,
input[type='text']:disabled,
input[type='date']:disabled,
select:disabled {
  background-color: #f9fafb;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== BUTTONS ===== */
button {
  padding: 0.625rem 1.25rem;
  background: var(--primary-green);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover:not(:disabled) {
  background: var(--primary-green-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-outline {
  background: transparent;
  color: var(--primary-green);
  border: 1px solid var(--primary-green);
}

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

/* ===== VEGETABLE ITEMS ===== */
.veg-item {
  margin-bottom: 0.625rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: var(--transition);
  background: white;
}

.veg-item:hover {
  border-color: var(--primary-green);
  box-shadow: var(--shadow-sm);
}

.veg-item img {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  border-radius: 0.25rem;
}

.veg-item .veg-name {
  font-weight: 500;
  color: var(--text-primary);
}

.veg-item .veg-name-en {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.veg-item .veg-price {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: right;
}

.veg-item .veg-total {
  font-weight: 700;
  color: var(--primary-green);
  text-decoration: underline;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #f3f4f6;
  border-radius: 50%;
  border-top-color: var(--primary-green);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pulse-text {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ===== TOAST ANIMATIONS ===== */
@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  10%, 90% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

.animate-fade-in-out {
  animation: fadeInOut 3s ease-in-out forwards;
}

@keyframes slideInFromBottom {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-in {
  animation: slideInFromBottom 0.3s ease-out;
}

/* ===== UTILITY CLASSES ===== */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-soft {
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.border-dashed-green {
  border: 2px dashed var(--primary-green);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 640px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 0.5rem;
  }

  .main-container {
    padding: 0.5rem;
  }

  button {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .veg-item {
    padding: 0.75rem;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 36rem; /* 576px */
    padding: 1.5rem;
  }

  .main-container {
    padding: 2rem;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .container {
    box-shadow: none;
    max-width: none;
  }

  button {
    display: none;
  }

  .no-print {
    display: none;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus indicators for better accessibility */
input:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --text-secondary: #000;
  }
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-green);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-green-hover);
}