/* Global variables */
:root {
  --primary-color: #75211f;
  --secondary-color: #0f6bb6;
  --highlight-color: #f1b310;
  --bg-color: #fafafa;
  --text-color: #333;
  --white: #ffffff;
}

/* Global resets & shared styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  /* Prevent scrolling */
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  height: 100%;
  max-width: 600px;
  /* Increased for better desktop look, still mobile focused */
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Shared highlight and footer styles */
.highlight {
  color: var(--highlight-color);
  font-weight: 600;
}

.footer {
  font-size: 13px;
  color: #777;
  text-align: center;
  padding: 16px 0 8px;
  margin-top: auto;
  /* Pin to bottom */
  width: 100%;
}

.footer a {
  color: #777;
  text-decoration: none;
  margin-bottom: 4px;
  display: block;
}

.footer-text {
  margin-top: 8px;
}

.footer .quote {
  color: var(--secondary-color);
  font-weight: 500;
}

/* Login Screen */
.login-screen .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Center vertically */
  align-items: center;
  width: 100%;
}

.login-screen .logo-section {
  text-align: center;
  margin-bottom: 48px;
  /* Reduced specific spacing */
}

.login-screen .logo {
  font-size: 32px;
  /* Responsive size */
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
  line-height: 1.2;
}

.login-screen .subtitle {
  font-size: 18px;
  color: #666;
  font-weight: 400;
}

.login-screen .login-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.login-screen .google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: var(--white);
  border: 1px solid #dadce0;
  border-radius: 50px;
  /* Pill shape */
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 320px;
}

.login-screen .google-signin-btn:active {
  transform: scale(0.98);
  background-color: #f1f3f4;
}

.error {
  color: var(--primary-color);
  margin-top: 16px;
  font-size: 14px;
  min-height: 20px;
}

/* Select Screen */
/* Select Screen */
.select-screen .card {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.select-screen .title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 32px;
  text-align: center;
}

.select-screen .select-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
}

.select-screen .event-select {
  width: 100%;
  padding: 16px 48px 16px 16px;
  font-size: 16px;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: var(--white);
  appearance: none;
  cursor: pointer;
  color: var(--text-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s;
}

.select-screen .event-select:focus {
  outline: none;
  border-color: var(--secondary-color);
}

.select-screen .dropdown-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #777;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-screen .continue-btn {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  background: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  margin: 24px auto 16px;
  display: block;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(117, 33, 31, 0.3);
}

.select-screen .continue-btn:hover {
  background: #5a1a19;
  transform: translateY(-1px);
}

.select-screen .continue-btn:disabled,
.select-screen .continue-btn:disabled:hover {
  background: #e0e0e0 !important;
  color: #999 !important;
  cursor: not-allowed !important;
  box-shadow: none;
  transform: none;
}

.select-screen .logout-btn {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 50px;
  border: 1px solid #e0e0e0;
  background: transparent;
  color: #666;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

.select-screen .logout-btn:hover {
  background: #f5f5f5;
  color: #333;
}

/* Scanner Screen */
.scanner-screen .card {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.scanner-screen .title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 24px;
  text-align: center;
}

.scanner-screen .scanner-wrap {
  width: 100%;
  max-width: 300px;
  /* Limit size */
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 4px solid #e0e0e0;
}

#camera-feed {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background-color: #000;
}

#camera-feed video {
  object-fit: cover !important;
  border-radius: 12px !important;
}

/* HTML5-QR-Code specific styling overrides */
#camera-feed .qr-code-scanner-region {
  width: 100% !important;
  height: 100% !important;
}

.scanner-wrap.success {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .3);
}

.scanner-screen .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.scanner-screen .primary-btn {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  background: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(117, 33, 31, 0.3);
  transition: all 0.2s ease;
  display: block;
}

.scanner-screen .primary-btn:hover {
  background: #5a1a19;
  transform: translateY(-1px);
}

.scanner-screen .secondary-btn {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 50px;
  border: 1px solid #e0e0e0;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
}

