/* ============================================================
   InsightTool – Custom Stylesheet
   Bootstrap 5.3 ergänzt
   ============================================================ */

/* ── Variablen ────────────────────────────────────────────── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1a2340;
  --sidebar-text: #b8c4de;
  --sidebar-active-bg: rgba(255,255,255,.1);
  --sidebar-active-text: #ffffff;
  --sidebar-label-color: #5c6b8a;
  --topbar-height: 60px;
  --content-bg: #f0f3f9;
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  margin: 0;
  color: #2d3748;
}

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

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform .3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.2rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand i { font-size: 1.3rem; color: #6ea8fe; flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  padding: .75rem .75rem 0;
}

.sidebar-label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-label-color);
  padding: 1rem .5rem .3rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: .4rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .9rem;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-link:hover { background: var(--sidebar-active-bg); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.sidebar-link--danger { color: #f28b82 !important; }
.sidebar-link--danger:hover { background: rgba(242,139,130,.15) !important; color: #ffb4ab !important; }

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.sidebar-footer .sidebar-link { font-size: .85rem; }

/* Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  opacity: 0;
  transition: opacity .3s;
}

/* ── Main Wrapper ─────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: .35rem;
  display: none; /* shown on mobile */
}
.sidebar-toggle:hover { background: #f1f5f9; }
.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: .5rem; }

/* ── Content Area ─────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 1.75rem 2rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: .6rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #e8ecf3;
  font-weight: 600;
  border-radius: .6rem .6rem 0 0 !important;
  padding: .85rem 1.25rem;
}

/* ── Stat Cards (Dashboard) ───────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: .6rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.green  { background: #f0fdf4; color: #22c55e; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.purple { background: #faf5ff; color: #a855f7; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: #1e293b; }
.stat-label { font-size: .8rem; color: #64748b; margin-top: .2rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table thead th { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #64748b; border-bottom-width: 1px; }
.table td { vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }

/* DataTables overrides */
div.dataTables_wrapper div.dataTables_filter input { border-radius: .4rem; }
div.dataTables_wrapper div.dataTables_length select { border-radius: .4rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge-field { font-size: .7rem; font-weight: 500; }

/* ── Forms ────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: .9rem; }
.form-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

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

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    box-shadow: none;
  }
  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.show { opacity: 1; pointer-events: all; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .content-area { padding: 1.25rem 1rem; }
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2340 0%, #2d3f6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 1rem;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo i { font-size: 2.5rem; color: #3b82f6; }
.login-logo h1 { font-size: 1.2rem; font-weight: 700; margin: .5rem 0 .2rem; color: #1e293b; }
.login-logo p { font-size: .85rem; color: #64748b; margin: 0; }

/* ── Event-Switcher (Topbar) ──────────────────────────────── */
.event-switcher { position: relative; }
.event-switcher-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  padding: .3rem .75rem;
  cursor: pointer;
  font-size: .88rem;
  color: #334155;
  transition: background .15s, border-color .15s;
  max-width: 260px;
}
.event-switcher-btn:hover { background: #e8edf5; border-color: #c4cdd9; }
.event-switcher-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.event-switcher-date {
  font-size: .72rem;
  background: #3b82f6;
  color: #fff;
  border-radius: .25rem;
  padding: .05rem .35rem;
  flex-shrink: 0;
}

/* ── Event-Label (Sidebar) ────────────────────────────────── */
.event-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #6ea8fe;
  padding: 1rem .5rem .3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--sidebar-width) - 1.5rem);
}

/* ── Sidebar No-Event Warning ─────────────────────────────── */
.sidebar-no-event {
  margin: .5rem .25rem;
  background: rgba(251, 146, 60, .15);
  border: 1px solid rgba(251, 146, 60, .4);
  border-radius: .4rem;
  padding: .6rem .75rem;
  font-size: .8rem;
  color: #fdba74;
  line-height: 1.4;
}
.sidebar-no-event a { color: #fed7aa; }
.sidebar-no-event a:hover { color: #fff; }

/* ── Event Cards (events/index.php) ──────────────────────── */
.event-card {
  border: 1px solid #e2e8f0;
  border-radius: .6rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, border-color .15s;
  background: #fff;
}
.event-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: #c4cdd9; }
.event-card--active {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
}
.event-card--active .card-header {
  background: linear-gradient(90deg, #f0fdf4 0%, #fff 100%);
  border-bottom-color: #bbf7d0;
}
