/* --- Global Colorful POS Theme (Light Mode) --- */
:root {
  --primary: #2563eb; /* Modern Vibrant Blue */
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --bg-color: #f8fafc; /* Light Slate Background */
  --surface-bg: #ffffff;
  --card-border: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --success: #10b981; /* Vibrant Emerald Green */
  --success-bg: #ecfdf5;
  --danger: #ef4444; /* Coral Red */
  --danger-bg: #fef2f2;

  --orange: #f97316;
  --teal: #14b8a6;
  --purple: #8b5cf6;
  --rose: #f43f5e;

  --radius: 14px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 16px -2px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding-bottom: 88px;
  min-height: 100vh;
}

/* Header Bar */
.app-header {
  background: var(--surface-bg);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.header-brand h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.status-badge {
  font-size: 0.72rem;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

/* Main Container */
main {
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.view {
  display: none;
}
.view.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.view-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.view-title-bar h2 {
  font-size: 1.35rem;
  font-weight: 800;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

/* Cards & Layout */
.card {
  background: var(--surface-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
}

.welcome-card {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Vibrant Dashboard Stat Cards with Full Background Colors & White Text */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  color: #ffffff !important;
  box-shadow: var(--shadow-md);
  border: none;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  text-transform: uppercase;
}

.stat-icon-wrapper {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #ffffff;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 10px;
  color: #ffffff !important;
}

/* Background Gradients for Dashboard Cards */
.accent-orange {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.accent-blue {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.accent-green {
  background: linear-gradient(135deg, #10b981, #059669);
}

.accent-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px 0;
}

.section-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-row {
  display: flex;
  gap: 10px;
}
.flex-1 {
  flex: 1;
}
.flex-2 {
  flex: 2;
}
.margin-top-sm {
  margin-top: 10px;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--card-border);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 14px;
  font-size: 1rem;
  border-radius: 10px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Dish Photo Upload UI */
.image-upload-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
}

.image-preview-box {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--card-border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 1.5rem;
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-btn-wrapper {
  position: relative;
  flex: 1;
}

.upload-btn-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Visual Dish Picker Grid */
.visual-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 12px;
}

.picker-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.picker-card:hover,
.picker-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.picker-img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #f1f5f9;
}

.picker-title {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-price {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 800;
}

/* Item Cards & Lists */
.dish-grid,
.order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: var(--surface-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.dish-thumbnail {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid var(--card-border);
  flex-shrink: 0;
}

.item-details {
  flex: 1;
}
.item-details h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.item-price {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.9rem;
}
.item-actions {
  display: flex;
  gap: 8px;
}

/* Order Cards */
.order-card {
  background: var(--surface-bg);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.order-id {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.9rem;
}
.order-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.order-customer {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.order-summary-items {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

.order-total-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--success);
}

/* Cart Table */
.table-card {
  padding: 0;
  overflow: hidden;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.dish-unit-price-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 10px 0;
}

.price-tag {
  color: var(--primary);
  font-weight: 800;
}

.order-summary-box {
  background: #f8fafc;
  padding: 14px;
  border-top: 1px solid var(--card-border);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.1rem;
}

.total-amount {
  color: var(--success);
}

/* Settings Icons & Containers */
.setting-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.setting-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.setting-blue {
  background: var(--primary-light);
  color: var(--primary);
}
.setting-teal {
  background: #f0fdfa;
  color: var(--teal);
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--danger-bg);
}
.danger-text {
  color: var(--danger);
}

.setting-info {
  flex: 1;
}
.margin-top {
  margin-top: 12px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.2s ease;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface-bg);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  flex: 1;
}

.nav-item.active {
  color: var(--primary);
}
.nav-icon {
  font-size: 1.25rem;
}
.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
}

.fab-item {
  position: relative;
  top: -14px;
}

.fab-button {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #ffffff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--surface-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 16px;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 40%);
}
.login-wrap {
  width: 100%;
  max-width: 420px;
}
.login-brand {
  text-align: center;
  margin-bottom: 18px;
}
.login-brand .logo-badge {
  margin: 0 auto 10px;
}
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}
.login-hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-badge.offline-badge {
  background: var(--danger-bg);
  color: var(--danger);
}
.pulse-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.muted-line {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.order-submit-row {
  margin-top: 12px;
  margin-bottom: 12px;
}
.wrap-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #f1f5f9;
}
.role-admin {
  background: #eff6ff;
  color: var(--primary);
}
.role-cashier {
  background: var(--success-bg);
  color: var(--success);
}
.role-waiter {
  background: #fff7ed;
  color: var(--orange);
}

.desktop-sidebar {
  display: none;
}
.employees-table {
  min-width: 720px;
}
#employees-mobile-list {
  display: flex;
  margin-top: 12px;
}

/* Desktop layout */
@media (min-width: 960px) {
  body {
    padding-bottom: 0;
  }
  .app-header {
    display: none;
  }
  .bottom-nav {
    display: none;
  }
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--surface-bg);
    border-right: 1px solid var(--card-border);
    padding: 18px 12px;
    z-index: 120;
  }
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 16px;
  }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }
  .desktop-sidebar .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-muted);
  }
  .desktop-sidebar .nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
  }
  .desktop-sidebar .nav-label {
    font-size: 0.9rem;
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px 4px;
    border-top: 1px solid var(--card-border);
  }
  main {
    max-width: 1100px;
    margin: 0 0 0 240px;
    padding: 24px 28px 40px;
    width: calc(100% - 240px);
  }
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .visual-picker-grid {
    max-height: 280px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  #employees-mobile-list {
    display: none;
  }
  .header-logout {
    display: none;
  }
}

@media (max-width: 959px) {
  .desktop-table-card {
    display: none;
  }
}
