:root {
  color-scheme: light;
  --ink: #2b1757;
  --muted: #675b80;
  --line: #ded7ee;
  --surface: #ffffff;
  --background: #f8f8fc;
  --purple: #a12cf0;
  --blue: #2c63ff;
  --cyan: #08d5e6;
  --error: #b4233c;
}

body.dark {
  color-scheme: dark;
  --ink: #f7f7fb;
  --muted: #a8a9b6;
  --line: #292938;
  --surface: #11111a;
  --background: #050509;
  --error: #ff7e88;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

body::before {
  display: none;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 34px;
  overflow: visible;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
  border-bottom: 1px solid var(--line);
}

.header-wordmark {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.header-wordmark img {
  display: block;
  width: 300px;
  height: auto;
}

.header-actions {
  display: grid;
  grid-template-columns: 78px 235px;
  align-items: center;
  gap: 12px;
}

.header-actions > * {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.header-actions .theme-toggle { min-height: 40px; }

@media (max-width: 1300px) {
  .site-header {
    height: auto;
    min-height: 78px;
    flex-wrap: wrap;
    row-gap: 14px;
    padding-bottom: 14px;
  }
  .header-wordmark { top: 14px; bottom: auto; }
  .header-actions {
    flex-basis: 100%;
    justify-content: end;
  }
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
}

.brand-logo-frame {
  width: 92px;
  height: 76px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.logout-link {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
}

.logout-link:hover { color: var(--ink); }

.theme-toggle {
  width: auto;
  margin: 0;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
}

.theme-toggle:hover { color: var(--ink); filter: none; }

.language-toggle[aria-pressed="true"] { color: var(--ink); }

.workspace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto auto auto;
  align-items: center;
  gap: 28px;
  min-height: calc(100vh - 86px);
  padding-top: 14px;
  max-width: none;
  margin: 0 auto;
  overflow: visible;
}


.workspace-intro {
  grid-column: 1 / -1;
  padding: 4px 0 18px;
  text-align: center;
}

.workspace > .input-card,
.workspace > .detection-card,
.workspace > .output-card {
  grid-row: 2;
  min-height: 0;
  height: min(500px, 100%);
  transition: opacity 0.45s ease, transform 0.55s ease, visibility 0.45s ease;
}

.workspace > .input-card {
  grid-column: 1 / -1;
  height: min(610px, 100%);
  width: min(560px, calc(100% - 24px));
  margin-inline: auto;
  position: relative;
  left: 0;
  transform: translateY(-36px);
}

.workspace > .detection-card,
.workspace > .output-card {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.workspace.has-results > .input-card {
  grid-column: 1;
  width: 100%;
  margin-inline: 0;
  left: 0;
  transform: translate(0, -36px);
}

.workspace.has-results > .detection-card,
.workspace.has-results > .output-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-36px);
  visibility: visible;
}

.workspace.has-results > .input-card,
.workspace.has-results > .detection-card,
.workspace.has-results > .output-card {
  height: 100%;
  min-height: 0;
  align-self: stretch;
}

.workspace.has-results {
  grid-template-rows: auto 500px auto auto;
}

.workspace.has-detection-only {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
}

.workspace.has-detection-only > .input-card {
  grid-column: 1;
  width: 100%;
  margin-inline: 0;
  left: 0;
  transform: translateY(-36px);
}

.workspace.has-detection-only > .detection-card {
  grid-column: 2;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-36px);
  visibility: visible;
}

.eyebrow,
.card-label {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.card-label { color: var(--purple); margin-bottom: 18px; }
.card-label span { color: var(--muted); margin-left: 8px; }

h1, h2 { margin: 0; letter-spacing: -0.045em; }
h1 { font-size: clamp(2.1rem, 3.1vw, 3rem); line-height: 1; }
.workspace-intro h1 {
  font-size: clamp(1.35rem, 1.9vw, 1.9rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.12;
}
h1 span {
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }

.intro {
  max-width: 620px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.55;
}

.input-card,
.detection-card,
.output-card {
  min-width: 0;
  min-height: 420px;
  padding: clamp(28px, 3vw, 36px);
  padding-bottom: 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.input-card,
.detection-card,
.output-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

.detection-card {
  background: linear-gradient(150deg, rgba(255, 251, 255, 0.98), rgba(247, 247, 255, 0.98));
}

.output-card {
  background: linear-gradient(150deg, rgba(250, 247, 255, 0.98), rgba(241, 249, 255, 0.98));
}

body.dark .input-card { background: rgba(17, 17, 26, 0.92); }
body.dark .detection-card { background: linear-gradient(150deg, rgba(31, 22, 55, 0.95), rgba(20, 22, 40, 0.96)); }
body.dark .output-card { background: linear-gradient(150deg, rgba(31, 22, 55, 0.95), rgba(11, 18, 35, 0.96)); }

.input-options {
  display: grid;
  grid-template-columns: minmax(0, 165fr) minmax(0, 205fr);
  width: min(100%, 380px);
  gap: 10px;
  margin: 26px 0;
}

.option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  min-width: 0;
  height: 46px;
  justify-content: center;
  line-height: 1.25;
}

.option span[data-i18n] {
  min-height: 0 !important;
  text-align: center;
}

.workspace.has-results .option { height: 68px; padding-inline: 8px; }

@media (max-width: 1100px) {
  .input-options { grid-template-columns: 1fr 1fr; }
  .option { height: 62px; padding-inline: 8px; }
}

.option.active {
  border-color: var(--purple);
  background: rgba(161, 44, 240, 0.12);
  color: var(--ink);
}

.option input { accent-color: var(--purple); }
#input-form { margin-top: 26px; }
.panel { display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }
label, button { font-weight: 700; }
.panel label { font-size: 1rem; }

textarea, input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

body.dark textarea,
body.dark input[type="file"] { background: #0a0a10; }

textarea { min-height: 190px; resize: vertical; padding: 16px; line-height: 1.55; }
input[type="file"] { padding: 14px; }
textarea:focus, input[type="file"]:focus {
  outline: 2px solid rgba(8, 213, 230, 0.35);
  border-color: var(--cyan);
}

button {
  width: 100%;
  margin-top: 18px;
  padding: 15px 20px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--cyan));
  color: white;
  cursor: pointer;
  font-size: 1.05rem;
}

#submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 240px);
  min-width: 0;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
  padding-inline: 28px;
}

#submit-button span { float: none; }

.workspace.has-results #submit-button {
  padding: 8px 13px;
  border: 1px solid rgba(161, 44, 240, 0.28);
  background: rgba(161, 44, 240, 0.07);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.workspace.has-results #submit-button span {
  font-size: 0.95rem;
}

