/* Nebamarket POS System - Main Stylesheet */

/* Import Tailwind CSS from CDN - we'll use this for rapid development */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* Custom CSS for POS specific needs */

/* Variables */
:root {
  --primary-color: #1f2937;
  --secondary-color: #3b82f6;
  --accent-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --success-color: #10b981;
  --light-bg: #f9fafb;
  --dark-bg: #111827;
}

/* Base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
}

/* Custom button styles for POS */
.btn-pos {
  @apply px-6 py-3 rounded-lg font-semibold text-white transition-all duration-200 transform hover:scale-105 active:scale-95;
}

.btn-primary {
  @apply bg-blue-600 hover:bg-blue-700;
}

.btn-success {
  @apply bg-green-600 hover:bg-green-700;
}

.btn-danger {
  @apply bg-red-600 hover:bg-red-700;
}

.btn-warning {
  @apply bg-yellow-600 hover:bg-yellow-700;
}

.btn-secondary {
  @apply bg-gray-600 hover:bg-gray-700;
}

/* POS specific styles */
.pos-container {
  @apply min-h-screen bg-gray-100;
}

.pos-sidebar {
  @apply w-80 bg-white shadow-lg overflow-y-auto;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
}

.pos-main {
  @apply flex-1 bg-gray-50;
  margin-left: 20rem; /* 320px */
}

.pos-header {
  @apply bg-white shadow-sm px-6 py-4 flex items-center justify-between;
}

.pos-product-grid {
  @apply grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4 p-6;
}

.pos-product-card {
  @apply bg-white rounded-lg shadow-md p-4 cursor-pointer transition-all duration-200 hover:shadow-lg hover:scale-105;
}

.pos-cart {
  @apply bg-white rounded-lg shadow-md p-4 mb-4;
}

.pos-cart-item {
  @apply flex items-center justify-between py-2 border-b border-gray-200 last:border-b-0;
}

.pos-total {
  @apply bg-gray-50 rounded-lg p-4 text-lg font-semibold;
}

/* Scanner input style */
.barcode-input {
  @apply w-full px-4 py-3 text-xl border-2 border-blue-500 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300;
}

/* Touch-friendly for tablets */
@media (max-width: 1024px) {
  .pos-sidebar {
    @apply w-72;
  }
  
  .pos-main {
    margin-left: 18rem; /* 288px */
  }
  
  .pos-product-grid {
    @apply grid-cols-2 md:grid-cols-3 gap-3;
  }
  
  .btn-pos {
    @apply px-4 py-2 text-sm;
  }
}

@media (max-width: 768px) {
  .pos-sidebar {
    @apply w-full;
    position: relative;
    height: auto;
  }
  
  .pos-main {
    margin-left: 0;
  }
  
  .pos-product-grid {
    @apply grid-cols-2 gap-2 p-4;
  }
}

/* Print styles for receipts */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  .receipt {
    @apply text-sm font-mono;
    width: 58mm; /* Standard thermal printer width */
    margin: 0;
    padding: 0;
  }
  
  .receipt-header {
    @apply text-center font-bold mb-2;
  }
  
  .receipt-item {
    @apply flex justify-between py-1;
  }
  
  .receipt-total {
    @apply font-bold border-t border-black pt-1 mt-1;
  }
}

/* Loading spinner */
.spinner {
  @apply inline-block w-4 h-4 border-2 border-gray-300 border-t-blue-600 rounded-full animate-spin;
}

/* Navigation styles */
.nav-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  color: #e5e7eb;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  font-weight: 500;
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 36px;
}

.nav-item:hover {
  background-color: #374151;
  color: #ffffff;
  text-decoration: none;
}

