/* Driver License Scanner Styles */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* License Setup Styles */
.license-setup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.license-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 2rem;
  width: min(90vw, 500px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.license-container h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  text-align: center;
}

.license-container>p {
  color: #666;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.license-input-group {
  margin-bottom: 1.5rem;
}

.license-input-group label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.license-input-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s ease;
}

.license-input-group textarea:focus {
  outline: none;
  border-color: #fe8e14;
  box-shadow: 0 0 0 3px rgba(254, 142, 20, 0.1);
}

.license-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.license-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.license-btn.primary {
  background: linear-gradient(135deg, #fe8e14 0%, #ff6b35 100%);
  color: white;
}

.license-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(254, 142, 20, 0.3);
}

.license-btn.secondary {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #e1e5e9;
}

.license-btn.secondary:hover {
  background: #e9ecef;
}

.license-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.license-info {
  padding: 1rem;
  background: rgba(254, 142, 20, 0.1);
  border-radius: 8px;
  border-left: 4px solid #fe8e14;
}

.license-info p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: #555;
}

.license-info a {
  color: #fe8e14;
  text-decoration: none;
  font-weight: 600;
}

.license-info a:hover {
  text-decoration: underline;
}

/* Scanner App Styles */
.scanner-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.scanner-app.hidden {
  display: none;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 600;
  color: white;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

a {
  color: #fe8e14;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #fe8e14d1;
  text-decoration: underline;
}

/* Mode Switch Toggle */
.mode-switch {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 4px;
  margin-bottom: 2rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.mode-options {
  display: flex;
  position: relative;
  z-index: 2;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 46px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.9rem;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

.mode-option:hover {
  color: rgba(255, 255, 255, 0.9);
}

.mode-option.active {
  color: white;
  font-weight: 600;
}

.mode-icon {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
  transition: all 0.3s ease;
}

.mode-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: linear-gradient(135deg, #fe8e14 0%, #ff6b35 100%);
  border-radius: 42px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(254, 142, 20, 0.3);
}

/* Add subtle pulse animation for better UX */
.mode-option:active {
  transform: scale(0.98);
}

.mode-switch:hover .mode-slider {
  box-shadow: 0 6px 20px rgba(254, 142, 20, 0.4);
}

.mode-switch[data-active="image"] .mode-slider {
  transform: translateX(100%);
}

.mode-switch[data-active="image"] .mode-option[data-mode="image"] {
  color: white;
  font-weight: 600;
}

.mode-switch[data-active="image"] .mode-option[data-mode="camera"] {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Tip message */
#tip-message {
  position: absolute;
  top: 2vh;
  font-size: 1rem;
  color: white;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 5;
}

/* Main container */
#main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(90vw, 600px);
  height: 60vh;
  position: relative;
}

/* Camera start button */
#camera-start-btn {
  width: 120px;
  height: 120px;
  fill: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

#camera-start-btn:hover {
  fill: white;
  transform: scale(1.1);
}

/* Camera view */
#camera-view {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Results container */
.results-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 700px);
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 100;
  overflow: hidden;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #333;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

.results-body {
  max-height: calc(80vh - 60px);
  overflow-y: auto;
  padding: 1.5rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #fe8e14;
}

.result-item label {
  font-weight: 600;
  color: #555;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.result-item span {
  color: #333;
  font-weight: 500;
}

/* Close buttons */
.close-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  background: rgba(0, 0, 0, 0.1);
}

.results-header .close-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Responsive design */
@media only screen and (max-width: 768px) {
  .license-container {
    padding: 1.5rem;
    width: 95vw;
  }

  .license-container h2 {
    font-size: 1.25rem;
  }

  .license-actions {
    flex-direction: column;
  }

  .license-btn {
    margin-bottom: 0.5rem;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .mode-switch {
    margin-bottom: 1.5rem;
    scale: 0.9;
  }

  .mode-option {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    gap: 0.4rem;
  }

  .mode-icon {
    width: 18px;
    height: 18px;
  }

  #tip-message {
    top: 1vh;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }

  #main-container {
    width: 95vw;
    height: 50vh;
  }

  #camera-start-btn {
    width: 100px;
    height: 100px;
  }

  .results-container {
    width: 95vw;
    max-height: 85vh;
  }

  .results-header {
    padding: 0.75rem 1rem;
    font-size: 14px;
  }

  .results-body {
    padding: 1rem;
    max-height: calc(85vh - 50px);
  }
}

@media only screen and (max-width: 480px) {
  .license-container {
    padding: 1rem;
    border-radius: 12px;
  }

  .license-container h2 {
    font-size: 1.1rem;
  }

  .license-input-group textarea {
    font-size: 0.8rem;
  }

  .license-btn {
    padding: 0.6rem;
    font-size: 0.85rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  .mode-switch {
    scale: 0.85;
    margin-bottom: 1rem;
  }

  .mode-option {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  #tip-message {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }

  .result-item {
    padding: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .result-item label {
    font-size: 0.85rem;
  }
}

/* Smooth transitions */
#main-container,
#camera-view,
.results-container {
  transition: all 0.3s ease;
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}