/**
 * Enterprise Cafeteria POS System
 * Components CSS - Glossy buttons, tables, forms, modals, toasts, tabs, context menu
 */

/* =============================================================================
   1. Buttons (Classic 2010-2015 Glossy Bevels & Glass)
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-heading);
  background: var(--bg-btn-default);
  border: 1px solid var(--border-btn-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-bevel-btn);
  text-shadow: var(--text-light-shadow);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  outline: none;
  vertical-align: middle;
}

.btn:hover:not(:disabled) {
  background: var(--bg-btn-default-hover);
  border-color: #7a828e;
}

.btn:active:not(:disabled), .btn.active {
  background: var(--bg-btn-default-pressed);
  box-shadow: var(--shadow-bevel-btn-pressed);
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 1px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(60%);
  box-shadow: none;
}

/* Button Variants */
.btn-primary {
  background: var(--bg-primary-glossy);
  border-color: var(--color-primary-border);
  color: var(--text-white);
  text-shadow: var(--text-dark-shadow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--bg-primary-glossy-hover);
  border-color: #144918;
}

.btn-primary:active:not(:disabled) {
  background: var(--bg-primary-glossy-pressed);
}

.btn-danger {
  background: var(--bg-btn-red);
  border-color: #a82020;
  color: var(--text-white);
  text-shadow: var(--text-dark-shadow);
}

.btn-danger:hover:not(:disabled) {
  background: var(--bg-btn-red-hover);
  border-color: #8c1717;
}

