/* ============================================================
   Bluewave – Global Component Styles
   ============================================================ */
@import url('./variables.css');

/* ============================================================
   TYPOGRAFIE-SYSTEM
   ============================================================ */
.text-xs   { font-size: 0.72rem; }
.text-sm   { font-size: 0.85rem; }
.text-base { font-size: 0.9375rem; }
.text-lg   { font-size: 1.1rem; }
.text-xl   { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }

.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold    { font-weight: 700; }

.text-muted { color: var(--muted); }

.label-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.bw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

.bw-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bw-btn:active {
  transform: scale(0.97);
}

.bw-btn:disabled,
.bw-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.bw-btn-primary {
  background: var(--accent);
  color: #fff;
}

.bw-btn-primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Ghost */
.bw-btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--border);
}

.bw-btn-ghost:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}

/* Danger */
.bw-btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid rgba(225, 29, 72, 0.3);
}

.bw-btn-danger:hover {
  background: rgba(225, 29, 72, 0.1);
  border-color: rgba(225, 29, 72, 0.5);
}

/* Icon Button */
.bw-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.bw-btn-icon:hover {
  background: var(--surface-3);
  color: var(--fg);
}

.bw-btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bw-btn-icon svg {
  width: 18px;
  height: 18px;
}

/* Full width */
.bw-btn-full {
  width: 100%;
}

/* ============================================================
   FORM-ELEMENTE
   ============================================================ */
.bw-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.bw-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.bw-input,
.bw-textarea,
.bw-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  transition: all 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
}

.bw-input::placeholder,
.bw-textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.bw-input:focus,
.bw-textarea:focus,
.bw-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface-2);
}

.bw-input.error,
.bw-input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15) !important;
}

.bw-textarea {
  resize: vertical;
  min-height: 80px;
}

.bw-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Input-Wrapper mit Icon */
.bw-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.bw-input-wrapper .bw-input {
  padding-left: 40px;
}

.bw-input-wrapper .bw-input-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.bw-input-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.bw-input-hint.error {
  color: var(--danger);
}

/* Passwort-Stärke: 4 Bars */
.bw-pw-strength {
  margin-top: 8px;
}

.bw-pw-strength-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.bw-pw-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  transition: background 0.3s ease;
}

.bw-pw-strength-bar.active-1 { background: #e11d48; }
.bw-pw-strength-bar.active-2 { background: #f59e0b; }
.bw-pw-strength-bar.active-3 { background: #eab308; }
.bw-pw-strength-bar.active-4 { background: #22c55e; }

.bw-pw-strength-label {
  font-size: 0.75rem;
  color: var(--muted);
  transition: color 0.3s ease;
}

/* ============================================================
   AVATAR-KOMPONENTE
   ============================================================ */
.bw-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #fff;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

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

.bw-avatar-sm  { width: 28px;  height: 28px;  font-size: 0.65rem; }
.bw-avatar-md  { width: 36px;  height: 36px;  font-size: 0.8rem; }
.bw-avatar-lg  { width: 42px;  height: 42px;  font-size: 0.9rem; }
.bw-avatar-xl  { width: 60px;  height: 60px;  font-size: 1.2rem; }

/* Workspace-Avatar: abgerundet statt rund */
.bw-avatar-workspace {
  border-radius: var(--radius-md);
}

/* Avatar-Wrapper mit Status-Dot */
.bw-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.bw-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--surface-2);
  background: var(--offline);
}

.bw-status-dot[data-status="online"] {
  background: var(--online);
  box-shadow: 0 0 0 2px var(--online-glow);
  animation: livePulse 2.5s ease-in-out infinite;
}

.bw-status-dot[data-status="away"] {
  background: var(--away);
}

.bw-status-dot[data-status="offline"] {
  background: var(--offline);
}

/* ============================================================
   BADGE / PILL
   ============================================================ */
.bw-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  white-space: nowrap;
  line-height: 1;
}

.bw-badge-accent {
  background: var(--accent);
  color: #fff;
}

.bw-badge-muted {
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Status-Pill */
.bw-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.bw-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.bw-pill-online {
  background: rgba(34, 197, 94, 0.12);
  color: var(--online);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.bw-pill-online::before {
  background: var(--online);
}

.bw-pill-away {
  background: rgba(245, 158, 11, 0.12);
  color: var(--away);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.bw-pill-away::before {
  background: var(--away);
}

.bw-pill-offline {
  background: rgba(75, 85, 99, 0.15);
  color: var(--muted);
  border: 1px solid rgba(75, 85, 99, 0.3);
}

.bw-pill-offline::before {
  background: var(--offline);
}

/* ============================================================
   TOAST-SYSTEM
   ============================================================ */
#bw-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 48px);
}

.bw-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  min-width: 240px;
}

.bw-toast.hiding {
  animation: slideUp 0.2s ease reverse forwards;
}

.bw-toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.bw-toast-content {
  flex: 1;
}

.bw-toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.bw-toast-msg {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.bw-toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.18s ease;
  flex-shrink: 0;
  align-self: flex-start;
}

.bw-toast-close:hover {
  color: var(--fg);
}

.bw-toast-success { border-left: 3px solid var(--online); }
.bw-toast-success .bw-toast-icon { color: var(--online); }
.bw-toast-error   { border-left: 3px solid var(--danger); }
.bw-toast-error   .bw-toast-icon { color: var(--danger); }
.bw-toast-warning { border-left: 3px solid var(--away); }
.bw-toast-warning .bw-toast-icon { color: var(--away); }
.bw-toast-info    { border-left: 3px solid var(--accent); }
.bw-toast-info    .bw-toast-icon { color: var(--accent); }

/* ============================================================
   MODAL-SYSTEM
   ============================================================ */
.bw-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.18s ease;
}

.bw-modal-overlay.hidden {
  display: none !important;
}

.bw-modal {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 480px;
  width: 90%;
  overflow: hidden;
}

.bw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.bw-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
}

