/* MailSignHub - tasarım tokenları (saf CSS, build/npm gerektirmez) */

:root {
  --ink: #0f172a;
  --ink-900: #0f172a;
  --ink-800: #ffc000; /*#0078d4;*/
  --ink-700: #106ebe;
  --ink-600: #2b88d8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-border: #e3e6ec;
  --accent: #10b981;
  --accent-soft: #d1fae5;
  --text-secondary: #5b6472;
  --success: #10b981;
  --danger: #d64545;
  --warning: #d97706;
  --radius-card: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--surface-muted);
  color: var(--ink);
}

h1, h2, h3, .font-display {
  font-family: "Plus Jakarta Sans", sans-serif;
}

a {
  color: inherit;
}

/* --- Layout --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  padding: 0.75rem 1.5rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
}

.brand-accent {
  font-weight: 700;
  color: var(--ink-800);
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
}

.nav-link.active {
  background: var(--ink-800);
  color: white;
}

.nav-link:not(.active):hover {
  background: var(--surface-muted);
}

.logout-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Fonksiyon sayfalari (bkz. {% block page_wide %} - emailsignature modulu
   sablonlari) icerigin sikismamasi icin .page'in 960px sinirini kaldirir;
   Ana Sayfa ve Yonetim/config sayfalari .page-wide eklemedigi icin
   960px max-width'te kalmaya devam eder. */
.page-wide {
  max-width: none;
}

.page-with-sidebar {
  display: flex;
  gap: 2rem;
}

.sidebar {
  width: 12rem;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  padding: 0 0.5rem;
  margin-bottom: 0.75rem;
}

.sidebar-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.sidebar-link.active {
  background: white;
  color: var(--ink);
  border: 1px solid var(--surface-border);
}

.content {
  flex: 1;
}

/* --- Card / form kontrolleri --- */

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 24, 38, 0.04);
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.text-input, select.text-input {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.text-input:focus {
  border-color: var(--ink-600);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.16);
}

.field-error {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--ink-800);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--ink-700);
}

.btn-secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
  background: var(--surface-muted);
}

.radio-group {
  display: flex;
  gap: 0.75rem;
}

.radio-option {
  flex: 1;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-option.selected {
  border-color: var(--ink-800);
  background: rgba(0, 120, 212, 0.06);
}

.hint {
  background: var(--surface-muted);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.alert {
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background: rgba(214, 69, 69, 0.1);
  color: var(--danger);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.alert-warning {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warning);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-accent {
  background: var(--accent-soft);
  color: #047857;
}

.badge-neutral {
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: start;
}

.data-table th {
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.75rem 1.25rem;
}

.data-table td {
  border-bottom: 1px solid var(--surface-border);
  padding: 0.75rem 1.25rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* --- Login sayfasi --- */

.login-shell {
  display: flex;
  min-height: 100vh;
}

.login-brand-panel {
  display: none;
  width: 40%;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(circle at center, rgb(252, 252, 252) 0%, var(--ink-900) 75%);
  color: white;
  padding: 2.5rem;
}

@media (min-width: 768px) {
  .login-brand-panel {
    display: flex;
  }
}

.login-brand-panel .slogan {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.25rem;
}

.login-brand-panel .footnote {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.login-motif {
  flex: 1;
  padding: 2.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  display: block;
  max-width: 18rem;
  width: 100%;
  height: auto;
}

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-form-inner {
  width: 100%;
  max-width: 24rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
}

/* --- HTMX yukleme gostergesi --- */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator {
  display: block;
}
.htmx-request.htmx-indicator {
  display: block;
}

/* --- Ek badge/buton tonlari --- */
.badge-danger {
  background: rgba(214, 69, 69, 0.1);
  color: var(--danger);
}

.btn-danger {
  background: white;
  color: var(--danger);
  border: 1px solid rgba(214, 69, 69, 0.35);
}

.btn-danger:hover {
  background: rgba(214, 69, 69, 0.08);
}

/* --- Konfigurasyon ana sayfasi - fonksiyon kutucuklari --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
}

.stat-tile-logo {
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-tile-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stat-tile-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-tile-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.tile-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tile-card:hover {
  border-color: var(--ink-600);
  box-shadow: 0 1px 4px rgba(15, 24, 38, 0.08);
}

.tile-card-title {
  font-weight: 600;
  margin: 0 0 0.375rem;
}

.tile-card-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Topbar sag taraf (dil secici + cikis) --- */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-select {
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--ink);
  background: white;
}

.is-hidden {
  display: none !important;
}

.auth-lang-switcher {
  position: absolute;
  top: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 10;
}

/* --- HTML imza sablon editoru --- */
.editor-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0.375rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.editor-btn:hover {
  background: white;
  border-color: var(--surface-border);
}

.placeholder-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  margin-inline-end: 0.375rem;
  margin-block-end: 0.375rem;
}

.placeholder-chip:hover {
  border-color: var(--ink-600);
  background: white;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 38, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
}

.modal-box {
  background: white;
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 40rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface-border);
}

.modal-body {
  padding: 1.25rem;
  overflow: auto;
}

.modal-body iframe {
  width: 100%;
  height: 20rem;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
}

/* --- HolisferAssistant widget (Faz 3) - shared/assistant/templates/assistant/*.html --- */
.ai-widget {
  position: fixed;
  inset-inline-end: 1.5rem;
  bottom: 1.5rem;
  z-index: 1000;
}

.ai-widget-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: none;
  background: var(--ink-800);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 24, 38, 0.24);
  cursor: pointer;
}

.ai-widget-fab:hover {
  background: var(--ink-700);
}

.ai-widget-panel {
  position: absolute;
  inset-inline-end: 0;
  bottom: 4rem;
  width: 320px;
  max-width: calc(100vw - 2rem);
}

.ai-widget-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
}

.ai-widget-header {
  font-size: 0.95rem;
}

.ai-widget-messages {
  overflow-y: auto;
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-widget-message {
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.ai-widget-message p {
  margin: 0;
}

.ai-widget-message-user {
  align-self: flex-end;
  background: var(--ink-800);
  color: white;
}

.ai-widget-message-assistant {
  align-self: flex-start;
  background: var(--surface-muted);
  color: var(--ink);
}

.ai-widget-form {
  display: flex;
  gap: 0.5rem;
}

.ai-widget-form .text-input {
  flex: 1;
}

.ai-widget-form .btn-primary {
  width: auto;
}
