@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --blue-soft: #eaf2ff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}

.wrap {
  max-width: 480px;
  margin: 80px auto;
  padding: 0 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.card h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 24px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 16px;
}

button {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { opacity: 0.92; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -8px;
  margin-bottom: 16px;
  display: none;
}

/* --- Admin panel (geniş sayfa düzeni) --- */

.wrap-wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.btn-ghost {
  width: auto;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 13px;
}

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters input[type="text"],
.filters select {
  width: auto;
  min-width: 180px;
  margin-bottom: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.filters input[type="text"] { flex: 1; min-width: 220px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--blue-soft);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--blue-soft); }
tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-public { background: #dcfce7; color: #166534; }
.badge-internal { background: #fef3c7; color: #92400e; }

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.pagination button {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination span {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
}

.modal h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.modal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-content {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.modal-close {
  width: auto;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 13px;
  float: right;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Sohbet arayüzü --- */

.chat-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-header {
  text-align: center;
  padding: 12px 0 24px;
}

.chat-header h1 {
  font-size: 24px;
  margin: 0 0 6px;
}

.chat-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.chat-tagline {
  font-size: 19px !important;
  color: var(--text) !important;
  font-weight: 500;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 16px;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

.msg-text {
  white-space: pre-wrap;
}

.check-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 14px;
  margin-bottom: 10px;
}

.check-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 0 6px;
}

.check-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.check-label {
  color: var(--text-muted);
}

.check-value {
  font-weight: 500;
  text-align: right;
}

.check-value.check-ok { color: #166534; }
.check-value.check-fail { color: var(--danger); }

.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-assistant {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-sources {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.msg-loading {
  align-self: flex-start;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.chat-input-row input[type="text"] {
  margin-bottom: 0;
  flex: 1;
}

.chat-input-row button {
  width: auto;
  padding: 12px 22px;
}

.chat-scope-note {
  font-size: 15px !important;
  color: var(--text-muted);
  margin-top: 6px !important;
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 20px;
  line-height: 1.5;
}

.chat-disclaimer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.ecosystem-section {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ecosystem-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  text-align: center;
}

.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.ecosystem-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
}

.ecosystem-card:hover {
  border-color: var(--blue);
}

.ecosystem-card b {
  font-size: 12px;
  display: block;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecosystem-card span {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .ecosystem-grid { grid-template-columns: repeat(2, 1fr); }
}

.chat-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 16px;
  padding-bottom: 8px;
}

.chat-footer a {
  color: var(--text-muted);
}
