/* Melasyra — Yönetim Paneli */
:root {
  --sidebar-bg:   #1e1218;
  --sidebar-text: rgba(255,255,255,.72);
  --accent:       #c4738a;
  --accent-dark:  #9e5570;
  --bg:           #f5f0ec;
  --white:        #ffffff;
  --text:         #251820;
  --text-body:    #4a3040;
  --muted:        #9a7880;
  --border:       #e8d6d0;
  --border-light: #f0e4de;
  --radius:       8px;
  --shadow:       0 2px 12px rgba(37,24,32,.07);
  --shadow-md:    0 4px 24px rgba(37,24,32,.1);
  --sidebar-w:    240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; overflow-x: hidden; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-body);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; display: block; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 200;
  display: flex; flex-direction: column;
  transition: transform .3s ease;
}
.sidebar-logo {
  padding: 1.4rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo img { height: 26px; width: auto; filter: brightness(0) invert(1); }
.sidebar-logo span {
  display: block; font-size: .6rem; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255,255,255,.28); margin-top: .4rem;
}
.sidebar-nav { padding: .75rem 0; flex: 1; }
.nav-group-title {
  font-size: .58rem; letter-spacing: .15em; text-transform: uppercase;
  color: rgba(255,255,255,.22); padding: 1rem 1.25rem .3rem;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.25rem;
  color: var(--sidebar-text); font-size: .855rem;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-nav a i { width: 17px; text-align: center; font-size: .85rem; opacity: .65; }
.sidebar-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav a.active {
  background: rgba(196,115,138,.13); color: #fff;
  border-left-color: var(--accent);
}
.sidebar-nav a.active i { opacity: 1; color: var(--accent); }
.sidebar-bottom {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-bottom a {
  display: flex; align-items: center; gap: .6rem;
  color: rgba(255,255,255,.35); font-size: .8rem; transition: color .2s;
}
.sidebar-bottom a:hover { color: rgba(255,255,255,.65); }
.sidebar-bottom a i { font-size: .85rem; }

/* ── Main content ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Topbar ── */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar h1 { font-size: 1.1rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.topbar-right { display: flex; gap: .75rem; align-items: center; }

/* ── Page body ── */
.page-body { padding: 1.75rem 2rem; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.35rem 1.5rem; box-shadow: var(--shadow);
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; margin-bottom: .75rem;
}
.stat-icon.pink   { background: #fce8ee; color: #c4738a; }
.stat-icon.green  { background: #e8f5ee; color: #2d9a5a; }
.stat-icon.orange { background: #fff3e6; color: #d87a30; }
.stat-icon.blue   { background: #e8f0fe; color: #3a6fd8; }
.stat-value { font-size: 1.65rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-sub   { font-size: .72rem; margin-top: .3rem; }

/* ── Dashboard 2-col layout ── */
.dash-grid {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 1.5rem; align-items: start;
}

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden; }
.card:last-child { margin-bottom: 0; }
.card-header {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: .95rem; color: var(--text); font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1.5rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  background: #faf6f3; font-size: .68rem;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding: .7rem 1rem; text-align: left; white-space: nowrap;
}
td { padding: .85rem 1rem; border-bottom: 1px solid var(--border-light); font-size: .875rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fdf8f6; }
.td-actions { display: flex; gap: .4rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.2rem; font-size: .82rem; font-weight: 600;
  border: none; cursor: pointer; border-radius: var(--radius);
  transition: all .2s; text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-dark); color: #fff; }
.btn-outline  { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover  { background: var(--accent); color: #fff; }
.btn-danger   { background: #dc3545; color: #fff; }
.btn-danger:hover   { background: #b02a37; color: #fff; }
.btn-ghost    { background: var(--bg); color: var(--text-body); }
.btn-ghost:hover    { background: var(--border-light); }
.btn-sm  { padding: .35rem .75rem; font-size: .76rem; }
.btn-lg  { padding: .85rem 2rem; font-size: .92rem; justify-content: center; width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; padding: .35rem .5rem; border-radius: 6px; color: var(--muted); transition: all .2s; font-size: .9rem; }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { color: #dc3545; background: #fdf0f0; }

/* ── Forms ── */
.form-section { margin-bottom: 2rem; }
.form-section-title {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
  padding-bottom: .6rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-light);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--text); }
label .req { color: var(--accent); }

input[type=text], input[type=number], input[type=email],
input[type=tel], input[type=password], input[type=search],
select, textarea {
  width: 100%; padding: .65rem .9rem;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .875rem;
  color: var(--text); font-family: inherit;
  outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,115,138,.1); }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
.form-hint { font-size: .72rem; color: var(--muted); line-height: 1.5; }

/* Prefix input */
.input-wrap { display: flex; }
.input-prefix {
  background: var(--bg); border: 1.5px solid var(--border); border-right: none;
  padding: .65rem .85rem; border-radius: var(--radius) 0 0 var(--radius);
  font-size: .875rem; color: var(--muted); white-space: nowrap; display: flex; align-items: center;
}
.input-wrap input { border-radius: 0 var(--radius) var(--radius) 0; }

/* ── Toggle switch ── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem; background: var(--bg); border-radius: var(--radius);
}
.toggle-info .toggle-label { font-size: .875rem; font-weight: 600; color: var(--text); }
.toggle-info .toggle-desc  { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #d0bfc3; border-radius: 26px;
  cursor: pointer; transition: .25s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Chip checkboxes (bedenler) ── */
.chip-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip input { display: none; }
.chip label {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .4rem .9rem; border: 1.5px solid var(--border);
  border-radius: 20px; cursor: pointer;
  font-size: .8rem; font-weight: 400; color: var(--text-body);
  transition: all .2s; min-width: 42px;
}
.chip input:checked + label { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ── Image upload zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2rem; text-align: center; cursor: pointer;
  background: #fdf8f6; transition: all .2s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: #fce8ee33; }
.upload-zone i { font-size: 2rem; color: var(--muted); display: block; margin-bottom: .6rem; }
.upload-zone p { font-size: .875rem; color: var(--muted); }
.upload-zone span { color: var(--accent); font-weight: 600; }

.img-preview-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.img-thumb {
  position: relative; width: 88px; height: 108px;
  border-radius: var(--radius); overflow: hidden;
  border: 2px solid var(--border); cursor: grab;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb .del-btn {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.65); color: #fff;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; cursor: pointer; font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
}
.img-thumb .main-badge {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--accent); color: #fff;
  font-size: .55rem; letter-spacing: .08em;
  text-align: center; padding: 3px; text-transform: uppercase; font-weight: 700;
}
.img-thumb.is-main { border-color: var(--accent); }

/* ── Alert ── */
.alert {
  padding: .85rem 1.15rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: #f0faf4; border: 1px solid #a3d9b4; color: #2d7a4a; }
.alert-error   { background: #fdf0f0; border: 1px solid #e8a0a0; color: #9a3030; }
.alert-info    { background: #f0f5fe; border: 1px solid #a0b8e8; color: #2a4a8a; }

/* ── Status badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .22rem .65rem; border-radius: 20px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .03em; white-space: nowrap;
}
.badge-waiting  { background: #fff8e0; color: #c47d00; }
.badge-prep     { background: #e8f0fe; color: #2a5bc4; }
.badge-shipping { background: #e8f5ee; color: #1e8a4a; }
.badge-done     { background: #e0f5e8; color: #166a34; }
.badge-cancel   { background: #fdf0f0; color: #9a3030; }
.badge-active   { background: #e8f5ee; color: #1e8a4a; }
.badge-passive  { background: #f4f0ed; color: #9a7880; }

/* ── Filter bar ── */
.filter-bar {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.search-wrap {
  display: flex; align-items: center; gap: .5rem;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 0 .9rem; flex: 1; min-width: 220px;
}
.search-wrap i { color: var(--muted); font-size: .85rem; }
.search-wrap input { border: none; background: none; padding: .6rem 0; font-size: .875rem; outline: none; width: 100%; }

/* ── Status tabs ── */
.status-tabs { display: flex; gap: 0; margin-bottom: 1.25rem; border-bottom: 2px solid var(--border); overflow-x: auto; }
.status-tab {
  padding: .6rem 1.1rem; font-size: .82rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .2s; white-space: nowrap; font-family: inherit;
}
.status-tab:hover { color: var(--text); }
.status-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Product cell ── */
.prod-cell { display: flex; align-items: center; gap: .75rem; }
.prod-thumb {
  width: 46px; height: 58px; border-radius: 6px;
  background: #fce8ee; overflow: hidden; flex-shrink: 0;
}
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-name { font-weight: 600; color: var(--text); font-size: .875rem; line-height: 1.3; }
.prod-sub  { font-size: .73rem; color: var(--muted); margin-top: .15rem; }

/* ── Order detail ── */
.order-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.info-block h4 {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .5rem; font-weight: 700;
}
.info-block p { font-size: .9rem; color: var(--text); line-height: 1.75; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state i { font-size: 3rem; opacity: .25; display: block; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* ── Login page ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1218 0%, #2d1e24 60%, #3a2030 100%);
  padding: 1rem;
}
.login-box {
  background: var(--white); border-radius: 16px; padding: 2.5rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 72px rgba(0,0,0,.35);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { height: 34px; margin: 0 auto .75rem; }
.login-logo p { color: var(--muted); font-size: .875rem; }
.login-box .form-group { margin-bottom: 1rem; }

/* ── Mobile header ── */
.mobile-header {
  display: none; background: var(--sidebar-bg);
  padding: .85rem 1.25rem;
  align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 201;
}
.mobile-header img { height: 22px; filter: brightness(0) invert(1); }
.hamburger { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.7); font-size: 1.15rem; padding: .3rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }

/* ── İki sütunlu sayfa grid'i (kategoriler, sipariş detay, ürün form) ── */
.page-grid-2 {
  display: grid;
  grid-template-columns: 1fr var(--col2, 340px);
  gap: 1.5rem;
  align-items: start;
}

/* ── Mobil ürün kartları (tablo yerine) ── */
.prod-card-list { display: none; }
.prod-card {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-light);
}
.prod-card:last-child { border-bottom: none; }
.prod-card-img {
  width: 50px; height: 62px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden; background: #fce8ee;
}
.prod-card-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-card-info { flex: 1; min-width: 0; }
.prod-card-name { font-weight: 600; color: var(--text); font-size: .875rem; margin-bottom: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-card-meta { font-size: .73rem; color: var(--muted); margin-bottom: .3rem; }
.prod-card-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .page-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .mobile-header { display: flex; }
  .topbar { display: none; }
  .page-body { padding: 1.25rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { padding: 1rem 1.1rem; }
  .stat-value { font-size: 1.35rem; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .order-info-grid { grid-template-columns: 1fr; }

  /* Ürünler: tablo gizle, kart listesi göster */
  .prod-table-wrap { display: none; }
  .prod-card-list  { display: block; }

  /* Ürün form: sağ panel alta al */
  .urun-form-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-wrap { min-width: unset; }
  .status-tabs { font-size: .77rem; }
  .status-tab { padding: .5rem .75rem; }
}
