/* ============================================================
   teamsphere – app.css
   Alle Styles für Login, App-Layout, Komponenten
   ============================================================ */

/* ── Variablen ───────────────────────────────────────────── */
:root {
  --primary:        #0066FF;
  --primary-dark:   #0052CC;
  --primary-light:  #EBF2FF;
  --green:          #00A36C;
  --green-light:    #E6F7F1;
  --orange:         #F59E0B;
  --orange-light:   #FEF3C7;
  --red:            #EF4444;
  --red-light:      #FEE2E2;
  --purple:         #7C3AED;
  --purple-light:   #EDE9FE;
  --bg:             #F4F6FA;
  --surface:        #FFFFFF;
  --border:         #E4E8F0;
  --border2:        #CDD3DF;
  --text:           #1A2340;
  --text2:          #6B7A99;
  --text3:          #9BA8BF;
  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06);
  --shadow:         0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.12);
  --sidebar-w:      248px;
  --topbar-h:       58px;
  --transition:     .15s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── App Layout ──────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo-mark {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -.4px;
  color: var(--text);
}
.sidebar-logo-text strong { font-weight: 700; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-group { margin-bottom: 4px; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 20px;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-icon { font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.sidebar-user-card:hover { background: var(--bg); text-decoration: none; }
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11.5px; color: var(--text3); }
.sidebar-user-chevron { color: var(--text3); font-size: 18px; margin-left: auto; }
.sidebar-logout-btn {
  width: 100%;
  padding: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.sidebar-logout-btn:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.topbar-menu-btn span { display: block; width: 20px; height: 2px; background: var(--text2); border-radius: 2px; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg); }
.notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.topbar-profile { border-radius: 50%; }

/* Benachrichtigungs-Dropdown */
.notif-wrap { position: relative; }
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}
.notif-dropdown.open { display: block; }
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.notif-read-all { background: none; border: none; color: var(--primary); font-size: 12px; cursor: pointer; font-family: inherit; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-light); }
.notif-item-title { font-size: 13px; font-weight: 600; }
.notif-item-msg { font-size: 12px; color: var(--text2); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--text3); margin-top: 4px; }
.notif-loading { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }
.notif-empty { padding: 32px; text-align: center; color: var(--text3); font-size: 13px; }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-logo-mark {
  width: 46px;
  height: 46px;
  background: var(--primary);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo-text {
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -.5px;
  color: var(--text);
}
.login-logo-text strong { font-weight: 800; }
.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-card-header { margin-bottom: 24px; }
.login-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.login-subtitle { font-size: 13.5px; color: var(--text2); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer { font-size: 12px; color: var(--text3); text-align: center; }
.login-footer a { color: var(--text3); }
.login-footer a:hover { color: var(--text2); }

/* ── Formulare ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.form-label-link { font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.form-control {
  padding: 10px 13px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  background: white;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-control.is-error { border-color: var(--red); }
.form-control.is-error:focus { box-shadow: 0 0 0 3px var(--red-light); }
.form-control::placeholder { color: var(--text3); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%236B7A99'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 42px; }
.input-password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text3); padding: 4px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline  { background: white; color: var(--text); border: 1px solid var(--border2); }
.btn-outline:hover { background: var(--bg); text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.btn-danger   { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fca5a5; text-decoration: none; }
.btn-success  { background: var(--green); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Alerts / Flash ──────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: var(--red-light);    color: #9B1C1C; border: 1px solid #FCA5A5; }
.alert-warning { background: var(--orange-light);  color: #92400E; border: 1px solid #FCD34D; }
.alert-success { background: var(--green-light);   color: #065F46; border: 1px solid #6EE7B7; }
.flash { margin-bottom: 16px; }
.flash-success { @extend .alert; @extend .alert-success; }
.flash-error   { @extend .alert; @extend .alert-error; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ── Tabellen ────────────────────────────────────────────── */
.table-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; background: white; }
thead { background: var(--bg); }
th { padding: 10px 16px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfe; }

/* ── Badges / Pills ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-green  { background: var(--green-light); color: var(--green); }
.badge-red    { background: var(--red-light); color: var(--red); }
.badge-orange { background: var(--orange-light); color: #92400E; }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray   { background: var(--bg); color: var(--text2); }

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── Fehlerseiten ────────────────────────────────────────── */
.error-page { text-align: center; padding: 80px 24px; }
.error-code { font-size: 96px; font-weight: 800; color: var(--border2); letter-spacing: -4px; }
.error-title { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.error-message { color: var(--text2); margin-bottom: 28px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: slideInToast .25s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--orange); }
@keyframes slideInToast {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    width: var(--sidebar-w);
    z-index: 100;
    transition: left .25s ease;
    height: 100dvh;
  }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .topbar-menu-btn { display: flex; }
  .app-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
