/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --secondary: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  --info: #4285f4;
  --dark: #202124;
  --light: #f8f9fa;
  --gray: #5f6368;
  --gray-light: #dadce0;
  --white: #ffffff;
  --shadow: 0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  background: #f0f2f5;
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--gray-light);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 700;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

.logo-text span {
  color: var(--primary);
}

.nav-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--light);
  color: var(--dark);
}

.nav-item.active {
  background: var(--primary);
  color: var(--white);
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-light);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--light);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--gray);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOP BAR ===== */
.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-light);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
}

.page-title .subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--gray);
  margin-left: 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--light);
  color: var(--dark);
  border: 1px solid var(--gray-light);
}

.btn-secondary:hover { background: var(--gray-light); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--secondary);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: var(--dark);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--light);
  border: 1px solid var(--gray-light);
  font-size: 16px;
}

.btn-icon:hover { background: var(--gray-light); }

/* ===== CONTENT AREA ===== */
.content-area {
  flex: 1;
  padding: 24px 28px;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-light);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.card-body {
  padding: 22px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #e8f0fe; color: var(--primary); }
.stat-icon.green { background: #e6f4ea; color: var(--secondary); }
.stat-icon.orange { background: #fef3e8; color: #e37400; }
.stat-icon.red { background: #fce8e8; color: var(--danger); }
.stat-icon.purple { background: #f3e8fd; color: #9334e6; }
.stat-icon.teal { background: #e0f7fa; color: #00838f; }

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--gray);
  font-weight: 500;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-change.up { color: var(--secondary); }
.stat-change.down { color: var(--danger); }

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray);
  background: var(--light);
  border-bottom: 2px solid var(--gray-light);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-pending { background: #fef3e8; color: #e37400; }
.badge-pending .badge-dot { background: var(--warning); }

.badge-processing { background: #e8f0fe; color: var(--primary); }
.badge-processing .badge-dot { background: var(--primary); }

.badge-completed { background: #e6f4ea; color: var(--secondary); }
.badge-completed .badge-dot { background: var(--secondary); }

.badge-cancelled { background: #fce8e8; color: var(--danger); }
.badge-cancelled .badge-dot { background: var(--danger); }

/* ===== TICKET NUMBER ===== */
.ticket-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'SF Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  background: var(--light);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-light);
}

.ticket-num .prefix {
  color: var(--primary);
  font-weight: 800;
}

/* ===== QUEUE DISPLAY (LIVE) ===== */
.queue-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.queue-counter {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.queue-counter-header {
  padding: 16px 20px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.queue-counter-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.queue-counter-header .counter-num {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 500;
}

.queue-counter-body {
  padding: 20px;
  min-height: 180px;
}

.current-serving {
  text-align: center;
  padding: 20px 0;
}

.current-serving-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  margin-bottom: 12px;
}

.current-serving-number {
  font-size: 52px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'SF Mono', monospace;
  line-height: 1;
  margin-bottom: 8px;
}

.current-serving-name {
  font-size: 16px;
  color: var(--dark);
  font-weight: 600;
}

.current-serving-service {
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
}

.waiting-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--gray-light);
}

.waiting-list-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.waiting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--light);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 14px;
}

.waiting-item .ticket {
  font-family: 'SF Mono', monospace;
  font-weight: 700;
  color: var(--dark);
}

.waiting-item .name {
  color: var(--gray);
  font-size: 13px;
}

.waiting-item .wait-time {
  font-size: 12px;
  color: var(--gray);
  background: var(--white);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== KIOSK / GENERATOR ===== */
.kiosk-container {
  max-width: 600px;
  margin: 0 auto;
}

.kiosk-header {
  text-align: center;
  padding: 40px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.kiosk-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.kiosk-header p {
  font-size: 16px;
  opacity: 0.9;
}

.service-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.service-btn {
  background: var(--white);
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.service-btn:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.service-btn .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.service-btn .name {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.service-btn .desc {
  font-size: 13px;
  color: var(--gray);
}

.service-btn .wait-est {
  margin-top: 10px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

/* ===== TICKET PRINT ===== */
.ticket-print {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  margin: 0 auto;
}

.ticket-print-header {
  border-bottom: 2px dashed var(--gray-light);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.ticket-print-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
}

.ticket-print-header .datetime {
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
}

.ticket-print-number {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'SF Mono', monospace;
  line-height: 1;
  margin: 20px 0;
}

.ticket-print-service {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.ticket-print-counter {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 20px;
}

.ticket-print-info {
  background: var(--light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.ticket-print-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
}

.ticket-print-info-row .label { color: var(--gray); }
.ticket-print-info-row .value { font-weight: 600; color: var(--dark); }

.ticket-print-barcode {
  height: 60px;
  background: repeating-linear-gradient(
    90deg,
    var(--dark) 0px,
    var(--dark) 2px,
    transparent 2px,
    transparent 4px
  );
  margin: 20px 0;
  border-radius: 4px;
}

.ticket-print-footer {
  font-size: 12px;
  color: var(--gray);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--light);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: var(--gray-light); }

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== FORM ===== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* ===== LIVE FEED ===== */
.live-feed {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.live-feed-header {
  padding: 14px 20px;
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.live-feed-header h3 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.live-feed-body {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-light);
  font-size: 13px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.feed-time {
  font-size: 11px;
  color: var(--gray);
  font-family: monospace;
  white-space: nowrap;
  min-width: 50px;
}

.feed-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.feed-badge.created { background: #e8f0fe; color: var(--primary); }
.feed-badge.processed { background: #fef3e8; color: #e37400; }
.feed-badge.completed { background: #e6f4ea; color: var(--secondary); }
.feed-badge.cancelled { background: #fce8e8; color: var(--danger); }

.feed-text {
  flex: 1;
  color: var(--dark);
}

.feed-text .ticket-id {
  font-family: monospace;
  font-weight: 700;
  color: var(--primary);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-light);
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  background: none;
}

.tab:hover { color: var(--dark); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .queue-display { grid-template-columns: 1fr; }
  .service-buttons { grid-template-columns: 1fr; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--dark);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideToast 0.3s ease;
  max-width: 360px;
}

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

.toast.success { border-left: 4px solid var(--secondary); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