.bw-modal-body {
  padding: 20px 24px;
}

.bw-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TYPING-INDICATOR
   ============================================================ */
.bw-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
}

.bw-typing-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 4px;
}

.bw-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--muted);
}

.bw-typing-dot:nth-child(1) { animation: typingBounce 1.4s infinite; animation-delay: 0s; }
.bw-typing-dot:nth-child(2) { animation: typingBounce 1.4s infinite; animation-delay: 0.2s; }
.bw-typing-dot:nth-child(3) { animation: typingBounce 1.4s infinite; animation-delay: 0.4s; }

/* ============================================================
   AUTH-SEITEN
   ============================================================ */
.bw-auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.bw-auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(108, 99, 255, 0.15) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(159, 153, 255, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 85% 20%, rgba(108, 99, 255, 0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Floating Wave-Shapes im Hintergrund */
.bw-auth-wave-shape {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
}

.bw-auth-wave-shape-1 {
  bottom: -20px;
  left: -60px;
  width: 500px;
  animation: waveFloat 8s ease-in-out infinite;
}

.bw-auth-wave-shape-2 {
  top: -30px;
  right: -40px;
  width: 400px;
  animation: waveFloat 10s ease-in-out infinite reverse;
}

.bw-auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: color-mix(in oklab, var(--surface-2) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Card-Header mit Theme-Toggle */
.bw-auth-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.bw-auth-logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bw-auth-heading {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.bw-auth-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 24px;
}

/* Dark/Light-Mode Toggle */
.bw-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.bw-theme-toggle:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

/* Divider */
.bw-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.bw-divider::before,
.bw-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Fehler-Box */
#auth-error,
.bw-auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #fca5a5;
  font-size: 0.875rem;
  margin-bottom: 16px;
  animation: slideUp 0.2s ease;
}

/* Gast-Info-Banner */
.bw-guest-info {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--accent) 10%, var(--surface-3));
  border-left: 3px solid var(--accent);
  color: var(--fg);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Passwort vergessen */
.bw-forgot-link {
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.18s ease;
  align-self: flex-end;
}

.bw-forgot-link:hover {
  color: var(--accent);
}

/* ============================================================
   SPINNER
   ============================================================ */
.bw-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: var(--radius-full);
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

.bw-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .bw-auth-card {
    padding: 28px 20px;
    border-radius: var(--radius-md);
  }

  .bw-modal {
    max-width: 100%;
    border-radius: var(--radius-md);
    width: 95%;
  }

  #bw-toast-container {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

@media (max-width: 480px) {
  .bw-auth-card {
    padding: 24px 16px;
  }
}
