/* Global resets & shared styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  min-height: 100vh;
  background-color: #fafafa;
  color: #333;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  margin: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Shared highlight and footer styles */
.highlight {
  color: #4f83ff; /* unified color */
  font-weight: 500;
}

.footer {
  font-size: 14px;
  color: #777;
  text-align: center;
  padding: 12px 0;
  flex-shrink: 0;
}

.footer a {
  color: #777;
  text-decoration: underline;
  margin-bottom: 6px;
  display: block;
}

/* Login Screen */
.login-screen .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.login-screen .logo-section {
  text-align: center;
  margin-bottom: 100px;
}

.login-screen .logo {
  font-size: 52px;
  font-weight: 400;
  color: #4285F4;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.login-screen .subtitle {
  font-size: 20px;
  color: #666;
  font-weight: 400;
}

.login-screen .login-section {
  margin-bottom: 140px;
}

.login-screen .google-signin-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: white;
  border: 1px solid #dadce0;
  border-radius: 24px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 220px;
  justify-content: center;
}

.login-screen .google-signin-btn:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-color: #c6c6c6;
  transform: translateY(-1px);
}

.login-screen .google-signin-btn:active {
  transform: translateY(0);
}

/* Select Screen */
.select-screen .card {
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.select-screen .title {
  font-size: 28px;
  font-weight: 500;
  color: #555;
  margin-bottom: 40px;
}

.select-screen .select-wrapper {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 10px;
}

.select-screen .event-select {
  width: 100%;
  padding: 12px 44px 12px 16px;
  font-size: 18px;
  border: 2px solid #777;
  border-radius: 8px;
  background: #fff;
  appearance: none;
  cursor: pointer;
}

.select-screen .event-select:focus {
  outline: none;
  border-color: #4f83ff;
}

.select-screen .dropdown-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 18px;
  color: #555;
}

.select-screen .continue-btn {
  width: 100%;
  max-width: 260px;
  padding: 12px;
  font-size: 18px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: #4f83ff;
  color: #fff;
  cursor: pointer;
  margin: 0 auto 40px;
  display: block;
}

.select-screen .continue-btn:hover {
  background: #3f6ee8;
}

.select-screen .continue-btn:disabled,
.select-screen .continue-btn:disabled:hover {
  background: #cccccc !important;
  color: #888888 !important;
  cursor: not-allowed !important;
}

.select-screen .logout-btn {
  width: 100%;
  max-width: 260px;
  padding: 12px;
  font-size: 18px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: #e0e0e0;
  color: #333;
  cursor: pointer;
  margin: 0 auto 80px;
  display: block;
}

.select-screen .logout-btn:hover {
  background: #d0d0d0;
}

/* Scanner Screen */
.scanner-screen .card {
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.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;
}

.scanner-screen .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.scanner-screen .secondary-btn {
  width: 100%;
  max-width: 260px;
  padding: 12px;
  font-size: 18px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: #f0f0f0;
  color: #555;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

.scanner-screen .secondary-btn:hover {
  background: #e4e4e4;
}

.scanner-screen .primary-btn {
  width: 100%;
  max-width: 260px;
  padding: 12px;
  font-size: 18px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: #4f83ff;
  color: #fff;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

.scanner-screen .primary-btn:hover {
  background: #3f6ee8;
}

/* 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);
}

/* 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;
  }

  .popup-content {
    background: #2d2d2d;
    color: #fff;
  }

  .popup-content h3 {
    color: #fff;
  }

  .popup-content p {
    color: #ccc;
  }

  .red-popup .popup-content {
    background: #ef4444;
    color: white;
  }

  .red-popup .popup-content h3,
  .red-popup .popup-content p {
    color: white;
  }

  .green-popup .popup-content {
    background: #22c55e;
    color: white;
  }

  .green-popup .popup-content h3,
  .green-popup .popup-content p {
    color: white;
  }
}
