/* ============================================================
   ZUSAMMEN ADMIN — SHARED STYLES
   ============================================================ */
:root {
  --primary:   #1F3A6D;
  --accent:    #F7941D;
  --secondary: #8DC63F;
  --dark:      #0B1A2C;
  --danger:    #ef4444;
  --bg:        #F0F2F5;
  --card:      #ffffff;
  --border:    #E2E8F0;
  --text:      #1a202c;
  --muted:     #64748b;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logo h2 { color: var(--accent); font-size: 14px; font-weight: 800; letter-spacing: .8px; line-height: 1.2; }
.sidebar-logo p { color: #637080; font-size: 11px; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: #9BAABB;
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-nav a.active { color: var(--accent); background: rgba(247,148,29,.1); border-left-color: var(--accent); }
.sidebar-nav .icon { width: 18px; text-align: center; font-size: 15px; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 0; }

.sidebar-bottom { padding: 8px 0 24px; }

.section-label {
  display: block; padding: 10px 20px 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #445566;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ── HAMBURGER ─────────────────────────────────────────────── */
.hamburger {
  display: none; width: 36px; height: 36px;
  border: none; background: none;
  flex-direction: column; justify-content: center; gap: 5px; padding: 4px;
  border-radius: 8px;
}
.hamburger:hover { background: var(--bg); }
.hamburger span { display: block; height: 2px; width: 20px; background: var(--muted); border-radius: 2px; }

/* ── MAIN ──────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── STAT CARDS ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card); border-radius: 12px;
  padding: 22px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border-top: 3px solid var(--accent);
  display: flex; align-items: center; gap: 14px;
}
.stat-card.blue  { border-top-color: var(--primary); }
.stat-card.green { border-top-color: var(--secondary); }
.stat-card.red   { border-top-color: var(--danger); }

.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: rgba(247,148,29,.12); color: var(--accent);
}
.stat-card.blue  .stat-icon { background: rgba(31,58,109,.1);   color: var(--primary); }
.stat-card.green .stat-icon { background: rgba(141,198,63,.12); color: var(--secondary); }
.stat-card.red   .stat-icon { background: rgba(239,68,68,.1);   color: var(--danger); }

.stat-info h3 { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-info p  { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ── CARD ──────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  overflow: hidden; margin-bottom: 24px;
}
.card-header {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; font-weight: 600; }

/* ── TABLES ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  background: #F8FAFC; padding: 11px 16px;
  text-align: left; font-size: 11.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFD; }
.tr-link { cursor: pointer; }
.td-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 50px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-new         { background: #FFF3E0; color: #BF360C; }
.badge-in-progress { background: #E3F2FD; color: #0D47A1; }
.badge-replied     { background: #E8F5E9; color: #1B5E20; }
.badge-closed      { background: #ECEFF1; color: #455A64; }
.badge-active      { background: #E8F5E9; color: #1B5E20; }
.badge-inactive    { background: #ECEFF1; color: #455A64; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; border: none;
  cursor: pointer; transition: all .15s;
  white-space: nowrap; line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #163060; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: #E0840F; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-ghost   { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-ghost:hover   { background: var(--bg); border-color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 5px 8px; }
.btn-icon-danger { color: #ef4444; }
.btn-icon-danger:hover { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── FILTER BAR ────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 16px; border-radius: 50px;
  border: 1.5px solid var(--border); background: var(--card);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--muted); transition: all .15s;
}
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

label {
  display: block; font-size: 11.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 5px;
}

input[type=text], input[type=number], input[type=email],
input[type=password], input[type=date], input[type=url],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13.5px; color: var(--text);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,58,109,.1);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── SLIDE-IN PANEL ────────────────────────────────────────── */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.panel-overlay.open { opacity: 1; pointer-events: all; }

.panel {
  position: fixed; top: 0; right: -560px; bottom: 0;
  width: 560px; max-width: 100vw;
  background: var(--card); z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: -6px 0 32px rgba(0,0,0,.15);
  transition: right .3s cubic-bezier(.4,0,.2,1);
}
.panel.open { right: 0; }

.panel-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.panel-header h3 { font-size: 16px; font-weight: 600; }

.panel-body { flex: 1; overflow-y: auto; padding: 24px; }
.panel-section { margin-bottom: 20px; }
.panel-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--accent);
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.panel-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border-radius: 16px;
  width: 640px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: scale(.96); transition: transform .2s;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0;
}

/* ── DETAIL GRID ───────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.detail-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-top: 1px; }
.detail-value { font-size: 13.5px; }

/* ── CLOSE BUTTON ──────────────────────────────────────────── */
.close-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--bg); display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: var(--muted);
  cursor: pointer; transition: all .15s; line-height: 1;
}
.close-btn:hover { background: var(--border); color: var(--text); }

