/* ---------- Tema Değişkenleri ---------- */
:root {
  --bg: #f5f6f8;
  --text: #1f2937;
  --muted: #6b7280;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --hover: #fafafa;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --input-border: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --link: #2563eb;
  --modal-backdrop: rgba(15,23,42,.55);
  --shadow-card: 0 20px 60px rgba(0,0,0,.2);
  --shadow-modal: 0 30px 80px rgba(0,0,0,.3);
  --type-badge-bg: #eef2ff;
  --type-badge-text: #4f46e5;
  --other-month-text: #c0c4cc;
  color-scheme: light;
}

/* Karanlık tema değerleri — hem sistem teması hem manuel seçim için */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --text: #e6e8eb;
    --muted: #9aa3af;
    --surface: #1a1d24;
    --surface-2: #21252d;
    --surface-3: #262b33;
    --hover: #22262e;
    --border: #2d323c;
    --border-soft: #262b33;
    --input-border: #3a4150;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --link: #60a5fa;
    --modal-backdrop: rgba(0,0,0,.65);
    --shadow-card: 0 20px 60px rgba(0,0,0,.5);
    --shadow-modal: 0 30px 80px rgba(0,0,0,.6);
    --type-badge-bg: #1e253b;
    --type-badge-text: #a5b4fc;
    --other-month-text: #4b5563;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --text: #e6e8eb;
  --muted: #9aa3af;
  --surface: #1a1d24;
  --surface-2: #21252d;
  --surface-3: #262b33;
  --hover: #22262e;
  --border: #2d323c;
  --border-soft: #262b33;
  --input-border: #3a4150;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --link: #60a5fa;
  --modal-backdrop: rgba(0,0,0,.65);
  --shadow-card: 0 20px 60px rgba(0,0,0,.5);
  --shadow-modal: 0 30px 80px rgba(0,0,0,.6);
  --type-badge-bg: #1e253b;
  --type-badge-text: #a5b4fc;
  --other-month-text: #4b5563;
  color-scheme: dark;
}

