/* =============================================================
   Admin Panel — Meşe Mobilya (TailAdmin inspired)
   Temiz, modern, koyu sidebar + beyaz içerik alanı
   ============================================================= */

:root {
  --gold:        #dac477;
  --gold-dim:    rgba(218,196,119,0.12);
  --bg:          #f1f5f9;
  --panel:       #ffffff;
  --sidebar-bg:  #0f172a;
  --sidebar-bdr: rgba(255,255,255,0.07);
  --line:        #e2e8f0;
  --muted:       #64748b;
  --text:        #1e293b;
  --text-xs:     #475569;
  --green:       #16a34a;
  --red:         #dc2626;
  --amber:       #d97706;
  --blue:        #2563eb;
  --sh-sm:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.06);
  --sh:          0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --sh-lg:       0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
  --r:           12px;
  --r-sm:        8px;
  --serif:       "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ─── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
  border: 1px solid rgba(218,196,119,.3);
}
.login-logo {
  width: 80px; height: 80px; margin: 0 auto 20px;
  background: #0f172a; border: 2px solid var(--gold);
  border-radius: 20px; display: grid; place-items: center; overflow: hidden;
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-card h1 {
  font-family: var(--serif); font-size: 26px;
  text-align: center; margin: 0 0 6px; color: var(--text);
}
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 28px; font-size: 13px; }

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

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sidebar-bdr);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; gap: 12px; align-items: center;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-bdr);
}
.sidebar-brand img {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1.5px solid var(--gold); object-fit: cover;
}
.sidebar-brand span {
  font-family: var(--serif); font-size: 17px;
  color: #f8fafc; letter-spacing: -.01em;
}

.sidebar-nav { padding: 14px 12px; flex: 1; }
.sidebar-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: .14em;
  color: rgba(255,255,255,.28); padding: 0 10px;
  margin: 20px 0 6px; font-weight: 600;
}
.sidebar-section:first-child { margin-top: 4px; }

.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.52); font-size: 13.5px; font-weight: 500;
  transition: all .15s ease; margin-bottom: 2px;
}
.sidebar a:hover {
  background: rgba(255,255,255,.07); color: rgba(255,255,255,.82);
}
.sidebar a.active {
  background: rgba(218,196,119,.14); color: var(--gold);
}
.sidebar a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; }
.sidebar a.active svg { opacity: 1; }
.sidebar a span { flex: 1; }

.sidebar .spacer { flex: 1; }
.sidebar-foot-area {
  padding: 12px;
  border-top: 1px solid var(--sidebar-bdr);
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: rgba(255,255,255,.45); font-size: 13px; font-weight: 500;
  transition: all .15s ease; margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.8); }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.sidebar-foot {
  font-size: 11px; color: rgba(255,255,255,.22);
  text-align: center; padding: 6px 0 0;
}

/* ─── Main area ──────────────────────────────────────────── */
.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar-admin {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.topbar-admin h1 {
  font-family: var(--serif); font-size: 22px; margin: 0;
  letter-spacing: -.02em; font-weight: 400;
}
.topbar-admin .user {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.topbar-admin .user a { color: var(--red); }

/* ─── Page content padding ───────────────────────────────── */
.page-content { padding: 24px 28px 60px; }

/* ─── Quick actions ──────────────────────────────────────── */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.qa-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm);
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; color: var(--text);
  position: relative; transition: all .15s ease;
  box-shadow: var(--sh-sm);
}
.qa-btn:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(218,196,119,.12), var(--sh-sm);
}
.qa-btn svg { color: var(--muted); flex-shrink: 0; }
.qa-badge {
  position: absolute; top: -7px; right: -7px;
  min-width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--panel);
}

/* ─── Dashboard grid ─────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

/* ─── Stat cards ─────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px;
  display: flex; gap: 16px; align-items: flex-start;
  box-shadow: var(--sh-sm); transition: box-shadow .15s;
}
.stat:hover { box-shadow: var(--sh); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat .lbl {
  font-size: 11px; text-transform: uppercase; color: var(--muted);
  letter-spacing: .1em; margin: 0 0 4px; font-weight: 600;
}
.stat .val {
  font-family: var(--serif); font-size: 32px;
  line-height: 1; margin: 0; color: var(--text);
}
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-warn {
  border-color: rgba(220,38,38,.2);
  background: linear-gradient(135deg, #fff, rgba(220,38,38,.03));
}

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 20px; overflow: hidden;
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h2 {
  font-family: var(--serif); font-size: 17px; margin: 0; font-weight: 400;
}
.card-body { padding: 20px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--panel); color: var(--text);
  text-decoration: none; transition: all .15s ease;
  white-space: nowrap; flex-shrink: 0;
}
.btn:hover { border-color: var(--gold); background: #fdfaf3; }
.btn-primary {
  background: #0f172a; color: var(--gold);
  border-color: rgba(218,196,119,.4);
}
.btn-primary:hover { background: #1e293b; border-color: var(--gold); }
.btn-danger { color: var(--red); border-color: rgba(220,38,38,.3); }
.btn-danger:hover { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.5); }
.btn-success { background: var(--green); color: #fff; border-color: transparent; }
.btn-success:hover { background: #15803d; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 7px; }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn svg { flex-shrink: 0; }

/* ─── Tables ─────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table.tbl {
  width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 600px;
}
table.tbl th, table.tbl td {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
table.tbl th {
  background: #f8fafc; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #f8fafc; }
table.tbl img.thumb {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: #f1f5f9;
}
.actions-cell { display: flex; gap: 6px; align-items: center; }
.actions-cell form { display: contents; }

.empty { padding: 64px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0; font-size: 14px; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px;
}
.form-grid .full { grid-column: 1 / -1; }
.field-a { display: flex; flex-direction: column; gap: 6px; }
.field-a label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
}
.field-a input[type="text"],
.field-a input[type="email"],
.field-a input[type="tel"],
.field-a input[type="number"],
.field-a input[type="password"],
.field-a input[type="url"],
.field-a select,
.field-a textarea {
  width: 100%; padding: 10px 13px; height: 42px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font-size: 13.5px; font-family: inherit;
  color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.field-a textarea { height: auto; min-height: 100px; resize: vertical; padding: 12px 13px; }
.field-a input:focus, .field-a select:focus, .field-a textarea:focus {
  border-color: var(--gold); outline: none;
  box-shadow: 0 0 0 3px rgba(218,196,119,.2);
}
.field-a .hint { font-size: 11.5px; color: var(--muted); margin: 0; line-height: 1.4; }

.checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; cursor: pointer; padding: 6px 0;
}
.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: #0f172a;
  border-radius: 4px; cursor: pointer;
}

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 18px 20px; background: #f8fafc; border-top: 1px solid var(--line);
}

/* ─── Image preview ──────────────────────────────────────── */
.img-preview {
  display: inline-block; padding: 6px;
  border: 1.5px dashed var(--line); border-radius: var(--r-sm); background: #f8fafc;
}
.img-preview img {
  width: 130px; height: 130px; object-fit: cover;
  border-radius: 6px; background: #e2e8f0;
}
.gallery-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.gallery-list .gi {
  position: relative; width: 92px; height: 92px;
  border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--line); background: #f1f5f9;
}
.gallery-list .gi img { width: 100%; height: 100%; object-fit: cover; }
.gallery-list .gi button.del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.gallery-list .gi button.del:hover { background: rgba(220,38,38,.85); }