/* ── TOASTS ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 11px 16px; border-radius: 10px; min-width: 240px;
  font-size: 13.5px; font-weight: 500; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; animation: toastIn .25s ease;
}
.toast-success { background: #2e7d32; }
.toast-error   { background: #c62828; }
.toast-info    { background: var(--primary); }
@keyframes toastIn { from { opacity:0; transform:translateY(8px) scale(.95); } to { opacity:1; transform:none; } }

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 24px; color: var(--muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── SIDEBAR ICON ALIGNMENT ────────────────────────────────── */
.icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 14px; }

/* ── MISC ──────────────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.fw-600     { font-weight: 600; }
.gap-8      { gap: 8px; }
.d-flex     { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4  { margin-top: 4px; }
.mt-16 { margin-top: 16px; }
.mb-4  { margin-bottom: 4px; }
.p-20  { padding: 20px; }

/* loading */
.loading-row td { text-align: center; padding: 40px; color: var(--muted); font-style: italic; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: min(280px, 80vw); }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .topbar h1 { font-size: 15px; }
  .main { margin-left: 0; padding: 18px; }
  .hamburger { display: flex; }
  .panel { width: 100%; max-width: 100vw; right: -100vw; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── IMAGE INPUT COMPONENT ─────────────────────────────────────── */
.img-input-wrap {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.img-tabs {
  display: flex;
  border-bottom: 1.5px solid #e2e8f0;
  background: #f7f9fc;
}
.img-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
}
.img-tab.active {
  background: white;
  color: #1F3A6D;
  border-bottom: 2px solid #F7941D;
}
.img-tab-content { padding: 16px; }
.img-tab-panel { display: none; }
.img-tab-panel.active { display: block; }

.img-upload-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.img-upload-btn {
  background: #1F3A6D;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.img-upload-label:hover .img-upload-btn { background: #16305a; }
.img-upload-hint { font-size: 12px; color: #6b7280; }

.img-progress-wrap {
  margin-top: 10px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.img-progress {
  height: 100%;
  width: 0%;
  background: #F7941D;
  border-radius: 3px;
}

.img-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px;
  background: #f7f9fc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.img-preview-row img {
  max-width: 120px;
  max-height: 90px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
}
.img-clear-btn {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.img-clear-btn:hover { background: #dc2626; }
.img-no-preview { font-size: 12px; color: #aaa; margin-top: 10px; }

/* ── GALLERY ───────────────────────────────────────────────────── */
.gallery-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.gallery-add-row input[type=text] {
  flex: 1;
  min-width: 0;
}
.gallery-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.gallery-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gallery-empty {
  font-size: 12px;
  color: #aaa;
  margin: 4px 0 8px;
}
.gallery-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: #f7f9fc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.gallery-item img {
  width: 64px;
  height: 50px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}
.gallery-item-footer {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.gallery-item-url {
  flex: 1;
  font-size: 12px;
  color: #4a5568;
  word-break: break-all;
  min-width: 0;
}
.gallery-item-remove {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}
.gallery-item-remove:hover { background: #dc2626; }
