/* ============================================================================
   kitchen.css - Màn hình bếp chuyên nghiệp
   Style: Dark theme + Glass morphism + Card-based tickets
   ============================================================================ */

/* ============ RESET + VARIABLES ============ */
:root {
  --k-primary: #00ff88;
  --k-primary-dark: #00c853;
  --k-warning: #ff9800;
  --k-danger: #ff3b30;
  --k-info: #00a8ff;
  --k-gold: #ffd700;
  
  --k-bg: #0a0a1a;
  --k-surface: #1a1a2e;
  --k-surface-2: #232338;
  
  --k-text: #ffffff;
  --k-text-2: #a0a0c0;
  --k-text-3: #6a6a80;
  
  --k-border: rgba(255, 255, 255, 0.1);
  --k-glass: rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--k-bg);
  color: var(--k-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 30% 20%, #1a1a2e 0%, #0a0a1a 70%);
}

.login-card {
  background: var(--k-surface) !important;
  color: var(--k-text) !important;
  padding: 40px 32px;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--k-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.login-card h1 {
  color: var(--k-primary) !important;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--k-text-2) !important;
  font-size: 13px;
  text-align: center;
  margin-bottom: 24px;
}

.login-card input {
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.3) !important;
  color: var(--k-text) !important;
  border: 1px solid var(--k-border) !important;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}

.login-card input:focus {
  border-color: var(--k-primary) !important;
  box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.1);
}

.login-card .btn-primary {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--k-primary), var(--k-primary-dark)) !important;
  color: #0a0a1a !important;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.login-card .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 255, 136, 0.4);
}

.login-card .error {
  color: var(--k-danger);
  font-size: 13px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(255, 59, 48, 0.1);
  border-radius: 8px;
  text-align: center;
}

/* =========================================================
   LAYOUT
   ========================================================= */
.kitchen-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--k-bg);
}

.kitchen-layout.hidden { display: none; }

/* =========================================================
   HEADER
   ========================================================= */
.kitchen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--k-border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.kitchen-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--k-primary);
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.kitchen-header .status {
  font-size: 13px;
  color: var(--k-text-2);
  font-weight: 500;
}

.kitchen-header .clock {
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  font-weight: 800;
  color: var(--k-primary);
  padding: 8px 16px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  letter-spacing: 2px;
}

/* Nút trong header */
.kitchen-header button {
  font-family: inherit;
}

/* =========================================================
   GRID
   ========================================================= */
.kitchen-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px 24px 40px;
  align-content: start;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.kitchen-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--k-text-2);
}

.kitchen-empty .icon {
  font-size: 80px;
  display: block;
  margin-bottom: 16px;
  opacity: 0.4;
}

.kitchen-empty p {
  font-size: 18px;
  font-weight: 600;
}

/* =========================================================
   ORDER TICKET (thẻ đơn hàng)
   ========================================================= */
.order-ticket {
  position: relative;
  background: var(--k-surface);
  border: 1px solid var(--k-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.3s;
  animation: ticketIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ticketIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.order-ticket:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Border trạng thái */
.order-ticket.pending {
  border-color: rgba(255, 152, 0, 0.5);
  box-shadow: 0 0 24px rgba(255, 152, 0, 0.2);
  animation: ticketPulse 2s ease-in-out infinite;
}

@keyframes ticketPulse {
  0%, 100% { 
    box-shadow: 0 0 24px rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.5);
  }
  50% { 
    box-shadow: 0 0 40px rgba(255, 152, 0, 0.5);
    border-color: rgba(255, 152, 0, 0.8);
  }
}

.order-ticket.confirmed,
.order-ticket.preparing {
  border-color: rgba(0, 168, 255, 0.4);
  box-shadow: 0 0 20px rgba(0, 168, 255, 0.15);
}

.order-ticket.ready {
  border-color: rgba(0, 255, 136, 0.4);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.15);
}

