/* ============================================
   AUTH.CSS - Login / Signup & Purchase styles
   Matches main.css design system.
   ============================================ */

/* Skip to main content - visible on focus for keyboard/screen reader users */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 9999;
  padding: 12px 20px;
  background: var(--brand);
  color: white;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
}

/* Portal layout: top bar + side panel + content */
.auth-page.auth-portal-layout {
  flex-direction: column;
}

.auth-portal-topbar {
  position: relative;
  z-index: 1100;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.4) 0%, rgba(22, 33, 62, 0.4) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-portal-topbar .logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-portal-topbar .logo-section img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}

.auth-portal-topbar .logo-section .topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

@media (prefers-color-scheme: light) {
  .auth-portal-topbar .logo-section img {
    filter: brightness(0) saturate(100%);
  }
}

html.theme-light .auth-portal-topbar .logo-section img {
  filter: brightness(0) saturate(100%);
}

.auth-portal-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-portal-topbar .topbar-right a,
.auth-portal-topbar .topbar-right span {
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.auth-portal-topbar .topbar-right a:hover {
  color: var(--brand);
}

.auth-portal-topbar .topbar-refresh-btn {
  padding: 0;
  border: none;
  background: none;
  font-size: 1.1rem;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
}

.auth-portal-topbar .topbar-refresh-btn:hover {
  color: var(--brand);
  background: rgba(0, 0, 0, 0.06);
}

.auth-portal-topbar .auth-header-signout {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.auth-portal-topbar .auth-header-signout:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Email dropdown – click email to show Sign out */
.auth-header-email-dropdown {
  position: relative;
  display: none;
}

.auth-header-email-dropdown.visible {
  display: inline-block;
}

.auth-header-email-trigger {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.auth-header-email-trigger:hover {
  color: var(--brand);
}

.auth-header-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.auth-header-name {
  font-size: 14px;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-header-email-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 160px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  z-index: 1002;
  display: none;
  flex-direction: column;
}

.auth-header-email-menu[aria-hidden="false"] {
  display: flex;
}

.auth-header-email-menu .auth-header-signout,
.auth-header-email-menu .auth-header-menuitem,
.auth-header-email-menu [role="menuitem"] {
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  display: block;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
  font: inherit;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.auth-header-email-menu .auth-header-signout:hover,
.auth-header-email-menu .auth-header-menuitem:hover,
.auth-header-email-menu [role="menuitem"]:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--brand);
}

.auth-portal-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.auth-portal-sidebar {
  flex-shrink: 0;
  width: 220px;
  background: var(--card-bg);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (prefers-color-scheme: dark) {
  .auth-portal-sidebar {
    border-right-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .auth-portal-sidebar {
  border-right-color: rgba(255, 255, 255, 0.1);
}

.auth-portal-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-portal-sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-right: 8px;
  transition: background 0.15s, color 0.15s;
}

.auth-portal-sidebar nav a:hover {
  background: rgba(66, 133, 244, 0.1);
  color: var(--brand);
}

.auth-portal-sidebar nav a.auth-nav-current {
  background: rgba(66, 133, 244, 0.15);
  color: var(--brand);
  font-weight: 600;
}

.auth-portal-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px 48px;
}

.auth-portal-content .auth-main {
  padding: 0;
  max-width: 100%;
}

.auth-portal-layout .auth-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px 48px;
  max-width: 100%;
}

.auth-portal-layout .auth-portal-content .auth-card {
  max-width: 800px;
}

.auth-portal-layout .auth-portal-content .dashboard-card {
  max-width: 800px;
}

/* Hamburger toggle - visible only on mobile */
.auth-portal-sidebar-toggle {
  display: none;
  padding: 8px 12px;
  margin: 0 4px 0 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius);
}
.auth-portal-sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--brand);
}
.auth-portal-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1050;
}

