/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[v-cloak] { display: none; }

:root {
  --bg: #f5f6fa;
  --bg2: #ffffff;
  --bg3: #f0f1f5;
  --border: #e2e4ec;
  --accent: #6366f1;
  --accent-hover: #4f52d8;
  --accent-light: #6366f112;
  --text: #1e2030;
  --text-muted: #8b90a8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
  --transition: .18s ease;
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Login Page ────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
  background: #f5f6fa;
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem 2rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo .icon {
  width: 52px; height: 52px; background: var(--accent-light);
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
}
.login-logo .icon svg { width: 28px; height: 28px; fill: var(--accent); }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; }
.login-logo p { color: var(--text-muted); font-size: .85rem; margin-top: .25rem; }

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .82rem; color: var(--text-muted); margin-bottom: .4rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.form-group input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .65rem .9rem;
  color: var(--text); font-size: .95rem; transition: border-color var(--transition);
}
.form-group input:focus { outline: none; border-color: var(--accent); }
.form-group input[readonly] { opacity: .6; cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.2rem; border-radius: var(--radius); font-size: .9rem;
  font-weight: 600; cursor: pointer; border: none; transition: all var(--transition);
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; padding: .75rem; font-size: .95rem; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #1d4ed8; }
.btn-warning { background: var(--warning); color: #fff; }

.error-msg { background: #fef2f2; border: 1px solid #fca5a5; color: #dc2626; border-radius: var(--radius); padding: .6rem .9rem; font-size: .85rem; margin-bottom: 1rem; display: none; }
.error-msg.show { display: block; }

/* ─── Dashboard Layout ──────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* Main content */
.main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.topbar-clock { font-size: .78rem; color: var(--text-muted); }

.content { padding: 1.25rem; flex: 1; }

/* ─── Cards / Stats ─────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.3rem;
  display: flex; flex-direction: column; gap: .35rem;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-card .value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card .sub { font-size: .8rem; color: var(--text-muted); }
.stat-card.accent .value { color: var(--accent); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.danger .value { color: var(--danger); }

/* ─── Panels ────────────────────────────────────────────────────────────── */
.panel {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1.25rem;
  overflow: hidden; box-shadow: var(--shadow);
}
.panel-header {
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.panel-header h3 { font-size: .95rem; font-weight: 700; }
.panel-body { padding: 1rem 1.2rem; }

/* ─── Filters ───────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.filters input, .filters select {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .8rem;
  color: var(--text); font-size: .85rem;
  transition: border-color var(--transition);
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); }

/* ─── Table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  text-align: left; padding: .6rem .9rem;
  background: var(--bg3); color: var(--text-muted);
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
tbody td { padding: .65rem .9rem; vertical-align: middle; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-paid      { background: #dbeafe; color: #1e40af; }
.badge-shipped   { background: #ede9fe; color: #5b21b6; }
.badge-delivered { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-returned  { background: #fdf4ff; color: #7c3aed; }
.badge-active    { background: #dcfce7; color: #166534; }
.badge-inactive  { background: #fee2e2; color: #991b1b; }
.badge-increase  { background: #dcfce7; color: #166534; }
.badge-decrease  { background: #fee2e2; color: #991b1b; }
.badge-adjustment{ background: #dbeafe; color: #1e40af; }
.badge-sale      { background: #fef3c7; color: #92400e; }
.badge-return    { background: #fdf4ff; color: #7c3aed; }

/* ─── Pagination ────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .4rem; justify-content: flex-end; padding: .75rem 0 0; flex-wrap: wrap; }
.page-info { font-size: .8rem; color: var(--text-muted); margin-right: .5rem; }
.page-btn {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: .8rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 500px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12); transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.2rem 1.4rem; }
.modal-footer { padding: .9rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }

/* ─── Form elements in modal ────────────────────────────────────────────── */
.field-group { margin-bottom: 1rem; }
.field-group label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.field-group input, .field-group select, .field-group textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .8rem;
  color: var(--text); font-size: .88rem;
  transition: border-color var(--transition);
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.field-group textarea { min-height: 80px; resize: vertical; }

/* ─── Empty / Loading states ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

.loading-row td { text-align: center; padding: 2rem; color: var(--text-muted); }
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: .5rem; z-index: 2000; }
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: .75rem 1.1rem;
  font-size: .85rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .6rem;
  animation: slideIn .25s ease; max-width: 320px;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.info    { border-color: var(--info); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Section visibility ────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }
.form-select {
  padding: .45rem .75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  font-size: .9rem;
  color: var(--text);
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: .65rem 1rem; }
  .content { padding: .85rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* CRM segment badges */
.badge-seg-vip { background: #ede9fe; color: #5b21b6; }
.badge-seg-riskli { background: #fef3c7; color: #92400e; }
.badge-seg-kayıp { background: #fee2e2; color: #991b1b; }
.badge-seg-yeni { background: #dbeafe; color: #1e40af; }
.badge-seg-normal { background: #f1f5f9; color: #475569; }
.badge-seg-prospect { background: #ecfdf5; color: #047857; }
.nav-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.nav-tabs button {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .9rem; font-size: .85rem;
  cursor: pointer; color: var(--text-muted); font-weight: 600;
}
.nav-tabs button.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.detail-item { background: var(--bg3); border-radius: 8px; padding: .6rem .75rem; }
.detail-item .k { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }
.detail-item .v { font-weight: 700; font-size: 1rem; }

/* ─── İletişim widget (contact-float-app) ───────────────────────────────── */
.muted { color: var(--text-muted); font-size: .875rem; line-height: 1.5; }
.muted code { font-size: .9em; }
code { font-size: .85em; background: var(--bg3); padding: .1rem .35rem; border-radius: 4px; }

.widget-form .panel {
  margin-bottom: 1.25rem; padding: 1.25rem;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.widget-form legend { font-weight: 700; padding: 0 .5rem; font-size: .95rem; }
.check-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; font-size: .9rem; cursor: pointer; }
.check-row input { width: auto; }
.form-actions { margin-top: .5rem; }
.form-actions .btn-primary { width: auto; min-width: 140px; }
.widget-form .field-group textarea {
  min-height: 4rem; resize: vertical;
  border-radius: var(--radius); padding: .65rem .9rem;
  font-size: .95rem; font-family: inherit;
}
.toast-msg { margin-bottom: 1rem; padding: .65rem 1rem; border-radius: var(--radius); background: #ecfdf5; color: var(--success); font-size: .875rem; }
.toast-msg.toast-error { background: #fef2f2; color: var(--danger); }

/* ─── Dashboard: yuvarlatılmış gövde, üst bar yok ─────────────────────────── */
body.dashboard-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  padding: 1.25rem;
  box-sizing: border-box;
}
.layout--dashboard { min-height: auto; }
.main--dashboard-shell {
  flex: none;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}
.main--dashboard-shell .content--channels {
  padding: 1.5rem;
}

/* ─── Kanal kartları (dashboard) ───────────────────────────────────────── */
.content--channels { max-width: none; margin: 0; }
.channel-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.channel-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .65rem;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.channel-card:hover {
  border-color: #c7cad9;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.channel-card__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .15rem;
}
.channel-card--phone .channel-card__icon {
  background: #dbeafe;
  color: #2563eb;
}
.channel-card--whatsapp .channel-card__icon {
  background: #d1fae5;
  color: #25d366;
}
.channel-card--email .channel-card__icon {
  background: #f1f5f9;
  color: #64748b;
}
.channel-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.channel-card__badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .2rem .5rem;
  border-radius: 6px;
}
.channel-card__badge.is-on {
  background: #ecfdf5;
  color: #15803d;
}
.channel-card__badge.is-off {
  background: var(--bg3);
  color: var(--text-muted);
}
.channel-card__preview {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.45;
  word-break: break-word;
}
.channel-card__edit {
  margin-top: .25rem;
  width: 100%;
  justify-content: center;
}
.modal--channel {
  max-width: 440px;
}
.modal--channel .modal-body {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}
.modal-channel-section .field-group textarea {
  min-height: 5rem;
}
@media (max-width: 900px) {
  .channel-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  body.dashboard-page {
    padding: .75rem;
  }
  .main--dashboard-shell {
    border-radius: 16px;
  }
  .channel-cards {
    grid-template-columns: 1fr;
  }
}