.order-ticket.served {
  border-color: var(--k-border);
  opacity: 0.7;
}

/* =========================================================
   TICKET HEADER
   ========================================================= */
.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--k-border);
}

.ticket-table {
  font-size: 20px;
  font-weight: 900;
  color: var(--k-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--k-text-2);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 100px;
}

.ticket-header .badge {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.pending { background: rgba(255, 152, 0, 0.2); color: var(--k-warning); }
.badge.confirmed { background: rgba(0, 168, 255, 0.2); color: var(--k-info); }
.badge.preparing { background: rgba(0, 168, 255, 0.2); color: var(--k-info); }
.badge.ready { background: rgba(0, 255, 136, 0.2); color: var(--k-primary); }
.badge.served { background: rgba(160, 160, 192, 0.2); color: var(--k-text-2); }

/* =========================================================
   TICKET ITEMS
   ========================================================= */
.ticket-items {
  padding: 12px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--k-border);
}

.ticket-item:last-child { border-bottom: none; }

.ticket-qty {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--k-primary), var(--k-primary-dark));
  color: #0a0a1a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  flex-shrink: 0;
}

.ticket-item-info {
  flex: 1;
  min-width: 0;
}

.ticket-item-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--k-text);
  margin-bottom: 2px;
  word-break: break-word;
}

.ticket-item-note {
  font-size: 12px;
  color: var(--k-warning);
  font-style: italic;
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 6px;
  display: inline-block;
}

/* =========================================================
   TICKET ACTIONS
   ========================================================= */
.ticket-actions {
  padding: 12px 18px 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ticket-actions button {
  flex: 1;
  min-width: 100px;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ticket-actions button:hover {
  transform: translateY(-2px);
}

.ticket-actions button:active {
  transform: translateY(0);
}

/* Nút "Nhận đơn" - vàng cam */
.btn-accept {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.4);
}

.btn-accept:hover {
  box-shadow: 0 8px 24px rgba(255, 152, 0, 0.6);
}

/* Nút "Bắt đầu nấu" - xanh dương */
.btn-prepare {
  background: linear-gradient(135deg, #00a8ff, #0077cc);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 168, 255, 0.4);
}

.btn-prepare:hover {
  box-shadow: 0 8px 24px rgba(0, 168, 255, 0.6);
}

/* Nút "Xong" - xanh lá */
.btn-ready {
  background: linear-gradient(135deg, #00ff88, #00c853);
  color: #0a0a1a;
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.4);
}

.btn-ready:hover {
  box-shadow: 0 8px 24px rgba(0, 255, 136, 0.6);
}

/* Nút "Đã phục vụ" - xám */
.btn-served {
  background: linear-gradient(135deg, #6a6a80, #4a4a5a);
  color: #fff;
  box-shadow: 0 4px 16px rgba(106, 106, 128, 0.3);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .kitchen-header {
    padding: 12px 16px;
    gap: 10px;
  }
  
  .kitchen-header h1 {
    font-size: 18px;
  }
  
  .kitchen-header .clock {
    font-size: 16px;
    padding: 6px 12px;
  }
  
  .kitchen-grid {
    grid-template-columns: 1fr;
    padding: 12px 12px 30px;
    gap: 12px;
  }
  
  .order-ticket {
    border-radius: 12px;
  }
  
  .ticket-header {
    padding: 12px 14px;
  }
  
  .ticket-table {
    font-size: 18px;
  }
  
  .ticket-items {
    padding: 10px 14px;
  }
  
  .ticket-item-name {
    font-size: 14px;
  }
  
  .ticket-actions {
    padding: 10px 14px 14px;
  }
  
  .ticket-actions button {
    padding: 10px 12px;
    font-size: 12px;
    min-width: 80px;
  }
}

@media (min-width: 1400px) {
  .kitchen-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--k-bg); }
::-webkit-scrollbar-thumb {
  background: var(--k-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--k-primary); }