@media (max-width: 768px) {
  .auth-portal-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .auth-portal-body {
    flex-direction: column;
  }

  .auth-portal-sidebar {
    width: 100%;
    flex-direction: row;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    overflow-x: auto;
  }

  .auth-portal-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .auth-portal-sidebar nav a {
    margin: 0;
    border-radius: var(--radius);
    white-space: nowrap;
  }

  /* Mobile: hide sidebar by default; show when open */
  .auth-portal-sidebar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1060;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }

  body.auth-portal-sidebar-open .auth-portal-sidebar {
    display: flex;
  }

  body.auth-portal-sidebar-open .auth-portal-sidebar-overlay {
    display: block;
  }
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 48px;
  padding-top: calc(60px + 32px);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: max-width 0.3s ease;
}

.auth-card.signup-mode {
  max-width: 800px;
}

@media (prefers-color-scheme: dark) {
  .auth-card {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .auth-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-card .auth-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form.signup-form .form-group {
  margin-bottom: 24px;
}

.auth-form .form-group:last-of-type {
  margin-bottom: 24px;
}

.auth-loading-status {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

.auth-loading-status[aria-hidden="true"] {
  display: none;
}

/* Login: full-card overlay when redirecting to dashboard */
.auth-redirect-overlay {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 20;
  padding: 32px;
}

.auth-redirect-overlay[aria-hidden="true"],
.auth-redirect-overlay[style*="display: none"] {
  display: none !important;
}

.auth-redirect-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(66, 133, 244, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: dashboard-spin 0.8s linear infinite;
}

.auth-redirect-message {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}

/* Two-column layout for signup form */
.auth-form.signup-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.auth-form.signup-form .form-row .form-group {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .auth-form.signup-form .form-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .auth-card.signup-mode {
    max-width: 420px;
  }
}

.auth-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 14px;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="tel"],
.auth-form input[type="number"],
.auth-form select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid #ddd;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

@media (prefers-color-scheme: dark) {
  .auth-form input[type="email"],
  .auth-form input[type="password"],
  .auth-form input[type="text"],
  .auth-form input[type="tel"],
  .auth-form input[type="number"],
  .auth-form select {
    border-color: #444;
  }
}

.auth-form input:focus,
.auth-form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.auth-form input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.auth-submit {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  background: var(--brand);
  color: white !important;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.auth-submit:hover:not(:disabled) {
  background: #3367d6;
  transform: translateY(-2px);
}

.auth-submit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.3);
}

.auth-submit:disabled {
  background: #999;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  margin-bottom: 16px;
  padding: 12px 16px;
  font-size: 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: #dc2626;
  display: none;
}

.auth-error--visible {
  display: block;
}

/* Don’t show invite message area when empty (avoids empty white box below Send invite) */
.auth-error--visible:empty,
#inviteAdminSuccess:empty {
  display: none !important;
}

.auth-toggle-wrap {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.auth-toggle-wrap a {
  color: var(--brand);
  font-weight: 500;
}

.auth-toggle-wrap a:hover {
  text-decoration: underline;
}

.forgot-form {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  .forgot-form {
    border-top-color: rgba(255, 255, 255, 0.1);
  }
}

.forgot-form--visible {
  display: block;
}

.forgot-form .form-group {
  margin-bottom: 16px;
}

.back-to-auth {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.back-to-auth:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Purchase page */
.purchase-card {
  max-width: 480px;
}

.purchase-card .auth-subtitle {
  margin-bottom: 24px;
}

.seat-select-wrap {
  margin-bottom: 24px;
}

.seat-select-wrap label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 14px;
}

.seat-slider {
  width: 100%;
  height: 8px;
  margin-bottom: 16px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  border-radius: 4px;
  outline: none;
  transition: background 0.2s;
}

@media (prefers-color-scheme: dark) {
  .seat-slider {
    background: #444;
  }
}

html.theme-dark .seat-slider {
  background: #444;
}

.seat-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.seat-slider::-webkit-slider-thumb:hover {
  background: #3367d6;
  transform: scale(1.1);
}

.seat-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.2s;
}

