:root {
  --gold: #9a7b4f;
  --gold-dark: #7d6340;
  --sidebar: #1e1e1e;
  --sidebar-text: #b0b0b0;
  --bg: #f0f1f3;
  --surface: #fff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --danger: #c62828;
  --warn: #e65100;
  --ok: #2e7d32;
  --font: "Source Sans 3", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
}

.hidden { display: none !important; }

.form-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0 0 0.75rem;
}

/* Layout */
.admin-body {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  text-decoration: none;
  border-bottom: 1px solid #333;
  transition: background 0.2s;
}

.sidebar-brand:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-brand-logo {
  display: block;
  max-height: 40px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sidebar-brand-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sidebar-brand-slogan {
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav a,
.sidebar-nav .sidebar-link {
  padding: 0.75rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  display: block;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-nav .sidebar-link:hover,
.sidebar-nav .sidebar-link.active {
  background: rgba(154, 123, 79, 0.25);
  color: #fff;
}

.sidebar-logout {
  margin: 1rem;
  padding: 0.65rem;
  border: 1px solid #444;
  background: transparent;
  color: #ccc;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-logout:hover { background: #333; color: #fff; }

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.admin-user {
  font-size: 0.9rem;
  color: #666;
}

.admin-content {
  padding: 1.5rem;
  flex: 1;
  background: var(--bg);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card.warn .stat-value { color: var(--warn); }

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gold-dark);
}

.stat-label {
  font-size: 0.82rem;
  color: #666;
}

/* Panel */
.admin-panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 { margin: 0; font-size: 1rem; }
.panel-desc { color: #666; margin: 0 0 1rem; }

/* Table */
.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-weight: 600;
  color: #555;
  background: #fafafa;
}

.admin-table tr:hover td { background: #fafafa; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active { background: #e8f5e9; color: var(--ok); }
.badge-suspended { background: #fff3e0; color: var(--warn); }
.badge-frozen { background: #e3f2fd; color: #1565c0; }
.badge-deleted { background: #f5f5f5; color: #757575; }
.badge-admin { background: rgba(154,123,79,0.2); color: var(--gold-dark); }
.badge-member { background: #f0f0f0; color: #555; }

/* Toolbar */
.toolbar-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  align-items: center;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-search,
.toolbar-left select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

.admin-search { min-width: 220px; }

/* Buttons */
.btn-primary, .btn-outline, .btn-danger, .btn-warn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); }
.btn-danger { background: #ffebee; color: var(--danger); }
.btn-warn { background: #fff3e0; color: var(--warn); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { margin: 0; font-size: 1.1rem; }

.modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}

.admin-form { padding: 1.25rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.form-grid label span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #555;
}

.form-grid input,
.form-grid select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

.span-2 { grid-column: span 2; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.logo-upload {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.logo-upload form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.brand-upload-box {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
}

.brand-upload-box h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.brand-upload-spec {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.brand-upload-spec strong {
  color: var(--text);
  font-weight: 600;
}

.preview-logo {
  max-height: 56px;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin-bottom: 0.75rem;
}

.preview-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  margin-bottom: 0.75rem;
}

.branding-form label span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #555;
}

.branding-form input,
.branding-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

.branding-form .span-2 {
  grid-column: span 2;
}

.branding-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  z-index: 600;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #888;
}

/* Settings tabs */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.settings-tab {
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.settings-tab.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.admin-form-grid fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 0 0 1rem;
}

.admin-form-grid legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.admin-form-grid label {
  display: block;
  margin-bottom: 0.65rem;
}

.admin-form-grid label span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.admin-form-grid input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

.areas-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.area-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 8px;
  flex-wrap: wrap;
}

.area-row.area-inactive {
  opacity: 0.55;
}

.area-row code {
  font-size: 0.78rem;
  color: #666;
}

.modal-wide {
  max-width: 720px;
}

.modal-news-editor {
  max-width: 960px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-news-editor .modal-body {
  overflow-y: auto;
  max-height: calc(92vh - 4rem);
}

.news-editor-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.news-editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.news-editor-sidecard {
  background: #f8f7f4;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
}

.news-editor-side-title {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dark, #8b7349);
}

.news-editor-meta-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.news-editor-meta-list div {
  display: grid;
  gap: 0.1rem;
}

.news-editor-meta-list dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #888;
}

.news-editor-meta-list dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
}

.news-sort-input {
  width: 100%;
  max-width: 5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.86rem;
}

.news-editor-sidebar label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.news-editor-sidebar label input,
.news-editor-sidebar label select {
  font-weight: 400;
}

.news-editor-public-link {
  text-align: center;
  text-decoration: none;
}

.news-editor-block {
  margin-bottom: 1rem;
}

.field-counter {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.field-counter.is-warn {
  color: #b45309;
  font-weight: 600;
}

.field-warn {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: #b91c1c;
}

.news-image-path {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  color: #555;
  word-break: break-all;
}

.news-image-path.is-warning {
  color: #b45309;
}

.news-image-dim {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.news-editor-preview-wrap {
  max-width: 360px;
}

.news-preview-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.news-preview-card-img {
  aspect-ratio: 16 / 10;
  background: #eceae6;
  overflow: hidden;
}

.news-preview-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-preview-card-body {
  padding: 0.85rem 1rem;
}

.news-preview-card-cat {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-dark, #8b7349);
}

.news-preview-card-body h4 {
  margin: 0.35rem 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.news-preview-card-body p {
  margin: 0;
  font-size: 0.82rem;
  color: #666;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
}

.badge-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-muted {
  background: #f0f0f0;
  color: #666;
}

.news-table-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 280px;
}

.news-table-thumb-wrap {
  flex-shrink: 0;
}

.news-table-thumb {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #eceae6;
}

.news-table-noimg {
  display: inline-flex;
  width: 48px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: #f0eeea;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #999;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 800px) {
  .news-editor-layout {
    grid-template-columns: 1fr;
  }

  .news-editor-sidebar {
    order: -1;
  }
}

.news-rich-fieldset .news-rich-editor-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.news-rich-textarea {
  width: 100%;
  min-height: 120px;
  font-family: inherit;
}

.news-rich-editor-wrap .tox-tinymce {
  border-radius: 10px;
  border-color: var(--border) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.news-excerpt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.35rem;
}

.field-hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.news-image-fieldset {
  margin-top: 0.5rem;
}

.news-image-panel {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.news-image-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #eceae6;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-image-preview-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.75rem;
}

.news-image-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.news-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-image-file-label {
  cursor: pointer;
  margin: 0;
}

.news-image-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

.news-image-status.is-error {
  color: #b91c1c;
}

.news-image-url-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.news-image-url-label input {
  font-weight: 400;
}

.news-image-url-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.news-image-url-row input {
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .news-image-panel {
    grid-template-columns: 1fr;
  }

  .news-image-preview {
    max-height: 200px;
  }
}

/* Ana sayfa editörü */
.home-editor-form fieldset.home-editor-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin: 0 0 1.5rem;
  background: var(--surface);
}

.home-editor-form legend {
  font-weight: 700;
  padding: 0 0.35rem;
}

.home-repeater-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0.75rem;
}

.home-repeater-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.home-repeater-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.home-editor-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border-radius: 8px;
}

.home-editor-row label {
  flex: 1 1 140px;
  min-width: 120px;
}

.home-editor-row-wide label.flex-grow {
  flex: 2 1 200px;
}

.home-editor-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: var(--bg);
}

.home-editor-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.admin-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
}

@media (max-width: 992px) {
  .admin-nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    margin-right: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
  }

  .admin-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 1px;
  }

  .admin-topbar {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .admin-topbar h1 {
    font-size: 1.05rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 600;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }

  .admin-body.admin-nav-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 550;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .admin-body.admin-nav-open .admin-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .admin-search { min-width: 0; }
  .form-actions { flex-wrap: wrap; gap: 0.5rem; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .admin-modal {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 12px 12px 0 0;
  }
}

.admin-nav-toggle { display: none; }
.admin-sidebar-backdrop { display: none; }

@media (max-width: 992px) {
  .admin-sidebar-backdrop { display: block; }
}
