.ocr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
  min-height: 500px;
}

@media (max-width: 900px) {
  .ocr-layout {
    grid-template-columns: 1fr;
  }
}

.ocr-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.actions-right {
    display: flex;
    gap: 8px;
}

.img-container {
    background: #f7f7fb;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
}

#previewImg {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

.text-area-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#resultText {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #fff;
    color: var(--ink);
}
#resultText:focus {
    outline: none;
    border-color: var(--brand);
}

/* Loader Overlay */
.ocr-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

#progressBarFill {
    height: 100%;
    background: var(--brand);
    transition: width 0.2s;
}

#statusText {
    font-weight: 600;
    color: var(--brand);
    font-size: 14px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: grid;
    place-items: center;
    z-index: 9999;
}
.modal-backdrop.hidden { display: none; }

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    width: min(400px, 90%);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}
.badge-soft {
    display: inline-block;
    padding: 4px 10px;
    background: #eef1ff;
    color: var(--brand);
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}

/* Force utility */
.hidden {
    display: none !important;
}

#resultText {
    color: #222 !important; /* Ensure visibility */
    opacity: 1 !important;
}