.seat-slider::-moz-range-thumb:hover {
  background: #3367d6;
  transform: scale(1.1);
}

.seat-slider:focus {
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.seat-slider:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

.seat-slider:active::-moz-range-thumb {
  transform: scale(1.15);
}

.seat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.seat-input-row input {
  width: 100%;
  max-width: 120px;
  text-align: center;
}

.seat-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  background: var(--card-bg);
  color: var(--text);
  border: 2px solid #ddd;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  user-select: none;
}

@media (prefers-color-scheme: dark) {
  .seat-btn {
    border-color: #444;
  }
}

html.theme-dark .seat-btn {
  border-color: #444;
}

.seat-btn:hover:not(:disabled) {
  background: rgba(66, 133, 244, 0.1);
  border-color: var(--brand);
  transform: scale(1.05);
}

.seat-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.seat-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.seat-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.seat-min-hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

@media (max-width: 640px) {
  .seat-input-row {
    gap: 6px;
  }
  
  .seat-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 20px;
  }
  
  .seat-input-row input {
    max-width: 100px;
  }
}

.purchase-user {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(66, 133, 244, 0.08);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--muted);
}

.purchase-user strong {
  color: var(--text);
}

.purchase-error {
  margin-bottom: 16px;
  padding: 12px 16px;
  font-size: 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: #dc2626;
  display: none;
}

.purchase-error--visible {
  display: block;
}

/* Dashboard page */
.dashboard-card {
  max-width: 960px;
}

/* Dashboard view uses full width for main + activity panel layout */
#view-dashboard {
  width: 100%;
  max-width: 100%;
}

/* Dashboard layout: main content + right activity panel */
.dashboard-layout {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
}

.dashboard-activity-panel {
  flex-shrink: 0;
  width: 320px;
  max-width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  transition: width 0.2s ease, min-width 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  .dashboard-activity-panel {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

.dashboard-activity-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.dashboard-activity-panel-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.dashboard-activity-panel-toggle {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 0.2s ease;
}

.dashboard-activity-panel-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--brand);
}

.dashboard-activity-panel.collapsed .dashboard-activity-panel-toggle {
  transform: rotate(180deg);
}

.dashboard-activity-panel-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dashboard-activity-panel.collapsed .dashboard-activity-panel-content {
  display: none;
}

.dashboard-activity-panel.collapsed {
  width: 48px;
  min-width: 48px;
}

.dashboard-activity-panel.collapsed .dashboard-activity-panel-header {
  border-bottom: none;
  flex-direction: column;
  padding: 12px 8px;
}

.dashboard-activity-panel.collapsed .dashboard-activity-panel-title {
  font-size: 0.7rem;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
  max-height: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .dashboard-activity-panel {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .dashboard-activity-panel {
    width: 100%;
    max-width: 100%;
    max-height: 320px;
  }

  .dashboard-activity-panel.collapsed {
    width: 100%;
    min-width: 0;
    max-height: 52px;
  }

  .dashboard-activity-panel.collapsed .dashboard-activity-panel-header {
    flex-direction: row;
  }

  .dashboard-activity-panel.collapsed .dashboard-activity-panel-title {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 1rem;
    max-height: none;
  }
}

/* Dashboard 2x2 grid: fixed row heights so layout doesn't shift when content loads */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 220px;
  gap: 24px;
  margin-top: 24px;
}