.scanner-screen .secondary-btn:hover {
  background: #f5f5f5;
  color: #333;
}

/* Notification container */
#notification-container {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10000;
}

.scan-notification {
  background: rgba(30, 30, 30, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.scan-notification.fade-out {
  opacity: 0;
}

/* Popups */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 24px;
}

.popup-content {
  background: var(--white);
  padding: 32px 24px;
  border-radius: 24px;
  text-align: center;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: popupIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.popup-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-color);
}

.popup-content p {
  font-size: 16px;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

.user-email {
  color: var(--secondary-color) !important;
  font-weight: 600 !important;
}

.popup-buttons {
  display: flex;
  gap: 12px;
}

.accept-btn,
.decline-btn,
.dismiss-btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.1s;
}

.accept-btn:active,
.decline-btn:active,
.dismiss-btn:active {
  transform: scale(0.96);
}

.accept-btn {
  background: #22c55e;
  color: white;
}

.decline-btn {
  background: #ef4444;
  color: white;
}

.dismiss-btn {
  background: #ef4444;
  color: white;
  width: 100%;
}

/* Specific Popup Styles */
.red-popup .popup-content {
  border-top: 6px solid #ef4444;
}

.green-popup .popup-content {
  border-top: 6px solid #22c55e;
}

.warning-text {
  color: #c2410c !important;
  font-weight: 600 !important;
  background: #fff7ed;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px !important;
  margin-bottom: 16px !important;
}

/* Media Queries */
@media (max-width: 360px) {
  .login-screen .logo {
    font-size: 28px;
  }

  .scanner-screen .scanner-wrap {
    max-width: 260px;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --white: #1e1e1e;
  }

  .login-screen .google-signin-btn {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
  }

  .login-screen .logo {
    color: #f1b310;
  }

  .select-screen .event-select {
    background-color: #2d2d2d;
    border-color: #444;
    color: #fff;
  }

  .scanner-screen .scanner-wrap {
    border-color: #333;
  }



  .scanner-screen .secondary-btn {
    color: #ccc;
    border-color: #444;
  }

  .scanner-screen .secondary-btn:hover {
    background: #333;
    color: #fff;
  }

  .select-screen .logout-btn {
    color: #ccc;
    border-color: #444;
  }

  .select-screen .logout-btn:hover {
    background: #333;
    color: #fff;
  }



  /* Dark mode buttons override */
  .select-screen .continue-btn:not(:disabled),
  .scanner-screen .primary-btn {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(15, 107, 182, 0.3);
  }

  .select-screen .continue-btn:not(:disabled):hover,
  .scanner-screen .primary-btn:hover {
    background-color: #0d5a9a;
  }
}

.scanner-screen .title {
  font-size: 24px;
  font-weight: 500;
  color: #555;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.scanner-screen .scanner-wrap {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 24px;
  border: 4px solid #ccc;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #000;
  flex-shrink: 0;
}

#camera-feed {
  width: 100%;
  height: 100%;
  position: relative;
}

/* HTML5-QR-Code specific styling */
#camera-feed video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 10px !important;
}

/* Ensure QR overlay is properly positioned */
#camera-feed .qr-code-scanner-region {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* Fix the shaded overlay */
#camera-feed .qr-code-scanner-region__video-intersect {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.5) !important;
}

.scanner-wrap.success {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .4);
}

.scanner-screen .camera-frame {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3 / 4;
  margin: 0 auto 32px;
  padding: 10px;
  border-radius: 32px;
  background: #4f83ff;
}

.scanner-screen .camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22px;
  background: #f2f2f2;
}



/* Responsive Design */
@media (max-width: 480px) {
  .login-screen .main-content {
    padding: 40px 30px;
  }

  .login-screen .logo {
    font-size: 46px;
  }

  .login-screen .subtitle {
    font-size: 18px;
  }

  .login-screen .google-signin-btn {
    min-width: 200px;
    font-size: 15px;
    padding: 12px 24px;
  }

  .login-screen .logo-section {
    margin-bottom: 80px;
  }

  .login-screen .login-section {
    margin-bottom: 100px;
  }
}

