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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #eee;
  padding-top: 15px;
}

.tab-btn {
  flex: 1;
  padding: 16px;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  position: relative;
  transition: all 0.3s;
}

.tab-btn.active {
  color: #1a73e8;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: #1a73e8;
  border-radius: 2px;
}

.tab-btn:hover {
  color: #1a73e8;
}

.form {
  padding: 20px;
}

.form-row {
  margin-bottom: 18px;
}

.form-row label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

.capacity-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.capacity-btn {
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
}

.capacity-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
}

.capacity-btn.active {
  background: linear-gradient(135deg, #1a73e8 0%, #2962ff 100%);
  border-color: #1a73e8;
  color: #fff;
}

.form-row input, .form-row select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s;
  background: #fafafa;
}

.form-row input:focus, .form-row select:focus {
  outline: none;
  border-color: #1a73e8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-row input::placeholder {
  color: #999;
}

.imei-input-group {
  position: relative;
}

.imei-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.scan-btn, .ocr-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.scan-btn {
  background: linear-gradient(135deg, #1a73e8 0%, #2962ff 100%);
  color: #fff;
}

.scan-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}

.ocr-btn {
  background: linear-gradient(135deg, #34a853 0%, #43b06b 100%);
  color: #fff;
}

.ocr-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 168, 83, 0.4);
}

.scan-btn svg, .ocr-btn svg {
  width: 18px;
  height: 18px;
}

.amount-input-group {
  display: flex;
  align-items: center;
  background: #fafafa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding-left: 16px;
  transition: all 0.3s;
}

.amount-input-group:focus-within {
  border-color: #1a73e8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.currency {
  font-size: 18px;
  font-weight: 600;
  color: #666;
}

.amount-input-group input {
  border: none;
  background: transparent;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
}

.amount-input-group input:focus {
  outline: none;
  box-shadow: none;
}

.exchange-fields {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 2px dashed #ddd;
}

.exchange-header h3 {
  font-size: 16px;
  color: #1a73e8;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exchange-header h3::before {
  content: '';
  width: 4px;
  height: 18px;
  background: #1a73e8;
  border-radius: 2px;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #1a73e8 0%, #2962ff 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(26, 115, 232, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

.result {
  margin: 0 20px 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.result-header h3 {
  font-size: 16px;
  color: #333;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.copy-btn:hover {
  background: #1557b0;
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

.result-content {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  word-break: break-all;
}

.copy-success {
  margin-top: 12px;
  padding: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 18px;
  color: #333;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
}

.close-btn:hover {
  background: #e0e0e0;
  color: #333;
}

.scanner-container, .ocr-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: #000;
}

.scanner-container video, .ocr-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 80px;
  border: 3px solid #1a73e8;
  border-radius: 10px;
  background: rgba(26, 115, 232, 0.1);
  overflow: hidden;
}

.scanner-region {
  width: 100%;
  height: 100%;
}

.scanner-hint-text {
  position: absolute;
  bottom: -30px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #1a73e8, transparent);
  animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
  0% {
    top: 0;
  }
  100% {
    top: 100%;
  }
}

.ocr-frame-large {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 240px;
}

.ocr-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 4px solid #4CAF50;
  border-radius: 6px;
}

.ocr-corner.top-left {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}

.ocr-corner.top-right {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}

.ocr-corner.bottom-left {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}

.ocr-corner.bottom-right {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

.camera-controls, .image-controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  align-items: center;
}

.capture-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4CAF50 0%, #43b06b 100%);
  border: 4px solid #fff;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
  transition: all 0.3s;
}

.capture-btn:hover {
  transform: scale(1.1);
}

.capture-btn:active {
  transform: scale(0.95);
}

.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  background: #f0f0f0;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.action-btn:hover {
  background: #e0e0e0;
}

.action-btn.primary {
  background: linear-gradient(135deg, #4CAF50 0%, #43b06b 100%);
  color: #fff;
}

.action-btn.primary:hover {
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
}

.ocr-guide-text {
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.ocr-result-preview {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.ocr-result-preview input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #4CAF50;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 2px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
}

.cancel-btn, .confirm-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.cancel-btn {
  background: #f0f0f0;
  color: #666;
}

.cancel-btn:hover {
  background: #e0e0e0;
}

.confirm-btn {
  background: linear-gradient(135deg, #4CAF50 0%, #43b06b 100%);
  color: #fff;
}

.confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .container {
    border-radius: 16px;
  }
  
  .header {
    padding: 25px 15px;
  }
  
  .header h1 {
    font-size: 22px;
  }
  
  .form {
    padding: 15px;
  }
  
  .form-row {
    margin-bottom: 15px;
  }
  
  .scanner-frame {
    width: 180px;
    height: 180px;
  }
  
  .ocr-frame {
    width: 250px;
    height: 70px;
  }
}