.nav-item.active,
.nav-item.bg-blue-600 {
  background-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.nav-item.bg-blue-600:hover {
  background-color: #1d4ed8;
  text-decoration: none;
}

.nav-item svg {
  flex-shrink: 0;
  margin-right: 0.5rem;
  height: 1.125rem;
  width: 1.125rem;
}

/* Sidebar background styling */
.sidebar-bg {
  background-color: #1f2937;
}

/* Sidebar transition styles */
.sidebar-transition {
  transition: all 0.3s ease-in-out;
}

/* Alert styles */
.alert {
  @apply px-4 py-3 rounded-lg mb-4;
}

.alert-success {
  @apply bg-green-100 border border-green-400 text-green-700;
}

.alert-error {
  @apply bg-red-100 border border-red-400 text-red-700;
}

.alert-warning {
  @apply bg-yellow-100 border border-yellow-400 text-yellow-700;
}

.alert-info {
  @apply bg-blue-100 border border-blue-400 text-blue-700;
}

/* Form styles */
.form-group {
  @apply mb-4;
}

.form-label {
  @apply block text-sm font-medium text-gray-700 mb-1;
}

.form-input {
  @apply w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500;
}

.form-select {
  @apply w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500;
}

.form-textarea {
  @apply w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500;
}

/* Table styles */
.data-table {
  @apply w-full bg-white shadow-md rounded-lg overflow-hidden;
}

.data-table th {
  @apply bg-gray-50 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
}

.data-table td {
  @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

.data-table tr:nth-child(even) {
  @apply bg-gray-50;
}

/* Modal styles */
.modal-overlay {
  @apply fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50;
}

.modal-content {
  @apply bg-white rounded-lg max-w-lg w-full mx-4 max-h-screen overflow-y-auto;
}

.modal-header {
  @apply px-6 py-4 border-b border-gray-200;
}

.modal-body {
  @apply px-6 py-4;
}

.modal-footer {
  @apply px-6 py-4 border-t border-gray-200 flex justify-end space-x-2;
}

/* Card styles */
.card {
  @apply bg-white shadow-md rounded-lg overflow-hidden;
}

.card-header {
  @apply px-6 py-4 border-b border-gray-200 bg-gray-50;
}

.card-body {
  @apply px-6 py-4;
}

.card-footer {
  @apply px-6 py-4 border-t border-gray-200 bg-gray-50;
}

/* Dashboard styles */
.stats-card {
  @apply bg-white rounded-lg shadow-md p-6;
}

.stats-number {
  @apply text-3xl font-bold text-gray-900;
}

.stats-label {
  @apply text-sm text-gray-600 mt-1;
}

.stats-change {
  @apply text-xs font-medium mt-2;
}

.stats-increase {
  @apply text-green-600;
}

.stats-decrease {
  @apply text-red-600;
}

/* Offline indicator */
.offline-indicator {
  @apply fixed top-0 left-0 right-0 bg-red-600 text-white text-center py-2 z-50;
}

.online-indicator {
  @apply fixed top-0 left-0 right-0 bg-green-600 text-white text-center py-2 z-50 transition-all duration-300;
}

/* Payment method icons */
.payment-method {
  @apply flex items-center space-x-2 p-3 border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-50;
}

.payment-method.selected {
  @apply border-blue-500 bg-blue-50;
}

/* Inventory status badges */
.stock-status {
  @apply px-2 py-1 text-xs font-semibold rounded-full;
}

.stock-in {
  @apply bg-green-100 text-green-800;
}

.stock-low {
  @apply bg-yellow-100 text-yellow-800;
}

.stock-out {
  @apply bg-red-100 text-red-800;
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Utility classes for POS */
.text-currency {
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.border-dashed {
  border-style: dashed;
}

/* Mobile-specific optimizations */
@media (max-width: 767px) {
  /* Mobile button optimizations */
  .btn-pos,
  .mobile-btn {
    min-height: 44px !important; /* iOS recommended touch target */
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }
  
  /* Mobile form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    min-height: 44px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 0.75rem !important;
  }
  
  /* Mobile modal adjustments */
  .modal-content {
    margin: 1rem !important;
    max-height: calc(100vh - 2rem) !important;
    width: calc(100vw - 2rem) !important;
  }
  
  /* Mobile card adjustments */
  .card {
    margin-bottom: 1rem !important;
  }
  
  .card-header,
  .card-body,
  .card-footer {
    padding: 1rem !important;
  }
  
  /* Mobile table responsiveness */
  .data-table {
    font-size: 0.875rem !important;
    overflow-x: auto !important;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.25rem !important;
    min-width: 100px !important;
  }
  
  /* Mobile stats cards */
  .stats-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .stats-number {
    font-size: 1.5rem !important;
  }
  
  /* Mobile text sizing */
  h1 {
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
  }
  
  h2 {
    font-size: 1.125rem !important;
    line-height: 1.4 !important;
  }
  
  h3 {
    font-size: 1rem !important;
    line-height: 1.4 !important;
  }
  
  /* Mobile spacing adjustments */
  .p-6 {
    padding: 1rem !important;
  }
  
  .px-6 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .py-6 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  /* Mobile grid adjustments */
  .grid {
    gap: 1rem !important;
  }
  
  /* Mobile navigation improvements */
  .nav-item {
    padding: 1rem 0.75rem !important;
    font-size: 0.9rem !important;
    min-height: 44px !important;
  }
  
  .nav-item svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
  .btn-pos {
    font-size: 0.875rem !important;
  }
  
  h1 {
    font-size: 1.5rem !important;
  }
  
  .nav-item {
    font-size: 0.875rem !important;
  }
}

/* Scrollbar styles */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
