/* ==============================================================================
 * Responsive Stylesheet
 * ============================================================================== */

/* Mobile Bottom Navigation Bar (Hidden by default on Desktop) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 20, 34, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mobile-nav-btn .icon {
  font-size: 1.3rem;
}

.mobile-nav-btn.active {
  color: var(--primary);
  font-weight: 700;
}

.mobile-nav-btn.scan-primary-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  padding: 0;
  margin-top: -24px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  border: 3px solid var(--bg-main);
  justify-content: center;
}

.mobile-nav-btn.scan-primary-btn .icon {
  font-size: 1.5rem;
}

/* Modal Confirmation Sheet for Mobile & Desktop */
.mobile-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.mobile-modal-backdrop.active {
  display: flex;
}

.mobile-modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (max-width: 768px) {
  .mobile-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .mobile-modal-card {
    border-radius: 24px 24px 0 0;
    padding: 24px 24px calc(28px + env(safe-area-inset-bottom, 0px));
    animation: slideUpModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes slideUpModal {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Tablet Breakpoints */
@media (max-width: 1024px) {
  .scanner-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Breakpoints */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  
  .top-bar {
    padding: 14px 18px;
  }
  
  .content-area {
    padding: 16px 14px;
  }
  
  .mobile-bottom-nav {
    display: none !important;
  }
  
  .live-clock-card {
    display: flex !important;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  .camera-wrapper {
    height: 300px;
    max-width: 100%;
  }

  .scanner-box {
    padding: 14px;
  }

  .action-type-selector {
    grid-template-columns: 1fr 1fr;
  }

  .btn-action-type {
    padding: 12px 10px;
    font-size: 0.85rem;
  }

  .glass-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .toast-container {
    bottom: 80px;
    right: 14px;
    left: 14px;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  /* Responsive Settings Tab for Mobile */
  .settings-card {
    padding: 16px;
  }

  .settings-actions-grid {
    flex-direction: column;
    width: 100%;
  }

  .settings-actions-grid .btn {
    width: 100%;
    justify-content: center;
  }

  .gps-inputs-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .gps-actions-grid {
    flex-direction: column;
    width: 100%;
  }

  .gps-actions-grid .btn {
    width: 100%;
    justify-content: center;
  }

  .gps-actions-grid .btn-save-gps {
    margin-left: 0;
  }

  .tutorial-steps-grid {
    grid-template-columns: 1fr;
  }

  .settings-card .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Tablet Breakpoints for Settings */
@media (max-width: 992px) and (min-width: 769px) {
  .gps-inputs-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tutorial-steps-grid {
    grid-template-columns: 1fr;
  }
}

/* ==============================================================================
 * Dedicated Staff Scan & Portal Responsive Design (All Devices)
 * ============================================================================== */

/* Staff Portal Container & Global Resets */
body.mode-staff-portal,
body.mode-scan-only,
body.mode-leave-only {
  background: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.12) 0%, rgba(11, 15, 25, 0.98) 60%), #0b0f19;
  min-height: 100vh;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Staff Portal Top Bar Responsive */
body.mode-staff-portal .top-bar,
body.mode-scan-only .top-bar,
body.mode-leave-only .top-bar {
  padding: 10px 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: rgba(11, 15, 25, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.mode-staff-portal .top-bar-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

body.mode-staff-portal .top-bar-left .page-title {
  min-width: 0;
  overflow: hidden;
}

body.mode-staff-portal .top-bar-left .page-title h2 {
  display: none !important;
}

body.mode-staff-portal #live-date {
  font-size: clamp(0.72rem, 2.5vw, 0.86rem) !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
}

body.mode-staff-portal .top-bar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

body.mode-staff-portal .live-clock-card {
  padding: 4px 10px !important;
  border-radius: 10px !important;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
  gap: 8px !important;
}

body.mode-staff-portal .clock-time {
  font-size: clamp(0.82rem, 2.8vw, 0.95rem) !important;
  font-weight: 700 !important;
  color: #34d399 !important;
  letter-spacing: 0.02em !important;
}

/* Staff Portal Navigation Tabs */
body.mode-staff-portal .staff-portal-bar {
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 8px 12px 0 12px !important;
  margin: 0 auto 10px auto !important;
  width: 100% !important;
  max-width: 500px !important;
  box-sizing: border-box !important;
}

body.mode-staff-portal .staff-nav-tabs {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  padding: 4px !important;
  border-radius: 100px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  width: 100% !important;
}

body.mode-staff-portal .btn-staff-tab {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 9px 8px !important;
  border-radius: 100px !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  font-size: clamp(0.78rem, 2.6vw, 0.88rem) !important;
  font-weight: 700 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: nowrap !important;
  text-align: center !important;
}

body.mode-staff-portal .btn-staff-tab.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.45) !important;
}

body.mode-staff-portal .btn-staff-tab.leave-tab.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45) !important;
}

/* Staff Account Selector Card */
.staff-account-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.staff-select-dropdown {
  width: 100%;
  min-height: 44px;
  background: #090d16;
  color: #38bdf8;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: clamp(0.82rem, 2.6vw, 0.92rem);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.staff-select-dropdown:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Action Type Buttons (Check-In vs Check-Out) */
.action-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.btn-action-type {
  min-height: 52px;
  box-sizing: border-box;
}

.btn-action-type.check-in.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5) !important;
}

.btn-action-type.check-out.active {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5) !important;
}