.dashboard-grid-cell {
  margin-bottom: 0;
  padding: 24px;
  padding-bottom: 24px;
  border-bottom: none;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@media (prefers-color-scheme: dark) {
  .dashboard-grid-cell {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .dashboard-grid-cell {
  border-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 720px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-loading-skeleton {
    grid-template-columns: 1fr;
  }
}

.dashboard-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.dashboard-grid .dashboard-section.dashboard-grid-cell {
  margin-bottom: 0;
}

@media (prefers-color-scheme: dark) {
  .dashboard-section {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .dashboard-section {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dashboard-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.dashboard-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
}

.dashboard-section p {
  color: var(--text);
}

.dashboard-section .purchase-seats-text,
.dashboard-section #purchaseSection p,
#purchaseSection .purchase-seats-text,
#purchaseSection p {
  color: white !important;
  opacity: 1 !important;
  font-weight: 400 !important;
}

/* Ensure Purchase Seats button text is white */
#purchaseSection .auth-submit,
#purchaseSection a.auth-submit,
.dashboard-section #purchaseSection .auth-submit {
  color: white !important;
}

.dashboard-info {
  font-size: 14px;
  line-height: 1.8;
}

.dashboard-info p {
  margin: 8px 0;
}

.dashboard-info strong {
  color: var(--text);
  font-weight: 600;
  display: inline-block;
  min-width: 80px;
}

/* Company profile: two cards side by side */
.company-profile-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .profile-card {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .profile-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.profile-card-title {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 720px) {
  .company-profile-cards {
    grid-template-columns: 1fr;
  }
}

.subscription-active {
  padding: 16px;
  background: rgba(66, 133, 244, 0.08);
  border-radius: var(--radius);
  border: 1px solid rgba(66, 133, 244, 0.2);
}

.subscription-active p {
  margin: 4px 0;
  font-size: 14px;
}

/* Shimmer / skeleton loading placeholders – reserve space, no layout jump */
@keyframes shimmer-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.shimmer {
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  .shimmer {
    background: rgba(255, 255, 255, 0.08);
  }
}

html.theme-dark .shimmer {
  background: rgba(255, 255, 255, 0.08);
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer-slide 1.5s ease-in-out infinite;
}

@media (prefers-color-scheme: dark) {
  .shimmer::after {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.12) 50%,
      transparent 100%
    );
  }
}

html.theme-dark .shimmer::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  .shimmer::after {
    animation: none;
    opacity: 0.5;
  }
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  min-width: 40%;
}

.skeleton-line.skeleton-line--short {
  min-width: 25%;
}

.skeleton-line.skeleton-line--long {
  min-width: 85%;
}

.skeleton-block {
  border-radius: var(--radius);
}

/* Dashboard loading overlay – 2x2 skeleton grid (same layout as content) */
.dashboard-card {
  position: relative;
}

.dashboard-loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  z-index: 10;
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.dashboard-loading-overlay[aria-hidden="true"] {
  display: none;
}

/* Overlay: same fixed 2x2 layout as dashboard so no jump when revealed */
.dashboard-loading-skeleton {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 220px;
  gap: 24px;
  margin-top: 24px;
}

.dashboard-loading-skeleton-cell {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (prefers-color-scheme: dark) {
  .dashboard-loading-skeleton-cell {
    border-color: rgba(255, 255, 255, 0.1);
  }
}

html.theme-dark .dashboard-loading-skeleton-cell {
  border-color: rgba(255, 255, 255, 0.1);
}

.dashboard-loading-skeleton-cell .shimmer {
  border-radius: 4px;
}

.dashboard-loading-spinner,
.dashboard-loading-message {
  display: none;
}

/* Grid cell height is fixed via .dashboard-grid { grid-auto-rows } */

/* Inline skeleton for small loading areas (e.g. subscription content) */
.skeleton-inline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.skeleton-inline .skeleton-line {
  margin: 0;
}

/* Users / Team / Company page loading skeletons */
.portal-loading-skeleton {
  padding: 24px 0;
  max-width: 800px;
  margin: 0 auto;
}

.portal-loading-skeleton .shimmer {
  border-radius: 4px;
}

.portal-loading-skeleton-header .skeleton-line {
  height: 24px;
  width: 120px;
  margin-bottom: 8px;
}

.portal-loading-skeleton-header .skeleton-line:last-child {
  height: 14px;
  width: 220px;
  margin-bottom: 0;
}

.portal-loading-skeleton-block {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-loading-skeleton-block .skeleton-line {
  height: 14px;
}

.portal-loading-skeleton-table {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-loading-skeleton-table .skeleton-line {
  height: 40px;
  min-width: 100%;
}

.company-profile-loading {
  min-height: 220px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .auth-submit:hover:not(:disabled) {
    transform: none;
  }
}

html.reduce-motion .auth-submit:hover:not(:disabled) {
  transform: none;
}

/* User Management Styles */
#userManagementSection {
  margin-top: 32px;
}

#seatUsageInfo {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(66, 133, 244, 0.08);
  border-radius: var(--radius);
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  #seatUsageInfo {
    background: rgba(66, 133, 244, 0.15);
  }
}

html.theme-dark #seatUsageInfo {
  background: rgba(66, 133, 244, 0.15);
}

