/* ============================================================
   SietchHub – Haupt-Stylesheet
   Dune: Awakening Guild Management
   ============================================================ */

/* ------------------------------------------------------------
   CSS Variablen – Farben & Tokens
   ------------------------------------------------------------ */
:root {
  /* Sand-Palette */
  --sand-50:  #FAF3E0;
  --sand-100: #F5EDD6;
  --sand-200: #E8D5A3;
  --sand-300: #D4B97A;
  --sand-400: #C8A951;
  --sand-500: #B8941A;
  --sand-600: #8B6914;
  --sand-700: #5a3e00;
  --sand-800: #2e1f00;
  --sand-900: #1a1200;

  /* Spice (Akzent) */
  --spice-100: #FAECE7;
  --spice-400: #D85A30;
  --spice-600: #993C1D;
  --spice-800: #712B13;

  /* Nacht (Sidebar) */
  --night-100: #2e2820;
  --night-200: #2a2318;
  --night-300: #1e1a14;
  --night-400: #161210;

  /* Status */
  --color-online:  #1D9E75;
  --color-warning: #D85A30;
  --color-offline: #888780;
  --color-info:    #378ADD;

  /* Abstände */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Übergänge */
  --transition: 0.15s ease;
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--sand-800);
  background: var(--sand-200);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--sand-600); text-decoration: none; }
a:hover { color: var(--sand-400); }

img { max-width: 100%; display: block; }

/* ------------------------------------------------------------
   Layout – Sidebar + Main
   ------------------------------------------------------------ */
.sh-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sh-sidebar {
  width: 220px;
  background: var(--night-300);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

/* Topbar */
.sh-topbar {
  background: var(--sand-300);
  border-bottom: 1px solid var(--sand-400);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sh-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--sand-800);
  flex: 1;
}

/* Content */
.sh-content {
  padding: 24px;
  flex: 1;
}

/* ------------------------------------------------------------
   Sidebar Navigation
   ------------------------------------------------------------ */
.sh-logo {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--night-100);
}

.sh-logo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--sand-400);
  letter-spacing: 0.5px;
}

.sh-logo-sub {
  font-size: 11px;
  color: #6b5f47;
  margin-top: 2px;
}

.sh-nav { padding: 12px 8px; flex: 1; }

.sh-nav-section {
  font-size: 10px;
  color: #4a4030;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 10px;
  margin: 16px 0 6px;
}

.sh-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: #8a7a60;
  cursor: pointer;
  margin-bottom: 2px;
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.sh-nav-item i { font-size: 16px; flex-shrink: 0; }

.sh-nav-item:hover {
  background: var(--night-200);
  color: var(--sand-400);
}

.sh-nav-item.active {
  background: var(--night-100);
  color: var(--sand-400);
}

.sh-nav-badge {
  margin-left: auto;
  background: var(--spice-400);
  color: #fff;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
}

/* User-Bereich unten */
.sh-sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--night-100);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ------------------------------------------------------------
   Avatar
   ------------------------------------------------------------ */
.sh-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sand-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--night-300);
  flex-shrink: 0;
  overflow: hidden;
}

.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sh-avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
  border-radius: 12px;
}

/* ------------------------------------------------------------
   Stat-Cards (Dashboard)
   ------------------------------------------------------------ */
.sh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.sh-stat {
  background: var(--sand-100);
  border: 1px solid var(--sand-300);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.sh-stat-label {
  font-size: 12px;
  color: var(--sand-600);
  margin-bottom: 8px;
}

.sh-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--sand-800);
  line-height: 1;
}

.sh-stat-value.accent { color: var(--sand-600); }
.sh-stat-value.danger { color: var(--spice-600); }

.sh-stat-sub {
  font-size: 11px;
  color: var(--sand-500);
  margin-top: 6px;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.sh-card {
  background: var(--sand-100);
  border: 1px solid var(--sand-300);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.sh-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sand-200);
}

.sh-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sand-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sh-card-action {
  font-size: 12px;
  color: var(--sand-600);
  cursor: pointer;
  transition: color var(--transition);
}

.sh-card-action:hover { color: var(--sand-400); }

/* Grid für Cards */
.sh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

/* ------------------------------------------------------------
   Tabellen
   ------------------------------------------------------------ */
.sh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sh-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sand-600);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--sand-300);
  background: var(--sand-200);
}