/* Camera Wrapper Responsive Ratio */
.camera-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: clamp(280px, 78vw, 380px);
  margin: 0 auto 12px auto;
  border-radius: 16px;
  overflow: hidden;
  background: #000000;
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
}

.camera-wrapper #reader {
  width: 100% !important;
  height: 100% !important;
  position: relative;
}

.camera-wrapper #reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 14px;
}

/* Scanner Action Buttons */
.scanner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
}

.scanner-actions .btn {
  min-height: 42px;
  border-radius: 10px;
  font-size: clamp(0.76rem, 2.5vw, 0.86rem);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  box-sizing: border-box;
  text-align: center;
}

/* ==============================================================================
 * Responsive Device Breakpoints for Staff Scan
 * ============================================================================== */

/* Desktop & Large Screens (>= 1024px) */
@media (min-width: 1024px) {
  body.mode-staff-portal .content-area,
  body.mode-scan-only .content-area {
    padding: 14px 20px 32px 20px !important;
    max-width: 540px !important;
    margin: 0 auto;
    box-sizing: border-box !important;
  }

  body.mode-staff-portal .scanner-grid,
  body.mode-scan-only .scanner-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-width: 500px !important;
    margin: 0 auto !important;
    width: 100% !important;
  }

  body.mode-staff-portal .scanner-box {
    padding: 16px 18px !important;
    border-radius: 18px !important;
  }

  body.mode-staff-portal .camera-wrapper,
  body.mode-scan-only .camera-wrapper {
    height: 380px !important;
    max-height: 380px !important;
    max-width: 460px !important;
  }

  body.mode-staff-portal .result-display-card {
    position: static !important;
    margin-top: 0 !important;
    gap: 8px !important;
  }
}

/* Tablets (768px to 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
  body.mode-staff-portal .content-area,
  body.mode-scan-only .content-area {
    padding: 12px 16px 24px 16px !important;
    max-width: 520px !important;
    margin: 0 auto;
    box-sizing: border-box !important;
  }

  body.mode-staff-portal .scanner-grid,
  body.mode-scan-only .scanner-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-width: 480px !important;
    margin: 0 auto !important;
    width: 100% !important;
  }

  body.mode-staff-portal .camera-wrapper,
  body.mode-scan-only .camera-wrapper {
    height: 380px !important;
    max-height: 380px !important;
    max-width: 460px !important;
  }
}

/* Mobile Phones (< 768px) */
@media (max-width: 767px) {
  body.mode-staff-portal .content-area,
  body.mode-scan-only .content-area,
  body.mode-leave-only .content-area {
    padding: 6px 10px 24px 10px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.mode-staff-portal .scanner-grid,
  body.mode-scan-only .scanner-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  body.mode-staff-portal .scanner-box {
    padding: 12px 12px !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
  }

  body.mode-staff-portal .camera-wrapper,
  body.mode-scan-only .camera-wrapper {
    height: clamp(290px, 82vw, 380px) !important;
    max-height: 380px !important;
    max-width: 100% !important;
    border-radius: 16px !important;
  }

  body.mode-staff-portal .result-display-card {
    margin-top: 0 !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.mode-staff-portal .result-display-card .glass-card {
    padding: 10px 12px !important;
    border-radius: 14px !important;
  }
}

/* Small Screens (< 420px - iPhone SE, Small Androids) */
@media (max-width: 420px) {
  body.mode-staff-portal .clock-date {
    display: none !important;
  }

  body.mode-staff-portal .staff-nav-tabs {
    max-width: 100% !important;
    padding: 3px !important;
  }

  body.mode-staff-portal .btn-staff-tab {
    padding: 8px 4px !important;
    font-size: 0.76rem !important;
    gap: 4px !important;
  }

  .action-type-selector {
    gap: 8px;
  }

  .btn-action-type {
    min-height: 44px;
    font-size: 0.78rem;
    padding: 6px 4px;
    gap: 4px;
  }

  .scanner-actions {
    gap: 8px;
  }

  .scanner-actions .btn {
    font-size: 0.74rem;
    padding: 8px 4px;
  }
}

