﻿/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #f4f7fb 0%, #ffffff 100%);
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1f2937;
  line-height: 1.45;
  font-size: 15px;
  text-align: start;
}
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
img { border: 0; max-width: 100%; height: auto; vertical-align: middle; }
button { font-family: inherit; }
.clear { clear: both; }
.b { font-weight: 700; }

/* Wrapper */
#wrapper {
  width: min(1120px, calc(100% - 24px));
  margin: 16px auto;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  background: #fff;
}

/* Header */
#header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 18px;
  background: #ffffff;
}
#header img {
  width: min(240px, 58vw);
  height: auto;
}

/* Menu */
#menu {
  background: #3e7bfa;
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#menu #infoBar {
  margin: 0;
  text-align: start;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  flex: 1 1 auto;
  min-width: 0;
}
.menu-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  flex: 0 0 auto;
}
#menu select {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 6px 8px;
  background: #ffffff;
  color: #1f2937;
  min-width: 140px;
  max-width: 200px;
  height: 32px;
}

/* Body */
#bodyDiv { padding: 14px 18px; }
#col_left { width: 100%; }

/* Language selector row */
#langSelectDiv {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  margin: 4px 0 10px;
  align-items: center;
}
#langSelectDiv select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  height: 36px;
  background: #fff;
}
.swap-button {
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  width: 38px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

/* Translation cards */
#transBox {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
#fromTransBox,
#toTransBox {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #d4ddec;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}
#transBox textarea {
  width: 100%;
  min-height: 300px;
  border: none;
  padding: 6px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  background: transparent;
  resize: vertical;
  outline: none;
}

/* Card bottom rows */
#transBoxBottom,
#toTransBoxBottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  color: #475569;
}
#toTransBoxBottom { justify-content: flex-end; }

.inline-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e3a8a;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}
.inline-action img { width: 14px; height: 14px; }
.inline-action:hover { background: #eef2f7; }
.inline-action:disabled { opacity: 0.6; cursor: not-allowed; }

.status-message {
  min-height: 20px;
  margin-top: 10px;
  color: #065f46;
  font-size: 14px;
  text-align: center;
}
.status-message.error { color: #b91c1c; }

/* Footer */
#footer {
  border-top: 1px solid #e2e8f0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  row-gap: 8px;
  padding: 10px 14px;
}
#flags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  gap: 6px;
  padding: 4px 0;
}
#flags img {
  width: 18px;
  height: 12px;
  flex: 0 1 auto;
  min-width: 0;
  border: 1px solid #cbd5e1;
}
#footerEmail { text-align: start; font-size: 14px; }
#footerEmail a { color: #1d4ed8; }
#footerTagline {
  text-align: center;
  font-size: 14px;
  color: #0f766e;
  font-weight: 600;
}
#footerYearText {
  text-align: end;
  font-size: 14px;
  color: #475569;
}

/* RTL adjustments */
html[dir="rtl"] body {
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
}
html[dir="rtl"] #fromText,
html[dir="rtl"] #toText {
  text-align: start;
}
html[dir="rtl"] .swap-button {
  transform: scaleX(-1);
}
html[dir="rtl"] #flags { direction: ltr; }

/* Responsive */
@media (max-width: 900px) {
  #wrapper {
    width: calc(100% - 10px);
    margin: 8px auto;
    border-radius: 12px;
  }
  #menu {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #menu #infoBar {
    font-size: 14px;
    text-align: center;
    line-height: 1.35;
  }
  .menu-row {
    justify-content: center;
    font-size: 12px;
  }
  #menu select { min-width: 120px; max-width: 200px; height: 30px; }
  #bodyDiv { padding: 12px 10px; }
  #langSelectDiv { grid-template-columns: 1fr; }
  .swap-button { width: 100%; }
  #transBox { grid-template-columns: 1fr; }
  #transBox textarea { min-height: 220px; }
  #footer { grid-template-columns: 1fr; }
  #footerEmail, #footerTagline, #footerYearText { text-align: start; }
  #flags {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  #flags img { width: 16px; height: 11px; }
}
