/* ==========================================================================
   İbex Teknoloji Yönetim Paneli - tasarım sistemi
   Bootstrap 5 üzerine: kenar çubuğu düzeni, kartlar, tablolar, formlar, medya, içerik editörü
   ========================================================================== */
:root {
  --ad-bg: #f3f5f9;
  --ad-surface: #ffffff;
  --ad-border: #e3e8ef;
  --ad-text: #1e293b;
  --ad-muted: #64748b;
  --ad-primary: #2563eb;
  --ad-primary-soft: #e8f0fe;
  --ad-side: #0f172a;
  --ad-side-2: #172136;
  --ad-side-text: #94a3b8;
  --ad-side-active: #ffffff;
  --ad-accent: #22d3ee;
  --ad-radius: 12px;
  --ad-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
  --ad-side-w: 264px;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ad-text);
  --bs-primary: var(--ad-primary);
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: var(--ad-primary);
}

html { font-size: 15px; }
body { background: var(--ad-bg); color: var(--ad-text); margin: 0; min-height: 100vh; }
a { color: var(--ad-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- shell */
.ibx-shell { display: flex; min-height: 100vh; }
.ibx-side {
  width: var(--ad-side-w); flex: 0 0 var(--ad-side-w); background: var(--ad-side); color: var(--ad-side-text);
  position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .25s ease;
}
.ibx-side::-webkit-scrollbar { width: 6px; }
.ibx-side::-webkit-scrollbar-thumb { background: #243149; border-radius: 3px; }
.ibx-brand { display: flex; align-items: center; gap: .75rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid #1c2740; color: #fff; text-decoration: none !important; }
.ibx-brand img { width: 38px; height: 38px; border-radius: 9px; background: #fff; padding: 3px; object-fit: contain; }
.ibx-brand strong { display: block; font-size: 1rem; line-height: 1.1; color: #fff; }
.ibx-brand small { color: var(--ad-side-text); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.ibx-nav { padding: .75rem .75rem 2rem; flex: 1; }
.ibx-nav-title { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #5b6b86; padding: 1.1rem .75rem .4rem; font-weight: 600; }
.ibx-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; color: var(--ad-side-text);
  font-size: .9rem; text-decoration: none !important; transition: background .15s, color .15s; margin-bottom: 2px;
}
.ibx-nav a i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .9; }
.ibx-nav a:hover { background: var(--ad-side-2); color: #fff; }
.ibx-nav a.active { background: linear-gradient(90deg, rgba(37, 99, 235, .28), rgba(37, 99, 235, .08)); color: var(--ad-side-active); box-shadow: inset 3px 0 0 var(--ad-accent); }
.ibx-nav .ibx-badge { margin-left: auto; background: #ef4444; color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .5rem; font-weight: 600; }
.ibx-side-foot { padding: 1rem 1.25rem; border-top: 1px solid #1c2740; font-size: .78rem; color: #5b6b86; }

.ibx-main { flex: 1; margin-left: var(--ad-side-w); min-width: 0; display: flex; flex-direction: column; }
.ibx-top {
  position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ad-border); display: flex; align-items: center; gap: 1rem; padding: .7rem 1.5rem; min-height: 60px;
}
.ibx-top .ibx-toggle { display: none; }
.ibx-crumbs { font-size: .85rem; color: var(--ad-muted); }
.ibx-crumbs a { color: var(--ad-muted); }
.ibx-crumbs strong { color: var(--ad-text); font-weight: 600; }
.ibx-top .ibx-spacer { flex: 1; }
.ibx-user { display: flex; align-items: center; gap: .6rem; }
.ibx-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ad-primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.ibx-content { padding: 1.75rem 1.5rem 3rem; max-width: 1280px; width: 100%; margin: 0 auto; }
.ibx-foot { margin-top: auto; padding: 1rem 1.5rem; color: var(--ad-muted); font-size: .8rem; border-top: 1px solid var(--ad-border); background: #fff; }
.ibx-backdrop { display: none; }

@media (max-width: 991.98px) {
  .ibx-side { transform: translateX(-100%); }
  .ibx-side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .ibx-main { margin-left: 0; }
  .ibx-top .ibx-toggle { display: inline-flex; }
  .ibx-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; }
}

/* ---------------------------------------------------------------- page header */
.ibx-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.ibx-page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.ibx-page-head p { margin: .25rem 0 0; color: var(--ad-muted); max-width: 70ch; }
.ibx-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- cards, tables */
.card { border: 1px solid var(--ad-border); border-radius: var(--ad-radius); box-shadow: var(--ad-shadow); background: var(--ad-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--ad-border); font-weight: 600; padding: .9rem 1.15rem; }
.card-body { padding: 1.15rem; }
.ibx-stat { display: flex; align-items: center; gap: 1rem; }
.ibx-stat .ibx-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--ad-primary-soft); color: var(--ad-primary); }
.ibx-stat .ibx-ico.green { background: #dcfce7; color: #16a34a; }
.ibx-stat .ibx-ico.amber { background: #fef3c7; color: #d97706; }
.ibx-stat .ibx-ico.rose { background: #ffe4e6; color: #e11d48; }
.ibx-stat .ibx-ico.cyan { background: #cffafe; color: #0891b2; }
.ibx-stat .ibx-num { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.ibx-stat .ibx-lbl { color: var(--ad-muted); font-size: .82rem; margin-top: .2rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-bottom-color: var(--ad-border); vertical-align: middle; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ad-muted); background: #f8fafc; font-weight: 600; border-bottom: 1px solid var(--ad-border); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8fafc; }
.card > .table-responsive > .table, .card > .table { border-radius: var(--ad-radius); overflow: hidden; }

/* ---------------------------------------------------------------- forms + buttons */
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-control, .form-select { border-color: #d5dce7; border-radius: 8px; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--ad-primary); box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-text { color: var(--ad-muted); }
.btn { border-radius: 8px; font-weight: 500; padding: .5rem 1rem; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-primary { background: var(--ad-primary); border-color: var(--ad-primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-soft { background: var(--ad-primary-soft); color: var(--ad-primary); border: 0; }
.btn-soft:hover { background: #d7e5fd; color: #1d4ed8; }
.badge-soft { background: var(--ad-primary-soft); color: var(--ad-primary); font-weight: 600; }
.badge-ok { background: #dcfce7; color: #15803d; font-weight: 600; }
.badge-off { background: #f1f5f9; color: #64748b; font-weight: 600; }
.form-switch .form-check-input { width: 2.5em; height: 1.35em; cursor: pointer; }

/* ---------------------------------------------------------------- toasts */
.ibx-toasts { position: fixed; right: 1.25rem; top: 1.25rem; z-index: 2000; display: flex; flex-direction: column; gap: .6rem; max-width: 380px; }
.ibx-toast { background: #fff; border: 1px solid var(--ad-border); border-left: 4px solid #16a34a; border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: .8rem 1rem; display: flex; gap: .7rem; animation: ibxIn .25s ease; }
.ibx-toast.error { border-left-color: #dc2626; }
.ibx-toast i { font-size: 1.15rem; color: #16a34a; margin-top: 1px; }
.ibx-toast.error i { color: #dc2626; }
@keyframes ibxIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- content editor (pages) */
.ibx-pages-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.ibx-page-card { display: block; color: inherit; text-decoration: none !important; padding: 1.25rem; transition: transform .15s, box-shadow .15s; height: 100%; }
.ibx-page-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(15, 23, 42, .1); }
.ibx-page-card .ibx-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--ad-primary-soft); color: var(--ad-primary); font-size: 1.35rem; margin-bottom: .9rem; }

.ibx-editor { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.ibx-toc { position: sticky; top: 76px; }
.ibx-toc .list-group-item { border: 0; border-radius: 8px !important; padding: .5rem .75rem; font-size: .88rem; color: var(--ad-text); display: flex; justify-content: space-between; gap: .5rem; }
.ibx-toc .list-group-item:hover { background: var(--ad-primary-soft); }
.ibx-toc .list-group-item.active { background: var(--ad-primary-soft); color: var(--ad-primary); font-weight: 600; }
@media (max-width: 991.98px) { .ibx-editor { grid-template-columns: 1fr; } .ibx-toc { position: static; } }

.ibx-section { scroll-margin-top: 80px; margin-bottom: 1.25rem; }
.ibx-section .card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ibx-section .ibx-sec-desc { color: var(--ad-muted); font-weight: 400; font-size: .85rem; }
.ibx-field { padding: 1rem 0; border-bottom: 1px dashed var(--ad-border); }
.ibx-field:last-of-type { border-bottom: 0; }
.ibx-field-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.ibx-field-head .form-label { margin: 0; }
.ibx-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; color: #94a3b8; }
.ibx-lang { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 767.98px) { .ibx-lang { grid-template-columns: 1fr; } }
.ibx-lang-tag { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--ad-muted); margin-bottom: .2rem; display: block; }
.ibx-custom-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ad-primary); display: inline-block; margin-right: .4rem; }
.ibx-savebar { position: sticky; bottom: 0; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--ad-border); padding: .75rem 1.15rem; margin: 0 -1.15rem -1.15rem; border-radius: 0 0 var(--ad-radius) var(--ad-radius); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* image field */
.ibx-img-field { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.ibx-img-preview { width: 96px; height: 72px; border-radius: 10px; border: 1px solid var(--ad-border); background: repeating-conic-gradient(#eef1f6 0% 25%, #fff 0% 50%) 50% / 14px 14px; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; }
.ibx-img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ibx-img-preview.empty::after { content: "\F429"; font-family: "bootstrap-icons"; color: #b6c0cf; font-size: 1.6rem; }
.ibx-img-body { flex: 1; min-width: 220px; }

/* ---------------------------------------------------------------- media library */
.ibx-drop { border: 2px dashed #c7d2e2; border-radius: var(--ad-radius); padding: 1.75rem; text-align: center; color: var(--ad-muted); background: #fbfcfe; transition: all .15s; cursor: pointer; }
.ibx-drop.drag, .ibx-drop:hover { border-color: var(--ad-primary); background: var(--ad-primary-soft); color: var(--ad-primary); }
.ibx-drop i { font-size: 2rem; display: block; margin-bottom: .35rem; }
.ibx-media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ibx-media { position: relative; border: 1px solid var(--ad-border); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.ibx-media:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, .12); transform: translateY(-2px); }
.ibx-media.selected { outline: 3px solid var(--ad-primary); }
.ibx-media .thumb { aspect-ratio: 4 / 3; background: repeating-conic-gradient(#eef1f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; display: grid; place-items: center; }
.ibx-media .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ibx-media .meta { padding: .55rem .7rem; font-size: .78rem; }
.ibx-media .meta .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibx-media .meta .sub { color: var(--ad-muted); }

/* modal picker */
.ibx-modal-body { min-height: 380px; max-height: 65vh; overflow-y: auto; }

/* rich text */
.ibx-rich .ql-toolbar { border-radius: 8px 8px 0 0; border-color: #d5dce7; background: #f8fafc; }
.ibx-rich .ql-container { border-radius: 0 0 8px 8px; border-color: #d5dce7; font-family: var(--bs-body-font-family); font-size: 1rem; min-height: 220px; }

/* ---------------------------------------------------------------- login */
.ibx-login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--ad-side); }
.ibx-login-art { position: relative; padding: 3rem; color: #fff; display: flex; flex-direction: column; justify-content: space-between; background:
  radial-gradient(900px 500px at 20% 10%, rgba(37, 99, 235, .45), transparent 60%),
  radial-gradient(700px 500px at 90% 90%, rgba(34, 211, 238, .28), transparent 60%), #0b1224; }
.ibx-login-art h2 { font-size: 2.2rem; font-weight: 700; max-width: 16ch; line-height: 1.15; }
.ibx-login-art p { color: #9fb0cc; max-width: 42ch; }
.ibx-login-panel { background: #fff; display: grid; place-items: center; padding: 2rem; }
.ibx-login-box { width: 100%; max-width: 400px; }
@media (max-width: 900px) { .ibx-login { grid-template-columns: 1fr; } .ibx-login-art { display: none; } }

.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- mevcut CRUD ekranları (kart görünümü) */
.ibx-content > h1.h3 { font-size: 1.55rem; font-weight: 700; margin-bottom: 1.25rem !important; }
.ibx-content > form:not(.card):not(.d-flex) { background: var(--ad-surface); border: 1px solid var(--ad-border); border-radius: var(--ad-radius); padding: 1.35rem; box-shadow: var(--ad-shadow); }