@media (max-width: 320px) {
  .login-screen .main-content {
    padding: 30px 20px;
  }

  .login-screen .logo {
    font-size: 40px;
  }

  .login-screen .google-signin-btn {
    min-width: 180px;
    font-size: 14px;
  }
}

/* Notification container */
#notification-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 99999;
  pointer-events: none;
}

/* Notification styles */
.scan-notification {
  position: absolute !important;
  top: 20px !important;
  right: 20px !important;
  background: #4CAF50;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: Arial, sans-serif;
  font-size: 14px;
  max-width: 300px;
  word-wrap: break-word;
  opacity: 1;
  transition: opacity 2s ease;
  transform: translateZ(0);
  will-change: opacity;
  pointer-events: auto;
  display: block !important;
  margin: 0 !important;
  float: none !important;
}

.scan-notification.fade-out {
  opacity: 0;
}

/* Popup overlay styles */
.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  border-radius: 10px;
}

.popup-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  max-width: 280px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dismiss-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ef4444;
  color: white;
  margin-top: 16px;
  width: 100%;
}

.dismiss-btn:hover {
  background: #dc2626;
}

.popup-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.popup-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.popup-content p {
  font-size: 16px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.4;
}

.user-email {
  font-weight: 500;
  color: #4f83ff !important;
  margin-bottom: 16px !important;
}

.warning-text {
  color: #7c2d12 !important;
  font-size: 14px !important;
  margin-bottom: 20px !important;
  font-weight: 600 !important;
}

.popup-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.accept-btn,
.decline-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 100px;
}

.accept-btn {
  background: #22c55e;
  color: white;
}

.accept-btn:hover {
  background: #16a34a;
}

.decline-btn {
  background: #ef4444;
  color: white;
}

.decline-btn:hover {
  background: #dc2626;
}

/* Red popup specific styles */
.red-popup .popup-content {
  background: #ef4444;
  color: white;
}

.red-popup .popup-icon {
  color: white;
}

.red-popup .popup-content h3 {
  color: white;
}

.red-popup .popup-content p {
  color: rgba(255, 255, 255, 0.9);
}

.red-popup .dismiss-btn {
  background: white;
  color: #ef4444;
}

.red-popup .dismiss-btn:hover {
  background: #f3f4f6;
}

/* Green popup specific styles */
.green-popup .popup-content {
  background: #22c55e;
  color: white;
}

.green-popup .popup-icon {
  color: white;
}

.green-popup .popup-content h3 {
  color: white;
}

.green-popup .popup-content p {
  color: rgba(255, 255, 255, 0.9);
}

.green-popup .user-email {
  color: white !important;
  font-weight: 600 !important;
}

.green-popup .accept-btn {
  background: white;
  color: #22c55e;
}

.green-popup .accept-btn:hover {
  background: #f3f4f6;
}

.green-popup .decline-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid white;
}

.green-popup .decline-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Permission error message styling */
.permission-error-message {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  padding: 20px;
  background: #fff3cd;
  border-radius: 8px;
  color: #333;
}

.permission-error-message h2 {
  margin-bottom: 12px;
  font-size: 20px;
  color: #856404;
}

.permission-error-message p {
  font-size: 14px;
  color: #856404;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .permission-error-message {
    background: #664d03;
    color: #ffc107;
  }

  .permission-error-message h2,
  .permission-error-message p {
    color: #ffc107;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #fff;
  }

  .login-screen .container {
    background-color: #1a1a1a;
  }

  .login-screen .google-signin-btn {
    background-color: #2d2d2d;
    border-color: #555;
    color: #fff;
  }

  .login-screen .google-signin-btn:hover {
    background-color: #3d3d3d;
  }

  .footer a {
    color: #ccc;
  }

  .footer a:hover {
    color: #4285F4;
  }


}