.workspace.has-results #submit-button:hover,
.workspace.has-results #submit-button:focus-visible {
  border-color: transparent;
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--cyan));
  color: white;
  filter: brightness(1.12);
}

button span { float: right; font-size: 1.2rem; line-height: 0.8; }
button [data-i18n] { float: none; line-height: 1.3; }
[data-i18n]:is(span) { display: inline-block; }
.login-actions { width: 78px; }
.login-actions .language-toggle { width: 100%; }
button:hover { filter: brightness(1.12); }
button:disabled { cursor: wait; opacity: 0.65; }
.hint, .status { color: var(--muted); font-size: 0.95rem; }
.hint { margin: 0; }
.status { min-height: 20px; margin-top: 14px; }
.input-card > .status { margin-bottom: 16px; }
.status.error { color: var(--error); }

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.progress-track {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(161, 44, 240, 0.12);
}

.progress-spinner-mode .progress-track {
  display: none;
}

.progress-spinner-mode::before {
  display: none;
}

.progress-spinner-mode::after {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid rgba(161, 44, 240, 0.2);
  border-top-color: var(--purple);
  border-right-color: var(--cyan);
  border-radius: 50%;
  animation: progress-spinner 0.75s linear infinite;
}

.progress-spinner-mode .progress-track::after {
  position: absolute;
  inset: 0;
  width: 28%;
  content: "";
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: progress-sheen 0.9s linear infinite;
}

@keyframes progress-sheen {
  from { transform: translateX(-140%); }
  to { transform: translateX(360%); }
}

@keyframes progress-spinner {
  to { transform: rotate(360deg); }
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--cyan));
  transition: width 0.12s linear;
}

