/**
 * Business Card Scanner Styles
 * ============================
 */

/* ========== Base Styles ========== */
* {
  box-sizing: border-box;
}

table, td, div, h1, h2, p, button, input, textarea, select {
  font-family: "Microsoft JhengHei", Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: #e3e3e3;
}

/* ========== Material Icons ========== */
.material-icons {
  font-size: 20px;
  vertical-align: sub;
  margin-right: 4px;
}

.btn .material-icons {
  font-size: 28px;
  vertical-align:  middle;
  margin-right: 0;
}

.form-title .material-icons {
  font-size: 28px;
  vertical-align:  middle;
  color: #0066cc;
}

/* ========== Layout ========== */
.container {
  width: 94%;
  max-width: 600px;
  margin: 0 auto;
  background-color: #ffffff;
}

/* ========== Header ========== */
.header {
  padding: 20px;
  text-align: center;
  background-color: #ffffff;
  border-bottom: 2px solid #f0f0f0;
}

.header img {
  width: 200px;
  max-width: 80%;
  height: auto;
}

.header h1 {
  margin: 10px 0 0 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: bold;
  color: #363636;
}

/* ========== Content ========== */
.content {
  padding: 20px;
}

/* ========== Footer ========== */
.footer {
  padding: 20px;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  background-color: #404040;
  color: #cccccc;
}

.footer p {
  margin: 0;
}

/* ========== Language Selector ========== */
.language-selector {
  margin-top: 30px;
  padding-top: 15px;
  border-top:  1px solid #f0f0f0;
  text-align: center;
}

.language-selector select {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid #0066cc;
  border-radius: 6px;
  background-color:  #ffffff;
  color: #0066cc;
  cursor: pointer;
  min-width: 150px;
  font-family: "Microsoft JhengHei", Arial, sans-serif;
}

.language-selector select:hover {
  background-color: #f0f7ff;
}

.language-selector select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

/* ========== Preview Box ========== */
.preview-box {
  width: 100%;
  min-height: 250px;
  border: 2px dashed #cccccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f9f9f9;
  margin-bottom: 15px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  padding: 10px;
}

.preview-box:hover {
  border-color:  #0066cc;
  background-color: #f0f7ff;
}

#imageWrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

#previewImage {
  display: block;
  max-width: 100%;
  height: auto;
}

.preview-placeholder {
  text-align: center;
  color: #999999;
  padding: 50px 0;
}

.preview-placeholder .material-icons {
  font-size: 64px;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  opacity: 0.5;
  color: #0066cc;
}

/* ========== OCR Overlay ========== */
.ocr-box {
  position: absolute;
  border: 2px solid rgba(0, 102, 204, 0.6);
  background-color: rgba(0, 102, 204, 0.1);
  cursor: help;
  z-index: 10;
  transition: all 0.2s;
}

.ocr-box:hover {
  border-color: #ff0000;
  background-color:  rgba(255, 0, 0, 0.1);
  z-index: 20;
}

/* Tooltip on hover */
.ocr-box::after {
  content: attr(data-text);
  position: absolute;
  bottom: 100%;
  left: 0;
  background:  rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition:  opacity 0.2s;
  margin-bottom: 4px;
}

.ocr-box:hover::after {
  opacity: 1;
}

/* ========== Buttons ========== */
.button-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn {
  flex: 1;
  padding:  14px 20px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: scale(0.98);
}

/* Button Variants */
.btn-primary {
  background-color: #0066cc;
  color: white;
}

.btn-primary:hover {
  background-color:  #0052a3;
}

.btn-primary:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #6c757d;
  color:  white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
}

/* Button Sizes */
.btn-large {
  width: 100%;
  padding:  16px;
  font-size: 20px;
}

.btn-xl {
  width: 100%;
  padding: 32px 20px;
  font-size: 28px;
  min-height: 80px;
}

/* ========== Form ========== */
.form-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.form-title {
  font-size: 20px;
  font-weight:  bold;
  color: #363636;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size:  14px;
  font-weight: bold;
  color: #555555;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #cccccc;
  border-radius: 6px;
  font-family: "Microsoft JhengHei", Arial, sans-serif;
}

.form-input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* ========== Alerts & Loading ========== */
.loading {
  display: none;
  text-align: center;
  padding: 15px;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius:  6px;
  margin-bottom: 15px;
  color: #856404;
}

.loading.show {
  display: block;
}

. alert {
  display: none;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
}

.alert . material-icons {
  margin-right: 8px;
  font-size: 20px;
  vertical-align: text-bottom;
}

.alert.show {
  display: block;
}

.alert-success {
  background-color:  #d4edda;
  border: 1px solid #c3e6cb;
  color:  #155724;
}

. alert-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

/* ========== Utilities ========== */
input[type="file"] {
  display: none;
}

/* ========== Responsive ========== */
@media screen and (max-width: 480px) {
  .header h1 {
    font-size: 18px;
  }
  
  .btn-xl {
    font-size: 20px;
    padding: 24px 16px;
  }
}