/* =====================================================
   Portal UI Design System — exakte Tokens aus colors_and_type.css
   ===================================================== */

/* ---------- Light (default) ---------- */
:root {
  /* Page */
  --page-bg:        linear-gradient(135deg, #ece9f7 0%, #dbe4ff 100%);
  --cover-gradient: linear-gradient(135deg, #667eea 0%, #f64f59 50%, #c471ed 100%);

  /* Glass card (profile) */
  --card-bg:        rgba(255, 255, 255, 0.85);
  --card-border:    rgba(255, 255, 255, 0.6);
  --card-shadow:    0 8px 32px rgba(0, 0, 0, 0.2);
  --card-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(255,255,255,0.05);

  /* Glass surface (header / footer / icon buttons) */
  --glass-bg:       rgba(255, 255, 255, 0.15);
  --glass-border:   rgba(255, 255, 255, 0.3);

  /* Text */
  --text:           #1a1a2e;
  --text-muted:     #6b7280;

  /* Inputs */
  --input-bg:       rgba(255, 255, 255, 0.2);

  /* Buttons */
  --btn-submit-bg:  rgba(255, 255, 255, 0.9);
  --btn-submit-text:#764ba2;
  --ghost-hover:    rgba(0, 0, 0, 0.05);

  /* Role badges */
  --badge-bg:       rgba(102, 126, 234, 0.1);
  --badge-text:     #4f46e5;
  --badge-border:   rgba(102, 126, 234, 0.3);

  /* Stats */
  --stat-bg:        rgba(255, 255, 255, 0.7);
  --divider:        rgba(0, 0, 0, 0.06);

  /* Avatar */
  --avatar-ring:    linear-gradient(135deg, #667eea, #c471ed);
  --avatar-bg:      linear-gradient(135deg, #764ba2, #667eea);

  /* Error */
  --color-error:    #ff6b6b;
}

/* ---------- Dark ---------- */
[data-theme="dark"] {
  --page-bg:        linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 100%);
  --cover-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);

  --card-bg:        rgba(20, 20, 35, 0.88);
  --card-border:    rgba(255, 255, 255, 0.08);

  --glass-bg:       rgba(22, 27, 34, 0.8);
  --glass-border:   rgba(48, 54, 61, 0.8);

  --text:           #f0f0f8;
  --text-muted:     #8b92a5;

  --input-bg:       rgba(22, 27, 34, 0.6);
  --btn-submit-bg:  #238636;
  --btn-submit-text:#ffffff;
  --ghost-hover:    rgba(255, 255, 255, 0.07);

  --badge-bg:       rgba(102, 126, 234, 0.15);
  --badge-text:     #a5b4fc;
  --badge-border:   rgba(102, 126, 234, 0.25);

  --stat-bg:        rgba(255, 255, 255, 0.04);
  --divider:        rgba(255, 255, 255, 0.06);
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  color: var(--text);
  transition: background 0.4s;
}

/* =====================================================
   Header
   ===================================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #c471ed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.logo-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.btn-icon:hover { background: var(--ghost-hover); transform: scale(1.1); }

.btn-logout {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239,68,68,0.3); transform: translateY(-1px); }

/* =====================================================
   Main content
   ===================================================== */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 60px;
}

/* =====================================================
   Footer
   ===================================================== */
.site-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--card-border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--text); }

/* =====================================================
   Login Card
   ===================================================== */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--card-shadow);
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

h1 {
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.btn-keycloak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-keycloak:hover { background: #357abd; transform: translateY(-1px); }

.error {
  color: var(--color-error);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

/* =====================================================
   Profile Card
   ===================================================== */
.profile-card {
  width: 360px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow-lg);
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.profile-cover {
  height: 110px;
  background: var(--cover-gradient);
  position: relative;
}

.cover-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 25% 50%, white 1px, transparent 1px),
    radial-gradient(circle at 75% 25%, white 1px, transparent 1px),
    radial-gradient(circle at 55% 75%, white 1px, transparent 1px);
  background-size: 36px 36px;
}

.avatar-wrap {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
}

.avatar-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  padding: 3px;
  background: var(--avatar-ring);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--avatar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  border: 3px solid var(--card-bg);
}

.profile-body {
  padding: 52px 28px 28px;
  text-align: center;
}

.profile-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.profile-username {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.roles-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  transition: transform 0.15s, box-shadow 0.15s;
}
.role-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--divider);
  border-radius: 14px;
  overflow: hidden;
}

.stat-cell {
  background: var(--stat-bg);
  padding: 14px 8px;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