#progress-percent {
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-spinner-mode #progress-percent {
  display: inline-block;
  min-width: 34px;
  white-space: nowrap;
}

.output-heading-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.output-status { color: var(--cyan); font-size: 0.82rem; font-weight: 800; white-space: nowrap; }

.detection-help { margin: 14px 0 0; color: var(--muted); font-size: 0.98rem; }
.detection-card.is-clear h2 { color: #218653; }
.detection-card.is-clear .detection-label {
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}
.detection-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border: 2px solid #218653;
  border-radius: 50%;
  color: #218653;
  font-size: 0.82rem;
  vertical-align: 3px;
}
.detection-output {
  min-height: 190px;
  flex: 1 1 auto;
  margin-top: 20px;
  padding: 24px;
  border: 1px solid rgba(161, 44, 240, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

body.dark .detection-output { background: rgba(0, 0, 0, 0.22); color: #fff; }
.detection-line + .detection-line { margin-top: 14px; }
.detected-text {
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 181, 64, 0.34);
  box-shadow: 0 0 0 1px rgba(230, 144, 0, 0.38);
  color: inherit;
}


.final-output {
  min-height: 190px;
  flex: 1 1 auto;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid rgba(8, 213, 230, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

body.dark .final-output { background: rgba(0, 0, 0, 0.22); color: #fff; }

.final-output .output-line + .output-line { margin-top: 14px; }
.output-actions { display: flex; flex-shrink: 0; gap: 10px; margin-top: 16px; }
.output-actions button { flex: 1; margin-top: 0; }
.output-actions button {
  border: 1px solid rgba(161, 44, 240, 0.42);
  background: rgba(255, 255, 255, 0.58);
  color: var(--purple);
  font-size: 0.98rem;
}
.output-actions button + button {
  border-color: rgba(8, 145, 190, 0.42);
  color: #087fa5;
}
.output-actions button:hover {
  background: rgba(161, 44, 240, 0.1);
  filter: none;
}
.output-actions button + button:hover {
  background: rgba(8, 213, 230, 0.1);
}
.changed-text {
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(161, 44, 240, 0.22);
  box-shadow: 0 0 0 1px rgba(161, 44, 240, 0.34);
  color: inherit;
}
.output-footer { flex-shrink: 0; margin-top: 16px; color: var(--muted); font-size: 0.82rem; }

.success-note {
  margin-top: 10px;
  color: #218653;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
}

.login-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100% - 32px, 560px);
  padding: 40px 0;
  text-align: center;
  transform: translateY(-18px);
}

.login-actions {
  align-self: flex-end;
  margin-bottom: 18px;
}

.login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.login-logo-frame {
  width: min(76vw, 270px);
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 32px;
  background: linear-gradient(135deg, var(--purple), var(--blue) 55%, var(--cyan));
  box-shadow: 0 18px 44px rgba(63, 44, 158, 0.22);
}

.login-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 25px;
}

.login-intro {
  max-width: 460px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.login-card {
  width: min(100%, 410px);
  margin-top: 32px;
  padding: 32px 34px 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.2);
}

.login-card form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.login-card label {
  align-self: stretch;
  text-align: center;
  color: var(--ink);
  font-size: 1.05rem;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  height: 50px;
  box-sizing: border-box;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  text-align: center;
}
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  outline: 2px solid rgba(8, 213, 230, 0.35);
  border-color: var(--cyan);
}
.login-card button {
  width: min(100%, 220px);
  margin-top: 16px;
  font-size: 1.05rem;
}

body.dark .login-card { background: rgba(17, 17, 26, 0.92); }
body.dark .login-card input[type="text"],
body.dark .login-card input[type="password"] { background: #0a0a10; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 28px, 600px); padding-top: 16px; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    padding-top: 18px;
  }
  .workspace-intro { padding-bottom: 4px; }
  .workspace > .input-card,
  .workspace > .detection-card,
  .workspace > .output-card {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
  }
  .workspace > .input-card {
    width: 100%;
    margin-inline: 0;
    left: 0;
  }
  .workspace > .input-card { transform: translateY(-36px); }
  .workspace.has-results > .input-card { transform: translate(-105%, -36px); }
  .workspace.has-results > .detection-card { transform: translateY(-24px); }
  .workspace.has-results > .output-card { transform: translate(105%, -24px); }
  .workspace.has-detection-only { grid-template-columns: 1fr; }
  .workspace.has-detection-only > .input-card { grid-column: 1; }
  .workspace.has-detection-only > .detection-card { grid-column: 1; transform: translate(105%, -36px); }
  .brand-logo-frame { width: 80px; height: 66px; }
  .header-wordmark img { width: 220px; }
  .header-actions {
    grid-template-columns: 68px minmax(0, 235px);
    gap: 8px;
  }
  .header-actions .theme-toggle {
    height: 58px;
    padding-inline: 6px;
    font-size: 0.85rem;
  }
  .header-actions .logout-link { font-size: 0.85rem; }
  .login-logo-frame { width: min(78vw, 240px); }
  .login-card { padding: 28px 24px 30px; }
  .final-output { min-height: 130px; }
}

