* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 2px solid #333;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2rem;
  color: #fff;
}

#status-bar {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #888;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

h2 {
  font-size: 1.5rem;
  margin-bottom: 25px;
  color: #fff;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #ccc;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.button-grid button {
  padding: 15px 20px;
  font-size: 1rem;
  border: 2px solid #444;
  background: #2a2a4a;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.button-grid button:hover {
  background: #3a3a6a;
  border-color: #666;
}

.button-grid button.selected {
  background: #4a6cf7;
  border-color: #4a6cf7;
}

.input-large {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  border: 2px solid #444;
  background: #2a2a4a;
  color: #fff;
  border-radius: 8px;
}

.input-large:focus {
  outline: none;
  border-color: #4a6cf7;
}

.btn-primary {
  background: #4a6cf7;
  color: #fff;
  border: none;
  padding: 15px 40px;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: #3a5ce7;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-large {
  padding: 18px 50px;
  font-size: 1.2rem;
}

.btn-secondary {
  background: #444;
  color: #fff;
  border: none;
  padding: 15px 40px;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #555;
}

.btn-danger {
  background: #e74c3c;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.button-row {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 30px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.action-btn {
  padding: 40px 20px;
  font-size: 1.2rem;
  border: 3px solid #444;
  background: #2a2a4a;
  color: #fff;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.action-icon {
  font-size: 3rem;
}

.action-sell {
  border-color: #27ae60;
}

.action-sell:hover {
  background: #27ae60;
}

.action-sell-pass {
  border-color: #9b59b6;
}

.action-sell-pass:hover {
  background: #9b59b6;
}

.action-pass {
  border-color: #3498db;
}

.action-pass:hover {
  background: #3498db;
}

.action-close {
  border-color: #e74c3c;
}

.action-close:hover {
  background: #e74c3c;
}

.search-results {
  background: #2a2a4a;
  border-radius: 8px;
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.search-results button {
  width: 100%;
  padding: 12px 15px;
  text-align: left;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-bottom: 1px solid #444;
}

.search-results button:hover {
  background: #3a3a6a;
}

.search-results button:last-child {
  border-bottom: none;
}

.selected-item {
  background: #4a6cf7;
  padding: 12px 15px;
  border-radius: 8px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selected-item button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.pass-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.pass-remaining {
  font-size: 0.9rem;
  color: #27ae60;
  margin-top: 4px;
}

.pass-expiry {
  font-size: 0.85rem;
  color: #888;
  margin-top: 2px;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  background: #e74c3c;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: #27ae60;
}

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

@media (max-width: 600px) {
  .action-grid {
    grid-template-columns: 1fr;
  }
  
  .button-row {
    flex-direction: column;
  }
  
  .btn-secondary, .btn-primary {
    width: 100%;
  }
}

.qr-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.qr-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-scanner-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 280px;
  border: 4px solid #60a5fa;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.6);
  pointer-events: none;
}

.qr-instructions {
  position: absolute;
  bottom: 120px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 20px;
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.qr-cancel-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  color: white;
  border: 2px solid white;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.qr-cancel-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

.pin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.pin-modal.hidden {
  display: none;
}

.pin-modal-content {
  background: #1a1d2e;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
}

.pin-modal-content h2 {
  color: white;
  text-align: center;
  margin-bottom: 24px;
  font-size: 20px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #4a5568;
  background: transparent;
  transition: background 0.2s;
}

.pin-dot.filled {
  background: #3b82f6;
  border-color: #3b82f6;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.pin-key {
  padding: 24px;
  font-size: 28px;
  font-weight: 600;
  background: #2d3748;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.pin-key:active {
  background: #3b82f6;
  transform: scale(0.95);
}

.pin-clear {
  font-size: 16px;
}

.pin-backspace {
  font-size: 24px;
}

.pin-cancel-btn {
  width: 100%;
  padding: 16px;
  background: transparent;
  border: 2px solid #ef4444;
  color: #ef4444;
  font-size: 18px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
}

.pin-cancel-btn:hover {
  background: #ef4444;
  color: white;
}

.form-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.form-section h3 {
  color: #9ca3af;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}
