/* Bruchma shared design system + shared components.
   Loaded on the admin, client, auth, and simple frontends via /shared/shared.css.
   All project colors, spacing, radius, and shadow tokens live here in :root so
   page-specific stylesheets reference them with var(--...). */

:root {
  /* Palette */
  --color-dark: #1a1a2e;
  --color-dark-light: #242442;
  --color-primary: #0f3460;
  --color-accent: #4ecdc4;
  --color-bg: #f0f2f5;
  --color-surface: #ffffff;
  --color-border: #e0e0e0;
  --color-border-soft: #f0f0f0;
  --color-text: #333333;
  --color-text-muted: #888888;
  --color-text-faint: #aaa;
  --color-text-light: #efefef;

  /* Semantic */
  --color-success: #27ae60;
  --color-success-dark: #219a52;
  --color-danger: #e74c3c;
  --color-danger-dark: #c0392b;
  --color-secondary: #95a5a6;
  --color-secondary-dark: #7f8c8d;
  --color-warning: #f39c12;
  --color-warning-dark: #d68910;

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 60px;

  /* Shape */
  --radius: 6px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* Elevation */
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.3);

  /* Motion */
  --transition: 0.2s ease;

  /* Breakpoints */
  --bp-tablet: 768px;
  --bp-phone: 480px;
}

/* --- Accessibility: visible focus ring (keyboard users) --- */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.sidebar :focus-visible,
.view-sidebar :focus-visible {
  outline-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* --- Toasts --- */
.bruchma-toast-region {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}
.bruchma-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-dark);
  color: #fff;
  box-shadow: var(--shadow-modal);
  font-size: 0.9rem;
  line-height: 1.4;
  animation: toast-in 0.25s ease;
}
.bruchma-toast.bruchma-toast-success {
  border-left: 4px solid var(--color-success);
}
.bruchma-toast.bruchma-toast-error {
  border-left: 4px solid var(--color-danger);
}
.bruchma-toast.bruchma-toast-warning {
  border-left: 4px solid var(--color-warning);
}
.bruchma-toast.bruchma-toast-info {
  border-left: 4px solid var(--color-accent);
}
.bruchma-toast-leave {
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.bruchma-toast-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 2px;
}
.bruchma-toast-dismiss:hover {
  color: #fff;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Spinner --- */
.bruchma-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: -0.15em;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Button loading state --- */
.btn.bruchma-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* --- Upload progress --- */
.bruchma-progress {
  margin-top: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--color-border-soft);
  overflow: hidden;
  display: none;
}
.bruchma-progress.active {
  display: block;
}
.bruchma-progress-bar {
  height: 100%;
  width: 0;
  background: var(--color-primary);
  transition: width 0.2s ease;
}
.bruchma-progress-label {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* --- Error page shared styles (used by /pages error + generated error.html) --- */
.bruchma-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--color-text);
  padding: 24px;
}
.bruchma-error-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  padding: 40px 44px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.bruchma-error-code {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: 12px;
}
.bruchma-error-title {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--color-dark);
}
.bruchma-error-message {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* --- Form validation fallback (used by simple + auth pages) --- */
.field-error {
  color: var(--color-danger);
  font-size: 0.82rem;
  margin-top: 4px;
}

/* --- Basic button (standalone pages: error.html, auth page) --- */
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-dark);
}

/* --- Responsive helpers (applied on top of page-specific CSS) --- */
@media (max-width: 768px) {
  .bruchma-toast-region {
    top: 8px;
    right: 8px;
  }
}