/* Κουμπί Νέα υποβολή */

#new-submission-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: start;
  justify-self: center;

  width: auto;
  min-width: 220px;
  margin: -18px 0 0;
  padding: 15px 22px;

  border-radius: 12px;
  border: 0;
  background: linear-gradient(90deg, var(--purple), var(--blue), var(--cyan));
  color: white;
  font-size: 1.08rem;
  font-weight: 700;
}

#new-submission-button:hover {
  filter: brightness(1.12);
}

.new-submission-icon {
  display: inline-block;
  margin-right: 0;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
}

/* Περιοχή αξιολόγησης */
#feedback-section {
  grid-column: 1 / -1;
  grid-row: 4;
  width: 50%;
  margin-inline: auto;
  align-self: start;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

#feedback-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
}

.feedback-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  text-align: center;
  animation: feedback-prompt-float 2.8s ease-in-out infinite;
}

.feedback-arrow {
  color: var(--purple);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1;
  animation: feedback-arrow-float 2.8s ease-in-out infinite;
}

.feedback-arrow:last-child {
  animation-delay: 0.18s;
}

@keyframes feedback-prompt-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes feedback-arrow-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.feedback-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.feedback-buttons button {
  flex: 0 1 130px;
  min-width: 0;
  width: 130px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

#feedback-up {
  border-color: #c8dfce;
  background: #f7fbf8;
  color: #52745c;
}

#feedback-down {
  border-color: #edd0d0;
  background: #fff9f9;
  color: #876060;
}

.feedback-buttons button:hover {
  border-color: var(--purple);
}

.feedback-buttons button[aria-pressed="true"] {
  border-color: var(--purple);
  background: rgba(155, 48, 255, 0.09);
  color: var(--purple);
}

#feedback-up[aria-pressed="true"] {
  border-color: #369456;
  background: #bfe8ca;
  color: #185d2e;
  box-shadow: 0 0 0 3px rgba(54, 148, 86, 0.2);
  transform: translateY(-1px);
}

#feedback-down[aria-pressed="true"] {
  border-color: #c94f4f;
  background: #f4c4c4;
  color: #7e2727;
  box-shadow: 0 0 0 3px rgba(201, 79, 79, 0.2);
  transform: translateY(-1px);
}

#feedback-section label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 700;
}

#feedback-comment {
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 14px;
  margin-bottom: 16px;
  resize: vertical;
}

#feedback-submit {
  display: block;
  width: min(100%, 280px);
  margin: 18px auto 0;
  padding: 15px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    var(--purple),
    var(--blue),
    var(--cyan)
  );
  color: white;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

#feedback-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#feedback-status {
  margin: 12px 0 0;
  color: var(--muted);
}

/* Αξιολόγηση σε Dark mode */
body.dark #feedback-section {
  background: rgba(17, 17, 26, 0.92);
}

body.dark #feedback-comment {
  background: rgba(25, 25, 40, 0.95);
  color: var(--ink);
}

body.dark .feedback-buttons button[aria-pressed="true"] {
  background: rgba(155, 48, 255, 0.18);
}

@media (max-width: 780px) {
  .workspace.has-results {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  #new-submission-button {
    grid-column: 1;
    grid-row: 3;
  }

  #feedback-section {
    grid-column: 1;
    grid-row: 4;
    width: 100%;
  }
}
