/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f4f7fb;
  color: #222;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.header {
  background: linear-gradient(90deg, #0d47a1, #1565c0);
  color: #fff;
  padding: 1rem 0;
  box-shadow: 0 5px 16px rgb(0 0 0 / 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  user-select: none;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-weight: 900;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
  user-select: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.8rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: #f1f1f1;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  position: relative;
  padding-bottom: 3px;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: "";
  display: block;
  height: 3px;
  width: 0;
  background: #ffca28;
  transition: width 0.3s ease;
  position: absolute;
  bottom: 0;
  left: 0;
  border-radius: 2px;
}

.nav-links a:hover,
.nav-links a:focus {
  color: #ffca28;
}

.nav-links a:hover::after,
.nav-links a:focus::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  font-size: 2.2rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  user-select: none;
}

/* Main */
.main-content {
  flex-grow: 1;
  padding: 3.5rem 0 5rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* OCR Section */
.ocr-section {
  background: #fff;
  border-radius: 14px;
  padding: 2.8rem 2.2rem;
  box-shadow: 0 6px 22px rgb(0 0 0 / 0.08);
  text-align: center;
  user-select: none;
  transition: box-shadow 0.3s ease;
  scroll-margin-top: 90px;
}

.ocr-section:hover {
  box-shadow: 0 9px 28px rgb(0 0 0 / 0.12);
}

.title {
  font-weight: 800;
  font-size: 2.4rem;
  margin-bottom: 0.4rem;
  color: #0d47a1;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 1.2rem;
  color: #444;
  margin-bottom: 2rem;
  font-weight: 500;
}

/* Upload */
.upload-wrapper {
  margin-bottom: 1.8rem;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  background: #e9f1ff;
  border: 2px dashed #64a0f0;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1565c0;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  user-select: none;
  outline-offset: 3px;
  box-shadow: 0 0 0 0 transparent;
}

.upload-label:hover,
.upload-label:focus-visible {
  background: #d6e7ff;
  border-color: #1976d2;
  box-shadow: 0 0 8px rgba(25, 118, 210, 0.45);
  outline: none;
}

.upload-label input[type="file"] {
  display: none;
}

.upload-icon {
  width: 24px;
  height: 24px;
  stroke: #1565c0;
  flex-shrink: 0;
}

/* Progress bar */
progress {
  width: 100%;
  height: 17px;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  appearance: none;
  overflow: hidden;
  background-color: #dedede;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.12);
  transition: background-color 0.3s ease;
}

progress::-webkit-progress-bar {
  background-color: #dedede;
  border-radius: 12px;
}

progress::-webkit-progress-value {
  background-color: #1976d2;
  border-radius: 12px;
  transition: width 0.25s ease;
  box-shadow: 0 2px 6px rgba(25, 118, 210, 0.6);
}

progress::-moz-progress-bar {
  background-color: #1976d2;
  border-radius: 12px;
  transition: width 0.25s ease;
  box-shadow: 0 2px 6px rgba(25, 118, 210, 0.6);
}

/* Result textarea */
#result-text {
  width: 100%;
  resize: vertical;
  min-height: 170px;
  padding: 1.15rem 1.2rem;
  border-radius: 12px;
  border: 1.6px solid #bbb;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  background-color: #fafafa;
  color: #222;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.05);
}

#result-text:focus {
  outline: none;
  border-color: #1565c0;
  background-color: #fff;
  box-shadow: 0 0 9px rgba(21, 101, 192, 0.45);
}

/* Buttons */
.button-group {
  margin-top: 1.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center;
}

button {
  cursor: pointer;
  border: none;
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
  border-radius: 10px;
  font-weight: 700;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  min-width: 140px;
  box-shadow: 0 5px 14px rgba(25, 118, 210, 0.4);
  color: #fff;
}

.btn-primary {
  background-color: #1976d2;
  box-shadow: 0 7px 18px rgba(25, 118, 210, 0.5);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus:not(:disabled) {
  background-color: #0d47a1;
  box-shadow: 0 9px 24px rgba(13, 71, 161, 0.65);
  outline: none;
}

.btn-secondary {
  background-color: #64a0f0;
  color: #0d47a1;
  box-shadow: 0 6px 16px rgba(100, 160, 240, 0.5);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:focus:not(:disabled) {
  background-color: #4285f4;
  box-shadow: 0 10px 28px rgba(66, 133, 244, 0.7);
  outline: none;
  color: #fff;
}

.btn-clear {
  background-color: #f1f1f1;
  color: #555;
  box-shadow: none;
  border: 1.5px solid #ccc;
  transition: background-color 0.25s ease, border-color 0.3s ease;
}

.btn-clear:hover,
.btn-clear:focus {
  background-color: #dcdcdc;
  border-color: #999;
  outline: none;
  color: #333;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Info sections */
.info-section {
  background: #fff;
  padding: 2.3rem 1.8rem;
  margin-bottom: 2.3rem;
  border-radius: 14px;
  box-shadow: 0 7px 22px rgb(0 0 0 / 0.08);
  color: #333;
  user-select: text;
  transition: box-shadow 0.3s ease;
  scroll-margin-top: 90px;
}

.info-section:hover {
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}

.info-section h2 {
  font-weight: 800;
  margin-bottom: 1.15rem;
  color: #0d47a1;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

.info-section a {
  color: #1976d2;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.3s ease;
}

.info-section a:hover,
.info-section a:focus {
  color: #0d47a1;
  text-decoration: underline;
}

/* Footer */
.footer {
  background: linear-gradient(90deg, #0d47a1, #1565c0);
  color: #fff;
  padding: 1.2rem 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 -4px 14px rgb(0 0 0 / 0.08);
  user-select: none;
  margin-top: auto;
}

.footer p {
  margin: 0;
}