.btn-danger:active:not(:disabled) {
  background: linear-gradient(180deg, #b71c1c 0%, #d32f2f 100%);
}

.btn-blue {
  background: var(--bg-btn-blue);
  border-color: #125699;
  color: var(--text-white);
  text-shadow: var(--text-dark-shadow);
}

.btn-blue:hover:not(:disabled) {
  background: var(--bg-btn-blue-hover);
}

.btn-amber {
  background: var(--bg-btn-amber);
  border-color: #c75600;
  color: #ffffff;
  text-shadow: var(--text-dark-shadow);
}

.btn-amber:hover:not(:disabled) {
  background: var(--bg-btn-amber-hover);
}

.btn-dark {
  background: var(--bg-btn-dark);
  border-color: #1e2328;
  color: #ffffff;
  text-shadow: var(--text-dark-shadow);
}

/* Button Sizes */
.btn-sm {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 10px 18px;
  font-size: var(--font-size-lg);
  font-weight: 700;
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 14px 22px;
  font-size: var(--font-size-xl);
  font-weight: 700;
  border-radius: var(--radius-lg);
}

.btn-icon-only {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn-icon-only.btn-sm {
  width: 26px;
  height: 26px;
  padding: 3px;
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn-lg svg {
  width: 20px;
  height: 20px;
}

.btn-xl svg {
  width: 26px;
  height: 26px;
}

/* =============================================================================
   2. Form Controls (Crisp, High Contrast, 2010s Bevels)
   ============================================================================= */
.form-group {
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control, .form-select {
  height: 34px;
  padding: 6px 10px;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-heading);
  background-color: #ffffff;
  border: 1px solid #9aa1ab;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

textarea.form-control {
  height: auto;
  min-height: 70px;
  resize: vertical;
}

.form-control:focus, .form-select:focus {
  border-color: #1976d2;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(25, 118, 210, 0.25);
}

.form-control::placeholder {
  color: #9aa1ab;
  font-style: italic;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23495057' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row > * {
  flex: 1;
}

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-append .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}

/* =============================================================================
   3. Tables (Classic Enterprise Grid with Header Gradient & Alternating Rows)
   ============================================================================= */
.table-container {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: var(--shadow-panel-inset);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--font-size-md);
}

.table th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #f2f4f7 0%, #d8dde4 100%);
  color: #2b333c;
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 2px solid #9aa1ab;
  border-right: 1px solid #c9d0db;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  z-index: 10;
}

.table th:last-child {
  border-right: none;
}

.table td {
  padding: 7px 10px;
  border-bottom: 1px solid #e1e4e8;
  border-right: 1px solid #eef1f5;
  color: var(--text-main);
  vertical-align: middle;
}

.table td:last-child {
  border-right: none;
}

.table-striped tbody tr:nth-child(even) {
  background-color: #f7f9fb;
}

.table-hover tbody tr:hover {
  background-color: #eaf1fa !important;
  cursor: pointer;
}

.table tbody tr.selected {
  background-color: #d4e5f9 !important;
  font-weight: 600;
  outline: 1px solid #64b5f6;
}

/* =============================================================================
   4. Status Chips & Badges
   ============================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  line-height: 1.2;
}

.chip-green {
  background-color: var(--status-available-bg);
  border-color: #81c784;
  color: var(--status-available);
}

.chip-red {
  background-color: var(--status-occupied-bg);
  border-color: #e57373;
  color: var(--status-occupied);
}

.chip-orange {
  background-color: var(--status-reserved-bg);
  border-color: #ffb74d;
  color: var(--status-reserved);
}

.chip-blue {
  background-color: var(--status-cleaning-bg);
  border-color: #64b5f6;
  color: var(--status-cleaning);
}

.chip-gray {
  background-color: #eceff1;
  border-color: #cfd8dc;
  color: #546e7a;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: var(--radius-sm);
  background: #6c757d;
  color: #fff;
}

.badge-primary { background-color: var(--color-primary); }
.badge-danger { background-color: #d32f2f; }
.badge-warning { background-color: #f57c00; }
.badge-info { background-color: #0288d1; }

/* =============================================================================
   5. Modals (Windows 7 / Classic Enterprise Dialog Design)
   ============================================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(20, 24, 30, 0.65);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.modal-window {
  background: var(--bg-panel);
  border: 1px solid #717b88;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  max-height: 90vh;
  min-width: 380px;
  animation: popIn 0.15s ease-out;
  overflow: hidden;
}

.modal-window.modal-lg { width: 720px; }
.modal-window.modal-xl { width: 960px; }
.modal-window.modal-sm { width: 400px; }

.modal-header {
  height: 42px;
  padding: 0 var(--space-md);
  background: var(--bg-header-gradient);
  border-bottom: 1px solid var(--border-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #1a222a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  width: 26px;
  height: 22px;
  background: linear-gradient(180deg, #f08080 0%, #d32f2f 100%);
  border: 1px solid #a82020;
  border-radius: var(--radius-xs);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0,0,0,0.2);
}

.modal-close-btn:hover {
  background: linear-gradient(180deg, #ff9999 0%, #e53935 100%);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(180deg, #e7ebf0 0%, #d8dde4 100%);
  border-top: 1px solid var(--border-panel);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* =============================================================================
   6. Tabs
   ============================================================================= */
.tabs-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid #8e97a4;
  padding-left: var(--space-sm);
  background: linear-gradient(180deg, #f1f3f6 0%, #dde2e9 100%);
}

.tab-btn {
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: 600;
  color: #495057;
  background: linear-gradient(180deg, #e4e7ec 0%, #cdd3dc 100%);
  border: 1px solid #a4adb9;
  border-bottom: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: -2px;
  transition: all 0.12s ease;
}

.tab-btn:hover {
  background: linear-gradient(180deg, #f0f2f5 0%, #d8dde5 100%);
  color: #212529;
}

.tab-btn.active {
  background: #ffffff;
  border-color: #8e97a4;
  border-bottom: 2px solid #ffffff;
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* =============================================================================
   7. Toast Notifications
   ============================================================================= */
.toast-container {
  position: fixed;
  bottom: 34px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: var(--shadow-popover);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--font-size-md);
  font-weight: 600;
  animation: slideInRight 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-success {
  background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
  color: #ffffff;
  border-color: #1b5e20;
}

.toast-error {
  background: linear-gradient(180deg, #e53935 0%, #c62828 100%);
  color: #ffffff;
  border-color: #8e0000;
}

.toast-info {
  background: linear-gradient(180deg, #1e88e5 0%, #1565c0 100%);
  color: #ffffff;
  border-color: #0d47a1;
}

.toast-warning {
  background: linear-gradient(180deg, #fb8c00 0%, #ef6c00 100%);
  color: #ffffff;
  border-color: #b26a00;
}

/* =============================================================================
   8. Keypad & Number Pads
   ============================================================================= */
.pos-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.keypad-btn {
  height: 54px;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-btn-default);
  border: 1px solid var(--border-btn-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-bevel-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-btn:active {
  background: var(--bg-btn-default-pressed);
  box-shadow: var(--shadow-bevel-btn-pressed);
  transform: translateY(1px);
}

.keypad-btn.keypad-clear {
  color: #c62828;
}

.keypad-btn.keypad-enter {
  background: var(--bg-primary-glossy);
  border-color: var(--color-primary-border);
  color: #fff;
}

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

@keyframes popIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
