/* Global CSS varijable i tematske klase za CSP-friendly SPA */
:root {
  --primary: #0078d4;
  --secondary: #ffd700;
  --background: #fff;
  --accent: #ff4081;
  --text: #111;
  --border: 1px solid #ddd;
}
[data-theme="light"] {
  --primary: #0078d4;
  --secondary: #ffd700;
  --background: #fff;
  --accent: #ff4081;
  --text: #111;
  --border: 1px solid #ddd;
}
[data-theme="dark"] {
  --primary: #f1f5f9;
  --secondary: #ffd700;
  --background: #111;
  --accent: #ff4081;
  --text: #fff;
  --border: 1px solid #2a2f3a;
}
[data-theme="knjigovodkinja"] {
  --primary: #8e44ad;
  --secondary: #f1c40f;
  --background: #fff;
  --accent: #e67e22;
  --text: #111;
  --border: 1px solid #b2bec3;
}
[data-theme="lumen"] {
  --primary: #ffd700;
  --secondary: #ecf0f1;
  --background: #f8f9fa;
  --accent: #2ecc71;
  --text: #2c3e50;
  --border: 1px solid #bdc3c7;
}

html, body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Helvetica, Arial, sans-serif;
}
body {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  min-height: 100vh;
}
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 1.25rem;
  border: var(--border);
  border-radius: 16px;
  background: var(--background);
}
#persona-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: .25rem 0 .15rem;
}
#persona-subtitle {
  opacity: .8;
  margin-bottom: .75rem;
}
#header-icons {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .5rem 0 1rem;
}
.icon-btn {
  border: var(--border);
  background: var(--background);
  border-radius: 12px;
  padding: .45rem .6rem;
  cursor: pointer;
  font-size: 1.05rem;
}
#chat {
  min-height: 220px;
  max-height: 55vh;
  overflow-y: auto;
  overflow-x: auto;
  border: var(--border);
  border-radius: 14px;
  padding: .75rem;
  background: var(--background);
  margin: .75rem 0 1rem;
  word-break: break-word;
  white-space: pre-line;
}
#chat span {
  background: var(--background);
  border-radius: 1em;
  padding: 0.5em 1em;
  margin-left: 0.5em;
  word-break: break-word;
  white-space: pre-line;
  font-size: 1em;
  line-height: 1.5;
}
#chat strong, #chat b { font-weight: 700; }
#chat em, #chat i { font-style: italic; }
#chat a { color: var(--primary); text-decoration: underline; word-break: break-all; }
footer #quick-prompts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  margin: .25rem 0 1rem;
}
.qp {
  border: var(--border);
  border-radius: 999px;
  background: var(--background);
  padding: .4rem .8rem;
  cursor: pointer;
}
.row {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
}
#input {
  flex: 1;
  resize: none;
  border: var(--border);
  border-radius: 12px;
  padding: .6rem .75rem;
  background: var(--background);
  font-size: 1rem;
  color: var(--text);
}
#sendBtn {
  border: 0;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--text);
  font-weight: 700;
  padding: .65rem 1rem;
  cursor: pointer;
}
#fallback-error {
  color: #b91c1c;
  margin-top: .6rem;
  font-size: .95rem;
}
label[for="personaDropdown"] {
  display: inline-block;
  margin-bottom: .25rem;
}
#personaDropdown {
  padding: .35rem .5rem;
  border: var(--border);
  border-radius: 10px;
  background: var(--background);
}
@media (max-width: 600px) {
  #chat { font-size: 0.97em; padding: .5rem; }
  #chat span { font-size: 0.97em; padding: 0.4em 0.7em; }
  .container { padding: 0.5rem; }
}
#chat .ai-msg { background: var(--background) !important; color: var(--primary); transition: background 0.3s; }
#chat .user-msg { background: var(--background) !important; color: var(--text); }
#chat .msg-row { margin-bottom: 0.85em; display: flex; align-items: flex-start; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.persona-dropdown-bar { margin-bottom: 1em; }
.persona-dropdown-label { font-weight: bold; }
.persona-dropdown-select { font-size: 1.05em; }
.hub-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #3498db;
  text-align: center;
  margin-top: 2.2rem;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px #3498db33;
}
.hub-subtitle {
  text-align: center;
  font-size: 1.15rem;
  color: #2c3e50;
  margin-bottom: 2.2rem;
  opacity: 0.85;
}
.hub-header-fixed {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  background: var(--background);
  box-shadow: 0 2px 16px #ffd70022;
  padding: 1.2rem 0 0.5rem 0;
  margin-bottom: 0.5rem;
}
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto 3rem auto;
  padding: 0 1rem;
  margin-top: 0;
  min-height: 70vh;
}

/* Desktop: maksimalno 3 kolone */
@media (min-width: 900px) {
  .persona-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
    gap: 2.5rem;
  }
  .persona-card {
    min-height: 320px;
    padding: 3rem 2.5rem 2.5rem 2.5rem;
  }
}

/* Tablet: 2 kolone */
@media (max-width: 899px) and (min-width: 601px) {
  .persona-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
  }
}

/* Mobitel: 1 kolona */
@media (max-width: 600px) {
  .persona-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
    gap: 1.5rem;
  }
}
.persona-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 32px #3498db22;
  padding: 2.5rem 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}
.persona-card:hover {
  box-shadow: 0 8px 40px #3498db44;
  transform: translateY(-4px) scale(1.03);
}
.persona-icon {
  font-size: 3.2rem;
  margin-bottom: 1rem;
}
.persona-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #3498db;
  margin-bottom: 0.7rem;
  text-align: center;
}
.persona-desc {
  font-size: 1.1rem;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 70px;
  line-height: 1.5;
}
.persona-chat-btn {
  background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  padding: 0.8em 2em;
  font-size: 1.1em;
  cursor: pointer;
  box-shadow: 0 2px 8px #3498db22;
  transition: background 0.2s;
}
.persona-chat-btn:hover {
  background: linear-gradient(90deg, #2ecc71 0%, #3498db 100%);
}
.back-to-hub-link {
  display: block;
  margin-bottom: 1rem;
  float: right;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  color: var(--primary);
  transition: color 0.2s;
}
.back-to-hub-link:hover {
  color: var(--accent);
}
.back-icon {
  font-size: 1.3em;
  vertical-align: middle;
}
.back-text {
  vertical-align: middle;
}