#createUserForm .form-group {
  margin-bottom: 16px;
}

#createUserForm input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid #ddd;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

@media (prefers-color-scheme: dark) {
  #createUserForm input[type="email"] {
    border-color: #444;
  }
}

html.theme-dark #createUserForm input[type="email"] {
  border-color: #444;
}

#createUserForm input[type="email"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.user-list-item {
  padding: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
  .user-list-item {
    background: rgba(255, 255, 255, 0.05);
  }
}

html.theme-dark .user-list-item {
  background: rgba(255, 255, 255, 0.05);
}

.delete-user-btn {
  padding: 8px 16px;
  font-size: 14px;
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.delete-user-btn:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.delete-user-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (prefers-color-scheme: dark) {
  .delete-user-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
  }
  
  .delete-user-btn:hover:not(:disabled) {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
  }
}

html.theme-dark .delete-user-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

html.theme-dark .delete-user-btn:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* Auth portal tables (Team, B2C Users) – stable layout, expandable rows */
.auth-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.auth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card-bg);
}

.auth-table th,
.auth-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  vertical-align: middle;
}

.auth-table th {
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.auth-table tbody tr.expandable-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-table tbody tr.expandable-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.auth-table tbody tr.expandable-row[aria-expanded="true"] {
  background: rgba(66, 133, 244, 0.06);
}

.auth-table .expand-cell {
  width: 36px;
  padding-right: 8px;
}

.auth-table .expand-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.auth-table tr.expandable-row[aria-expanded="true"] .expand-chevron {
  transform: rotate(90deg);
  color: var(--brand);
}

.auth-table tr.expandable-details-row td {
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 12px 16px 12px 52px;
  font-size: 13px;
  color: var(--muted);
  vertical-align: top;
}

.auth-table tr.expandable-details-row td .details-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.auth-table tr.expandable-details-row td .details-inner .view-profile-btn {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 13px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.auth-table tr.expandable-details-row td .details-inner .view-profile-btn:hover {
  opacity: 0.9;
}

@media (prefers-color-scheme: dark) {
  .auth-table-wrap {
    border-color: rgba(255, 255, 255, 0.12);
  }
  .auth-table th,
  .auth-table td {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  .auth-table th {
    background: rgba(255, 255, 255, 0.06);
  }
  .auth-table tbody tr.expandable-row:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .auth-table tbody tr.expandable-row[aria-expanded="true"] {
    background: rgba(66, 133, 244, 0.12);
  }
  .auth-table tr.expandable-details-row td {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
}

html.theme-dark .auth-table-wrap {
  border-color: rgba(255, 255, 255, 0.12);
}

html.theme-dark .auth-table th,
html.theme-dark .auth-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.theme-dark .auth-table th {
  background: rgba(255, 255, 255, 0.06);
}

html.theme-dark .auth-table tbody tr.expandable-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

html.theme-dark .auth-table tbody tr.expandable-row[aria-expanded="true"] {
  background: rgba(66, 133, 244, 0.12);
}

html.theme-dark .auth-table tr.expandable-details-row td {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Password toggle button */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 48px !important;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 18px;
  transition: color 0.2s;
  z-index: 1;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.password-toggle-icon {
  display: inline-block;
  user-select: none;
  pointer-events: none;
  font-size: 16px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
