* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.fr-right-col { display: flex; flex-direction: column; gap: 16px; }
.fr-examples-outer { display: none; }
.fr-examples-inner { display: block; }

.fr-input-section,
.fr-output-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.fr-section-title,
.fr-section-title {
  font-size: 1.05rem; font-weight: 700; color: #1e293b;
  margin: 0 0 14px 0; display: flex; align-items: center;
  gap: 8px; cursor: default;
}
label.fr-section-title svg,
.fr-section-title svg { stroke: #6366f1; flex-shrink: 0; }

/* ══════════════════
   FIELD GROUP
══════════════════ */
.fr-field-group { margin-bottom: 14px; }

.fr-label {
  display: block;
  font-size: 0.78rem; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
}
.fr-optional {
  font-size: 0.72rem; font-weight: 400;
  color: #94a3b8; text-transform: none; letter-spacing: 0;
}
.fr-label-row {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 8px;
}
.fr-char-count {
  font-size: 0.78rem; color: #94a3b8;
}

/* ══════════════════
   INPUTS
══════════════════ */
.fr-input {
  width: 100%; padding: 9px 12px;
  background: #ffffff; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 0.9rem; color: #1e293b;
  outline: none; transition: border-color 0.18s, box-shadow 0.18s;
}
.fr-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}
.fr-search-wrap {
  position: relative; display: flex; align-items: center;
}
.fr-search-wrap .fr-input { padding-right: 56px; }
.fr-match-badge {
  position: absolute; right: 10px;
  font-size: 0.75rem; font-weight: 700;
  color: #6366f1; white-space: nowrap;
}

/* ══════════════════
   OPTIONS / CHECKBOXES
══════════════════ */
.fr-options { display: flex; flex-wrap: wrap; gap: 10px; }
.fr-checkbox {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
  color: #475569; user-select: none;
}
.fr-checkbox input { display: none; }
.fr-checkmark {
  width: 18px; height: 18px;
  border: 2px solid #e2e8f0; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s; flex-shrink: 0; background: #fff;
}
.fr-checkbox input:checked + .fr-checkmark {
  background: #6366f1; border-color: #6366f1;
}
.fr-checkbox input:checked + .fr-checkmark::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

/* ══════════════════
   TEXTAREA
══════════════════ */
.fr-textarea-wrap { position: relative; }
.fr-textarea {
  width: 100%; resize: vertical; padding: 12px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 0.92rem; outline: none;
  font-family: 'Courier New', monospace; color: #1e293b;
  background: #ffffff; line-height: 1.7;
  transition: border-color 0.18s; min-height: 140px;
}
.fr-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}
.fr-clear-btn {
  position: absolute; top: 10px; right: 10px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 7px; padding: 4px 12px;
  font-size: 0.78rem; font-weight: 600; color: #64748b;
  cursor: pointer; transition: background 0.15s;
}
.fr-clear-btn:hover { background: #e2e8f0; color: #ef4444; }

/* ══════════════════
   CONVERT BTN
══════════════════ */
.fr-convert-btn {
  width: 100%; background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border: none; border-radius: 11px; padding: 13px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 8px; transition: opacity 0.18s, transform 0.15s; margin-top: auto;
}
.fr-convert-btn:hover { opacity: 0.88; transform: scale(1.02); }
.fr-convert-btn:active { transform: scale(0.98); }

/* ══════════════════
   OUTPUT SECTION
══════════════════ */
.fr-output-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.fr-copy-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border: none; border-radius: 8px;
  padding: 7px 18px; font-size: 0.84rem; font-weight: 700;
  cursor: pointer; transition: opacity 0.18s;
}
.fr-copy-btn:hover { opacity: 0.85; }
.fr-copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

.fr-result-placeholder {
  background: linear-gradient(135deg, #f8f9ff, #ede9fe22);
  border: 2px dashed #c7d2fe; border-radius: 12px;
  padding: 28px 20px; text-align: center;
  color: #cbd5e1; font-size: 0.92rem; font-weight: 500;
  margin-bottom: 14px;
}

.fr-output-textarea {
  width: 100%; min-height: 140px; resize: none;
  padding: 12px 14px; border: 1.5px solid #e2e8f0;
  border-radius: 10px; font-size: 0.95rem;
  font-family: 'Courier New', monospace; color: #1e293b;
  background: #f8faff; outline: none; line-height: 1.8;
  word-break: break-word; margin-bottom: 14px;
}

/* Stats */
.fr-stats-row {
  display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px;
}
.fr-stat-chip {
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 20px; padding: 5px 13px;
  font-size: 0.76rem; font-weight: 600; color: #475569;
}

/* Highlight Preview */
.fr-map-label {
  font-size: 0.78rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
}
.fr-highlight-area {
  padding: 14px;
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: #1e293b;
}
.fr-highlight-area mark {
  background: #ffe066;
  color: #1e293b;
  border-radius: 3px;
  padding: 1px 2px;
}

/* ══════════════════
   EXAMPLES
══════════════════ */
.fr-examples-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fr-example-btn {
  background: #f8f9ff; border: 1.5px solid #e2e8f0;
  border-radius: 20px; padding: 6px 16px;
  font-size: 0.82rem; font-weight: 600; color: #4338ca;
  cursor: pointer; transition: all 0.15s;
}
.fr-example-btn:hover {
  background: #ede9fe; border-color: #a5b4fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .fr-input-section,
body.dark-mode .fr-output-section { background: #0f172a; border-color: #1e293b; }
body.dark-mode label.fr-section-title,
body.dark-mode .fr-section-title { color: #e2e8f0; }
body.dark-mode label.fr-section-title svg,
body.dark-mode .fr-section-title svg { stroke: #a5b4fc; }
body.dark-mode .fr-label { color: #475569; }
body.dark-mode .fr-input {
  background: #1e293b; border-color: #334155; color: #e2e8f0;
}
body.dark-mode .fr-input:focus { border-color: #818cf8; }
body.dark-mode .fr-checkbox { color: #94a3b8; }
body.dark-mode .fr-checkmark { background: #1e293b; border-color: #334155; }
body.dark-mode .fr-checkbox input:checked + .fr-checkmark {
  background: #6366f1; border-color: #6366f1;
}
body.dark-mode .fr-textarea {
  background: #1e293b; border-color: #334155; color: #e2e8f0;
}
body.dark-mode .fr-textarea:focus { border-color: #818cf8; }
body.dark-mode .fr-clear-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark-mode .fr-result-placeholder { background: #1e1b4b; border-color: #312e81; color: #475569; }
body.dark-mode .fr-output-textarea { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .fr-stat-chip { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark-mode .fr-highlight-area { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .fr-highlight-area mark { background: #854d0e; color: #fef3c7; }
body.dark-mode .fr-char-count { color: #475569; }
body.dark-mode .fr-example-btn { background: #1e1b4b; border-color: #312e81; color: #a5b4fc; }
body.dark-mode .fr-example-btn:hover { background: #2e1b6b; border-color: #6366f1; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 768px) {
  #main-section { grid-template-columns: 1fr; }
  .fr-examples-inner { display: none !important; }
  .fr-examples-outer { display: block; }
  .fr-options { gap: 8px; }
}