/* ========================================
   POS SYSTEM - RESPONSIVE STYLES
   Mobile-First Design
   ======================================== */

/* ========== CSS VARIABLES ========== */
:root {
  --primary-color: #667eea;
  --primary-dark: #5568d3;
  --primary-light: #7c91f7;
  --secondary-color: #764ba2;
  --success-color: #28a745;
  --success-dark: #218838;
  --danger-color: #dc3545;
  --danger-dark: #c82333;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-light: #a0aec0;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-tertiary: #edf2f7;
  --bg-dark: #2d3748;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  --transition: all 0.2s ease-in-out;
}

/* ========== RESET & BASE STYLES ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: backgroundMove 20s linear infinite;
}

@keyframes backgroundMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 30px); }
}

.login-box {
  background: var(--bg-primary);
  padding: var(--spacing-xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box h1 {
  color: var(--primary-color);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  text-align: center;
}

.login-box > p {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

/* ========== HEADER ========== */
.header {
  background: var(--bg-primary);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.header-left h1 {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.header-left p {
  font-size: 14px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  gap: var(--spacing-sm);
}

/* ========== CONTAINER ========== */
.container {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-md);
  width: 100%;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
  background: var(--bg-primary);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-tertiary);
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tabs::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.tabs::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

.tab {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
}

.tab.active {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-md);
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  text-align: center;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

/* ========== BUTTONS ========== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  text-decoration: none;
  white-space: nowrap;
  min-height: 42px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: var(--success-dark);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-dark);
  box-shadow: var(--shadow-md);
}

.btn-warning {
  background: var(--warning-color);
  color: var(--text-primary);
}

.btn-warning:hover {
  background: #e0a800;
  box-shadow: var(--shadow-md);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.form-control,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition);
  min-height: 46px;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-light);
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

thead {
  background: var(--bg-tertiary);
}

th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: var(--spacing-md);
  border-top: 1px solid var(--border-light);
  font-size: 15px;
  color: var(--text-primary);
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: var(--bg-secondary);
}

.table-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.table-actions .btn {
  padding: 8px 16px;
  font-size: 13px;
  min-height: 36px;
}

/* ========== ALERTS ========== */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.alert-error {
  background: #fee;
  color: var(--danger-color);
  border: 2px solid var(--danger-color);
}

.alert-success {
  background: #efe;
  color: var(--success-color);
  border: 2px solid var(--success-color);
}

.alert-info {
  background: #eff;
  color: var(--info-color);
  border: 2px solid var(--info-color);
}

/* ========== MODALS ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-md);
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 2px solid var(--border-light);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  padding: var(--spacing-lg);
  border-top: 2px solid var(--border-light);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  background: var(--bg-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-width: 280px;
  max-width: 400px;
  z-index: 2000;
  animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 4px solid var(--success-color);
}

.toast.error {
  border-left: 4px solid var(--danger-color);
}

.toast.info {
  border-left: 4px solid var(--info-color);
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  background: var(--success-color);
  color: white;
}

.toast.error .toast-icon {
  background: var(--danger-color);
  color: white;
}

.toast.info .toast-icon {
  background: var(--info-color);
  color: white;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ========== DATE FILTERS ========== */
.date-filter-buttons {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.custom-date-filter {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 2px solid var(--border-light);
}

.custom-date-filter label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 14px;
}

.date-input {
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  min-height: 42px;
}

/* ========== FOOTER ========== */
.footer {
  background: var(--bg-primary);
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  margin-top: auto;
}

/* ========== CASHIER DASHBOARD SPECIFIC ========== */
.pos-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--spacing-md);
}

.product-card {
  background: var(--bg-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  min-height: 100px;
  justify-content: center;
}

.product-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.product-card:active {
  transform: scale(0.97);
}

.product-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.product-price {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 16px;
}

.cart-section {
  background: var(--bg-primary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 80px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  gap: var(--spacing-sm);
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.cart-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.cart-qty-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.cart-qty-btn:active {
  transform: scale(0.95);
}

.cart-qty {
  font-weight: 700;
  font-size: 15px;
  min-width: 24px;
  text-align: center;
  color: var(--text-primary);
}

.cart-total {
  padding: var(--spacing-md) 0;
  border-top: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  margin: var(--spacing-md) 0;
}

.cart-total-label {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.cart-total-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Mobile Small (< 480px) */
@media (max-width: 479px) {
  .header {
    padding: var(--spacing-sm);
  }
  
  .header-left h1 {
    font-size: 18px;
  }
  
  .container {
    padding: var(--spacing-sm);
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .login-box {
    padding: var(--spacing-lg);
  }

  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-sm);
  }
  
  .product-card {
    padding: var(--spacing-sm);
    min-height: 90px;
  }
  
  .product-name {
    font-size: 13px;
  }
  
  .product-price {
    font-size: 14px;
  }
  
  .toast {
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    left: var(--spacing-sm);
    min-width: auto;
  }
  
  .date-filter-buttons {
    width: 100%;
  }
  
  .date-filter-buttons .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 12px;
  }
  
  .table-actions {
    flex-direction: column;
  }
  
  .table-actions .btn {
    width: 100%;
  }
}

/* Tablet (480px - 768px) */
@media (min-width: 480px) and (max-width: 767px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

/* Desktop (768px+) */
@media (min-width: 768px) {
  .header {
    padding: var(--spacing-lg);
  }
  
  .header-left h1 {
    font-size: 24px;
  }
  
  .container {
    padding: var(--spacing-xl);
  }
  
  .login-box {
    padding: var(--spacing-2xl);
  }
  
  .login-box h1 {
    font-size: 32px;
  }
  
  .pos-container {
    grid-template-columns: 2fr 1fr;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .modal-footer .btn {
    min-width: 100px;
  }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  .header, .footer, .tabs, .btn, .modal-overlay, .toast {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}
