:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --text: #111827;
  --muted: #374151;
  --border: #9ca3af;
  --focus: #0f766e;
  --danger: #991b1b;
  --danger-bg: #fff1f2;
  --ok: #166534;
  --gutter-bg: #eef2f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(circle at top left, #eef2ff, transparent 32rem), linear-gradient(180deg, var(--bg), #ffffff);
}

.site-header, main, .site-footer {
  width: min(1600px, calc(100% - 1rem));
  margin: 0 auto;
}

.site-header {
  padding: 2rem 0 1rem;
}

.site-header h1 { margin-bottom: .4rem; }

nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

a {
  color: #064e3b;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 2px solid #d1d5db;
  border-radius: 1rem;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 12px 35px rgba(15, 23, 42, .08);
}

.field-group { margin: 1rem 0; }

label {
  display: block;
  font-weight: 700;
  margin-bottom: .35rem;
}

input, textarea, button {
  font: inherit;
}

input, textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: .6rem;
  padding: .75rem;
  color: var(--text);
  background: #fff;
}

textarea {
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
  resize: vertical;
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(3.5rem, auto) 1fr;
  border: 2px solid var(--border);
  border-radius: .6rem;
  overflow: hidden;
  background: #fff;
}

.editor-shell:focus-within {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.line-numbers {
  margin: 0;
  padding: .75rem .5rem;
  min-width: 3.5rem;
  max-height: calc(18 * 1.5em + 1.5rem);
  overflow: hidden;
  text-align: right;
  color: var(--muted);
  background: var(--gutter-bg);
  border-right: 2px solid #d1d5db;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.5;
  user-select: none;
}

#codeInput {
  border: 0;
  border-radius: 0;
  min-height: calc(18 * 1.5em + 1.5rem);
}

#codeInput:focus {
  outline: 0;
}

input:focus, textarea:focus, button:focus, a:focus, summary:focus {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.editor-shell textarea:focus {
  outline: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

button {
  border: 0;
  border-radius: .75rem;
  padding: .75rem 1rem;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover { filter: brightness(.95); }
button:disabled { opacity: .65; cursor: not-allowed; }

.hint, .note {
  color: var(--muted);
  font-size: .95rem;
}

.error-details {
  background: var(--danger-bg);
  border: 2px solid #fecdd3;
  border-radius: .75rem;
  padding: 1rem;
  margin: 1rem 0;
}

.error-details h3 {
  color: var(--danger);
  margin-top: 0;
}

.code-line {
  display: block;
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  border-left: 5px solid var(--danger);
  padding: .5rem .75rem;
  background: #fff;
}

.success { color: var(--ok); font-weight: 700; }
.danger { color: var(--danger); font-weight: 700; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  padding: 1rem 0 2rem;
  color: var(--muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.code-editor-wrap {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  border: 2px solid var(--border);
  border-radius: .6rem;
  overflow: hidden;
  background: #fff;
}

.code-editor-wrap:focus-within {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.line-numbers {
  margin: 0;
  padding: .75rem .5rem;
  border-right: 2px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  text-align: right;
  user-select: none;
  overflow: hidden;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
  min-height: 18rem;
}

.code-editor-wrap textarea {
  border: 0;
  border-radius: 0;
  min-height: 18rem;
}

.code-editor-wrap textarea:focus {
  outline: none;
}


/* Prošireni editor Python koda s brojevima redaka. */
#editor.panel {
  padding-left: 1rem;
  padding-right: 1rem;
}

.code-editor {
  display: grid;
  grid-template-columns: 5rem minmax(80rem, 1fr);
  width: 100%;
  max-width: 100%;
  border: 2px solid var(--border);
  border-radius: .6rem;
  overflow: auto;
  background: #fff;
}

.code-editor:focus-within {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.code-editor .line-numbers {
  grid-column: 1;
  margin: 0;
  padding: .75rem .75rem .75rem .5rem;
  min-width: 5rem;
  min-height: calc(34 * 1.5em + 1.5rem);
  max-height: none;
  overflow: hidden;
  text-align: right;
  color: var(--muted);
  background: var(--gutter-bg);
  border-right: 2px solid #d1d5db;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.5;
  user-select: none;
  white-space: pre;
}

.code-editor #codeInput {
  grid-column: 2;
  width: 100%;
  min-width: 80rem;
  min-height: calc(34 * 1.5em + 1.5rem);
  border: 0;
  border-radius: 0;
  padding: .75rem 1rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  resize: both;
}

.code-editor #codeInput:focus {
  outline: 0;
}

#outputArea {
  min-height: 24rem;
  white-space: pre;
  overflow: auto;
}

pre {
  overflow: auto;
}


/* Završna logika prikaza brojeva redaka: brojevi su unutar okvira editora,
   ali nisu dio vrijednosti textarea elementa i ne spremaju se u .py datoteku. */
.code-editor {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  border: 2px solid var(--border);
  border-radius: .6rem;
  overflow: auto;
  background: #fff;
}

.code-editor .line-numbers {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 4.5rem;
  min-width: 4.5rem;
  min-height: calc(34 * 1.5em + 1.5rem);
  padding: .75rem .75rem .75rem .5rem;
  margin: 0;
  border-right: 2px solid #d1d5db;
  background: var(--gutter-bg);
  color: var(--muted);
  text-align: right;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
}

.code-editor #codeInput {
  display: block;
  width: 100%;
  min-width: 80rem;
  min-height: calc(34 * 1.5em + 1.5rem);
  border: 0;
  border-radius: 0;
  padding: .75rem 1rem .75rem 5.5rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  resize: both;
}

/* Pristupačni alati za snalaženje po redcima. */
.cursor-status {
  border-left: 5px solid var(--focus);
  background: #ecfdf5;
  padding: .75rem 1rem;
  margin: .75rem 0;
  font-weight: 700;
}

.line-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  margin-top: .75rem;
}

.line-tools label {
  margin-bottom: 0;
}

.line-tools input {
  width: 10rem;
}