/* ---------- Reset & Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  transition: background .2s ease, color .2s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Tema Butonu ---------- */
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle.floating {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
:root[data-theme="dark"] .login-body,
.login-body { transition: background .2s ease; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-body {
    background: linear-gradient(135deg, #1e1b4b, #2e1065);
  }
}
:root[data-theme="dark"] .login-body {
  background: linear-gradient(135deg, #1e1b4b, #2e1065);
}
.login-card {
  background: var(--surface);
  color: var(--text);
  padding: 32px;
  border-radius: 14px;
  width: 360px;
  box-shadow: var(--shadow-card);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label { display: block; margin: 18px 0 6px; font-weight: 600; }
.login-card input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--input-border); border-radius: 8px; font-size: 14px;
  background: var(--surface-2); color: var(--text);
}

.login-card .btn { width: 100%; margin-top: 18px; }

/* ---------- Layout ---------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 18px; display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button { font-size: 13px; }

.brand-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand-tab {
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface-3); cursor: pointer; font-weight: 600;
  border: 2px solid transparent; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px;
}
.brand-tab .dot { width: 10px; height: 10px; border-radius: 50%; background: #999; }
.brand-tab.active { background: var(--surface); border-color: currentColor; }
.brand-tab:hover { background: var(--hover); }

.month-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
}
.month-bar h2 { margin: 0; font-size: 18px; text-transform: capitalize; }
.month-bar .spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--input-border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px;
  font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* ---------- Calendar ---------- */
.calendar {
  margin: 0 18px 24px;
  background: var(--surface); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
}
.cal-head, .cal-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.cal-head div {
  padding: 10px; font-weight: 700; font-size: 12px;
  color: var(--muted); background: var(--surface-2); text-align: center;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-height: 120px; border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft); padding: 6px;
  position: relative; cursor: pointer;
  display: flex; flex-direction: column;
  transition: background .12s;
}
.cal-cell:hover { background: var(--hover); }
.cal-cell.other-month { background: var(--surface-2); color: var(--other-month-text); }
.cal-cell.today .day-num {
  background: var(--accent); color: #fff;
  border-radius: 999px; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.day-num { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* Özel gün etiketleri */
.holiday-tags { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.holiday-tag {
  font-size: 9px; font-weight: 700; line-height: 1.25;
  padding: 1px 5px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.holiday-tag.resmi      { background: #fee2e2; color: #b91c1c; }
.holiday-tag.dini       { background: #d1fae5; color: #065f46; }
.holiday-tag.pazarlama  { background: #fce7f3; color: #9d174d; }
.holiday-tag.dunya      { background: #cffafe; color: #155e75; }
.holiday-tag.more       { background: var(--surface-3); color: var(--muted); }
:root[data-theme="dark"] .holiday-tag.resmi     { background: #3b1518; color: #fca5a5; }
:root[data-theme="dark"] .holiday-tag.dini      { background: #0f2e22; color: #6ee7b7; }
:root[data-theme="dark"] .holiday-tag.pazarlama { background: #3a1226; color: #f9a8d4; }
:root[data-theme="dark"] .holiday-tag.dunya     { background: #0c2c33; color: #67e8f9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .holiday-tag.resmi     { background: #3b1518; color: #fca5a5; }
  :root:not([data-theme="light"]) .holiday-tag.dini      { background: #0f2e22; color: #6ee7b7; }
  :root:not([data-theme="light"]) .holiday-tag.pazarlama { background: #3a1226; color: #f9a8d4; }
  :root:not([data-theme="light"]) .holiday-tag.dunya     { background: #0c2c33; color: #67e8f9; }
}

.post-mini {
  flex: 1; border-radius: 6px; overflow: hidden; position: relative;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px;
}
.post-mini img {
  width: 100%; height: 100%; object-fit: cover;
}
.post-mini .badge {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.6); color: #fff;
  padding: 2px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.post-mini .brand-stripe {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.post-mini .multi-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,.6); color: #fff;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
}
.post-mini--empty { background: var(--surface-2); }

/* Sürükle-bırak (admin) */
.post-mini.draggable, .chip.draggable { touch-action: none; cursor: grab; user-select: none; }
/* Görselden tutunca da çalışsın: tarayıcının kendi resim sürüklemesini kapat */
.post-mini.draggable img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.post-mini.dragging, .chip.dragging { opacity: .35; }
.drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none; opacity: .92;
  box-shadow: 0 12px 32px rgba(0,0,0,.4); border-radius: 6px; overflow: hidden;
  cursor: grabbing;
}
.cal-cell.drop-target {
  outline: 2px dashed var(--accent); outline-offset: -2px;
  background: var(--hover);
}

.post-mini-text {
  padding: 4px; font-size: 11px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; text-align: left; width: 100%; height: 100%;
}

/* Birden fazla post için (admin'de marka filtresi yokken) */
.post-mini.stack { background: transparent; gap: 2px; flex-direction: column; }
.post-mini.stack .chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  color: var(--text);
  width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-mini.stack .chip .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--modal-backdrop);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); color: var(--text); border-radius: 14px;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-modal);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

.post-preview img {
  width: 100%; border-radius: 10px; max-height: 420px; object-fit: contain;
  background: var(--surface-3);
}
/* Viewer galeri (çoklu görsel kaydırma) */
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  gap: 0; border-radius: 10px; background: var(--surface-3);
  scrollbar-width: none; height: 380px;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-item {
  flex: 0 0 100%; min-width: 100%; height: 100%; scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center;
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 10px;
}
.gallery-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-top: 10px;
}
.gallery-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
}
.gallery-btn:hover { background: var(--surface-2); }
.gallery-counter { font-size: 13px; font-weight: 600; color: var(--muted); min-width: 56px; text-align: center; }

.post-preview .meta {
  display: flex; gap: 10px; align-items: center; margin: 12px 0;
  font-size: 13px; color: var(--muted);
}
.post-preview .type-badge {
  background: var(--type-badge-bg); color: var(--type-badge-text);
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.post-preview .caption {
  white-space: pre-wrap; line-height: 1.55; font-size: 14px;
  background: var(--surface-2); padding: 14px; border-radius: 8px;
  border: 1px solid var(--border-soft);
}
.caption-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.btn.copy-ok {
  background: #10b981; color: #fff; border-color: #10b981;
}

/* ---------- Forms ---------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-row input[type=text],
.form-row input[type=date],
.form-row input[type=time],
.form-row input[type=number],
.form-row input[type=color],
.form-row select,
.form-row textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--input-border); border-radius: 8px; font-size: 13px;
  font-family: inherit;
  background: var(--surface-2); color: var(--text);
}
.form-row textarea { resize: vertical; min-height: 110px; }
.form-row.inline { display: flex; gap: 10px; }
.form-row.inline > div { flex: 1; }

/* Editör çoklu görsel grid */
.img-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.img-thumb {
  position: relative; border-radius: 8px; overflow: hidden;
  aspect-ratio: 1 / 1; background: var(--surface-3);
  border: 1px solid var(--border);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb.marked { opacity: .35; }
.img-thumb.marked img { filter: grayscale(1); }
.img-thumb .cover-tag {
  position: absolute; top: 4px; left: 4px; z-index: 2;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
}
.img-remove {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.6); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-remove input { display: none; }
.img-remove .x { color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
.img-thumb.marked .img-remove { background: #dc2626; }
.img-hint { font-size: 12px; margin-top: 6px; }
.img-hint.over { color: #dc2626; font-weight: 700; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
:root[data-theme="dark"] .alert.error { background: #3b1518; color: #fca5a5; border-color: #5b1d22; }
:root[data-theme="dark"] .alert.success { background: #0f2e22; color: #6ee7b7; border-color: #14452f; }

/* ---------- Admin: brand list ---------- */
.brand-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; padding: 0 18px 24px;
}
.brand-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; display: flex; align-items: center; gap: 12px;
}
.brand-card .swatch { width: 36px; height: 36px; border-radius: 8px; }
.brand-card .body { flex: 1; min-width: 0; }
.brand-card .body .name { font-weight: 700; }
.brand-card .body .handle { font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .cal-cell { min-height: 80px; }
  .day-num { font-size: 11px; }
  .post-mini .badge { font-size: 9px; }
  .topbar h1 { font-size: 14px; }
  .month-bar h2 { font-size: 16px; }
}