.sh-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sand-200);
  color: var(--sand-800);
  vertical-align: middle;
}

.sh-table tr:last-child td { border-bottom: none; }
.sh-table tr:hover td { background: var(--sand-200); }

/* ------------------------------------------------------------
   Badges & Pills
   ------------------------------------------------------------ */
.sh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.sh-badge-leader    { background: var(--sand-300); color: var(--sand-700); }
.sh-badge-officer   { background: #EEEDFE; color: #3C3489; }
.sh-badge-member    { background: var(--sand-100); color: var(--sand-600); }
.sh-badge-rekrut    { background: #E1F5EE; color: #085041; }
.sh-badge-reservist { background: #F1EFE8; color: #5F5E5A; }

.sh-badge-online  { background: #E1F5EE; color: #085041; }
.sh-badge-warning { background: var(--spice-100); color: var(--spice-800); }
.sh-badge-offline { background: #F1EFE8; color: #5F5E5A; }

.sh-badge-g1 { background: var(--sand-200); color: var(--sand-700); }
.sh-badge-g2 { background: #E1F5EE; color: #085041; }

/* Status-Dot */
.sh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.sh-dot-online  { background: var(--color-online); }
.sh-dot-warning { background: var(--color-warning); }
.sh-dot-offline { background: var(--color-offline); }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--sand-400);
  color: var(--night-300);
}
.btn-primary:hover { background: var(--sand-500); color: var(--night-300); }

.btn-danger {
  background: var(--spice-400);
  color: #fff;
}
.btn-danger:hover { background: var(--spice-600); }

.btn-secondary {
  background: var(--sand-200);
  color: var(--sand-700);
  border: 1px solid var(--sand-300);
}
.btn-secondary:hover { background: var(--sand-300); }

.btn-discord {
  background: #5865F2;
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
}
.btn-discord:hover { background: #4752C4; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ------------------------------------------------------------
   Formulare
   ------------------------------------------------------------ */
.sh-form-group { margin-bottom: 16px; }

.sh-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sand-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sh-input,
.sh-select,
.sh-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--sand-300);
  border-radius: var(--radius-md);
  background: var(--sand-50);
  color: var(--sand-800);
  font-size: 13px;
  transition: border-color var(--transition);
  font-family: inherit;
}

.sh-input:focus,
.sh-select:focus,
.sh-textarea:focus {
  outline: none;
  border-color: var(--sand-400);
  background: #fff;
}

.sh-textarea { min-height: 100px; resize: vertical; }

/* ------------------------------------------------------------
   Timer-Anzeige (Strom-Timer)
   ------------------------------------------------------------ */
.sh-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.sh-timer.critical { color: var(--spice-600); }
.sh-timer.warning  { color: #B8941A; }
.sh-timer.ok       { color: var(--color-online); }

.sh-timer-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--sand-200);
  overflow: hidden;
  flex: 1;
}

.sh-timer-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s linear;
}

.sh-timer-fill.ok       { background: var(--color-online); }
.sh-timer-fill.warning  { background: #C8A951; }
.sh-timer-fill.critical { background: var(--spice-400); }

/* ------------------------------------------------------------
   Öffentliche Gildenseite
   ------------------------------------------------------------ */
.gp-banner {
  background: var(--night-300);
  min-height: 160px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}

.gp-body {
  background: var(--sand-200);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  padding: 24px;
}

/* ------------------------------------------------------------
   Alerts & Meldungen
   ------------------------------------------------------------ */
.sh-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid;
  border-radius: 0;
}

.sh-alert-success {
  background: #E1F5EE;
  color: #085041;
  border-color: var(--color-online);
}

.sh-alert-warning {
  background: var(--sand-100);
  color: var(--sand-700);
  border-color: var(--sand-400);
}

.sh-alert-danger {
  background: var(--spice-100);
  color: var(--spice-800);
  border-color: var(--spice-400);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .sh-sidebar { display: none; }
  .sh-content { padding: 16px; }
  .sh-stats { grid-template-columns: 1fr 1fr; }
  .sh-grid  { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   Utility
   ------------------------------------------------------------ */
.text-muted  { color: var(--sand-500); }
.text-danger { color: var(--spice-600); }
.text-success{ color: var(--color-online); }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.w-full      { width: 100%; }