/* ─── Color rows ─────────────────────────────────────────── */
.color-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.color-row input[type="text"] {
  flex: 1; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 13.5px; font-family: inherit;
}
.color-row input[type="color"] {
  width: 44px; height: 40px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}

/* ─── Dynamic spec rows ──────────────────────────────────── */
.spec-row {
  display: grid; grid-template-columns: 1fr 1.4fr auto;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.spec-row input {
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
.spec-row input:focus {
  border-color: var(--gold); outline: none;
  box-shadow: 0 0 0 3px rgba(218,196,119,.15);
}
.spec-row input::placeholder { color: #94a3b8; }

.spec-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--line);
  background: transparent; color: var(--muted);
  font-size: 13px; cursor: pointer; margin-top: 4px;
  transition: all .15s ease;
}
.spec-add-btn:hover { border-color: var(--gold); color: var(--text); background: var(--gold-dim); }

/* ─── Language tabs ──────────────────────────────────────── */
.lang-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px; overflow-x: auto;
}
.lang-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px; border: none; background: transparent;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s ease; white-space: nowrap;
  border-radius: var(--r-sm) var(--r-sm) 0 0; font-family: inherit;
}
.lang-tab:hover { color: var(--text); background: rgba(0,0,0,.04); }
.lang-tab.active { color: #0f172a; border-bottom-color: var(--gold); }
.lang-pane { display: none; }
.lang-pane.active { display: block; }

/* ─── Status chips ───────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--line); color: var(--text-xs);
}
.chip-success { background: rgba(22,163,74,.1); color: #15803d; }
.chip-warn    { background: rgba(217,119,6,.12); color: #b45309; }
.chip-info    { background: rgba(37,99,235,.1); color: var(--blue); }
.chip-danger  { background: rgba(220,38,38,.1); color: var(--red); }

/* ─── Flash messages ─────────────────────────────────────── */
.flash {
  margin: 0 0 18px; padding: 14px 16px;
  border-radius: var(--r-sm); font-size: 13.5px;
  border: 1px solid var(--line); border-left: 4px solid var(--gold);
  background: #fffbeb;
}
.flash-success { border-left-color: var(--green); background: #f0fdf4; border-color: rgba(22,163,74,.2); }
.flash-error   { border-left-color: var(--red);   background: #fef2f2; border-color: rgba(220,38,38,.2); }

/* ─── Select2 overrides ──────────────────────────────────── */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
  height: 42px; border: 1px solid var(--line);
  border-radius: var(--r-sm) !important;
  display: flex; align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px; padding: 0 13px; color: var(--text); font-size: 13.5px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px; right: 8px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(218,196,119,.2);
  outline: none;
}
.select2-dropdown {
  border: 1px solid var(--line) !important;
  border-radius: var(--r-sm) !important;
  box-shadow: var(--sh-lg) !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #0f172a;
}
.select2-container--default .select2-results__option--selected {
  background-color: rgba(218,196,119,.1); color: #0f172a;
}
.select2-results__option { font-size: 13.5px; padding: 9px 12px; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .admin-app { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--sidebar-bdr);
    padding: 10px 12px; height: auto; position: static;
    overflow-y: visible;
  }
  .sidebar-brand { width: 100%; padding: 8px 4px 10px; border: 0; }
  .sidebar-nav { padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar-section { display: none; }
  .sidebar a { padding: 8px 10px; font-size: 12.5px; margin-bottom: 0; }
  .sidebar .spacer, .sidebar-foot-area { display: none; }
  .page-content { padding: 16px 16px 48px; }
  .topbar-admin { padding: 12px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  table.tbl th, table.tbl td { padding: 10px 10px; font-size: 12.5px; }
  table.tbl img.thumb { width: 40px; height: 40px; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .spec-row { grid-template-columns: 1fr auto; }
  .spec-row input:first-child { grid-column: 1 / -1; }
}
