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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  min-height: 100vh;

  /* fallback for browsers without dvh support */
  @supports (min-height: 100dvh) {
    min-height: 100dvh;
  }

  display: flex;
  flex-direction: column;
  width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-primary-hover);
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

main.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
.site-header {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 20px;
  align-items: center;
  height: 68px;
  padding: 0 24px;
}

.header-left {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
}

.header-right {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  width: 34px;
  height: 34px;
}

.brand-name {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

/* Cluster Status Indicator */
.cluster-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  max-width: 100%;
}

#cluster-status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.cluster-status-badge.online .status-dot {
  background-color: var(--deal-green);
  box-shadow: 0 0 8px var(--deal-green);
}

.cluster-status-badge.offline .status-dot {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: var(--text-primary);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  color: unset;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
}

/* Footer */
.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  margin-top: auto;
}

.footer-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-links a,
.footer-links button {
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Modal Popup Window */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  padding: 20px;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-backdrop.show .modal-dialog {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.close-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.close-btn img {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

.modal-body h2,
.modal-body h3 {
  color: var(--text-primary);
  margin-top: 16px;
  margin-bottom: 8px;
}

.modal-body p {
  margin-bottom: 12px;
}

/* Auth Popup Modal Elements */
.auth-modal-content {
  display: flex;
  flex-direction: column;
}

.auth-modal-nav-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}

.auth-modal-tab-btn {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.auth-modal-tab-btn:hover {
  color: var(--text-primary);
}

.auth-modal-tab-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.auth-modal-view {
  display: none;
  animation: authFadeIn 0.2s ease-in-out;
}

.auth-modal-view.active {
  display: block;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.modal-alert-banner.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--accent-ruby, #ef4444);
  color: var(--accent-ruby, #ef4444);
}

.modal-alert-banner.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--accent-amber, #f59e0b);
  color: var(--accent-amber, #f59e0b);
}

.modal-alert-banner.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-emerald, #10b981);
  color: var(--accent-emerald, #10b981);
}

/* Toast Notifications (Unified with Top-Center Flash Messages) */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 850px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 22px;
  background: #2563eb;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border: 1px solid rgba(191, 219, 254, 0.35);
  border-left: 5px solid #bfdbfe;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(37, 99, 235, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: flashSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Loading Overlay & Spinner Component */
.loading-overlay {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9998;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay.active {
  display: flex !important;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Custom Checkbox Component */
.filter-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.filter-checkbox-label:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

.custom-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.custom-checkbox:checked~.checkbox-box {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
}

.custom-checkbox:checked~.checkbox-box::after {
  content: "";
}

/* Reusable Search Bar Component */
.search-wrapper {
  max-width: 720px;
  width: 100%;
  margin: 0 auto 24px;
  position: relative;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  background-color: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 20px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.search-form:focus-within {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  width: 22px;
  height: 22px;
  margin-right: 12px;
  opacity: 0.6;
}

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  outline: none;
  padding: 8px 0;
}

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

.search-submit-btn {
  padding: 10px 24px;
  font-size: 1rem;
  border-radius: var(--radius-full);
}


/* Cluster Disconnected Notice & Form Styling */
.search-cluster-disconnected-warning {
  margin-top: 10px;
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.2s ease;
}

.search-form.cluster-disconnected {
  border-color: rgba(239, 68, 68, 0.4);
}

.search-form.cluster-disconnected .search-submit-btn {
  background-color: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  cursor: not-allowed;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* Utility button sizes & styles */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
}

.toast-error {
  background: #dc2626;
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  border: 1px solid rgba(254, 202, 202, 0.35);
  border-left: 5px solid #fecaca;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(220, 38, 38, 0.35);
}

.toast-warning {
  background: #d97706;
  background: linear-gradient(135deg, #92400e 0%, #d97706 100%);
  border: 1px solid rgba(253, 230, 138, 0.35);
  border-left: 5px solid #fde68a;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(217, 119, 6, 0.35);
}

.toast-info {
  background: #2563eb;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border: 1px solid rgba(191, 219, 254, 0.35);
  border-left: 5px solid #bfdbfe;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(37, 99, 235, 0.35);
}

.toast-success {
  background: #059669;
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  border: 1px solid rgba(167, 243, 208, 0.35);
  border-left: 5px solid #a7f3d0;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(5, 150, 105, 0.35);
}

/* Header Search Bar Component */
.header-search-wrapper {
  grid-column: 2;
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  justify-self: center;
}

.header-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px 6px 4px 16px;
  transition: all var(--transition-fast);
}

.header-search-form:focus-within {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-glow);
}

.header-search-icon {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  opacity: 0.6;
  flex-shrink: 0;
}

.header-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  padding: 6px 0;
  min-width: 0;
}

.header-search-input::placeholder {
  color: var(--text-muted);
}

/* Header Live / No-Cache Toggle for Admins */
.no-cache-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin: 0 8px 0 4px;
  flex-shrink: 0;
}

.no-cache-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.no-cache-pill {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.no-cache-toggle:hover .no-cache-pill {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.no-cache-toggle input[type="checkbox"]:checked~.no-cache-pill {
  color: var(--deal-green);
  background-color: var(--deal-green-bg);
  border-color: var(--deal-green-border);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.no-cache-toggle:hover input[type="checkbox"]:checked~.no-cache-pill {
  color: #34d399;
  border-color: var(--deal-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.no-cache-toggle input[type="checkbox"]:focus-visible~.no-cache-pill {
  outline: 2px solid var(--deal-green);
  outline-offset: 2px;
}

.header-search-btn {
  padding: 7px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Header User Authentication & Dropdown */
.header-user-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 768px) {
  .header-container {
    display: flex;
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .header-left {
    order: 1;
    flex: 0 0 auto;
  }

  .header-right {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .header-search-wrapper {
    order: 3;
    width: 100%;
    flex: 1 1 100%;
    max-width: 100%;
    margin: 4px 0 0 0;
  }

  .header-search-input {
    font-size: 0.9rem;
    min-width: 0;
  }

  .header-search-btn {
    padding: 6px 14px;
    font-size: 0.825rem;
  }

  .brand-name {
    font-size: 1.15rem;
    display: inline;
  }

  .auth-action-buttons .btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .search-form {
    padding: 4px 6px 4px 14px;
  }

  .search-input {
    font-size: 0.95rem;
    padding: 6px 0;
  }

  .search-submit-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 12px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .brand-link {
    font-size: 1.05rem;
    gap: 8px;
  }

  .auth-action-buttons {
    gap: 6px;
  }

  .auth-action-buttons .btn {
    padding: 4px 8px;
    font-size: 0.775rem;
  }

  .search-form {
    padding: 4px 6px 4px 12px;
  }

  .search-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }

  .search-input {
    font-size: 0.9rem;
  }

  .search-submit-btn {
    padding: 7px 12px;
    font-size: 0.825rem;
  }
}

.user-menu-dropdown {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.user-menu-btn:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.user-menu-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.user-initials {
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.user-dropdown-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 230px;
  max-width: 290px;
  padding: 8px 0;
  z-index: 1000;
  display: none;
}

.user-dropdown-popover.show {
  display: block;
}

.dropdown-header-info {
  padding: 10px 16px;
}

.dropdown-user-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dropdown-user-email {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.dropdown-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.dropdown-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.dropdown-nav-item:hover .dropdown-item-icon {
  color: var(--brand-primary);
}

.dropdown-nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.dropdown-nav-item.logout-link:hover {
  color: #f87171;
}

/* User Role Badges */
.role-badge {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.role-badge-admin,
.role-pill-admin {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-badge-vip,
.role-pill-vip {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.role-badge-normal,
.role-pill-normal {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Auth Cards & Forms */
.auth-page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px 20px 40px 20px;
  min-height: calc(100vh - 180px);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-icon-badge {
  font-size: 2rem;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border var(--transition-fast);
}

.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-glow);
}

.btn-block {
  width: 100%;
  display: block;
}

.auth-submit-btn {
  padding: 11px;
  margin-top: 8px;
  font-size: 1rem;
}

.auth-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-switch-link {
  color: var(--brand-primary);
  font-weight: 600;
  margin-left: 6px;
}

.label-with-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.forgot-link {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.forgot-link:hover {
  color: var(--brand-primary);
}

/* Floating Flash Messages Popup Window Overlay */
.flash-messages-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 850px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

@media (max-width: 600px) {
  .flash-messages-container {
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
  }
}

.flash-alert {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 22px;
  background: #1e40af;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border: 1px solid rgba(147, 197, 253, 0.35);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(37, 99, 235, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: flashSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}

@keyframes flashSlideDown {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flash-error,
.flash-danger {
  background: #dc2626;
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  border: 1px solid rgba(254, 202, 202, 0.35);
  border-left: 5px solid #fecaca;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(220, 38, 38, 0.35);
}

.flash-warning {
  background: #d97706;
  background: linear-gradient(135deg, #92400e 0%, #d97706 100%);
  border: 1px solid rgba(253, 230, 138, 0.35);
  border-left: 5px solid #fde68a;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(217, 119, 6, 0.35);
}

.flash-info {
  background: #2563eb;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border: 1px solid rgba(147, 197, 253, 0.35);
  border-left: 5px solid #bfdbfe;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(37, 99, 235, 0.35);
}

.flash-success {
  background: #059669;
  background: linear-gradient(135deg, #065f46 0%, #10b981 100%);
  border: 1px solid rgba(167, 243, 208, 0.35);
  border-left: 5px solid #a7f3d0;
  color: #ffffff;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 6px 14px -4px rgba(16, 185, 129, 0.35);
}

.flash-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

.flash-text {
  flex: 1;
  word-break: break-word;
  color: #ffffff;
}

.flash-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-close-btn:hover {
  opacity: 1;
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.2);
}

/* Account Page Styles */
.account-page-container {
  padding: 40px 20px 60px;
}

.account-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 15px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
}

.detail-label {
  color: var(--text-secondary);
}

.admin-callout-box {
  margin-top: 20px;
  padding: 14px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* ==========================================================================
   Back to Top Button
   ========================================================================== */
.back-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: opacity var(--transition-normal), visibility var(--transition-normal), transform var(--transition-normal), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top-btn:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.back-to-top-btn:active {
  transform: translateY(0) scale(0.95);
}

.back-to-top-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .back-to-top-btn {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: 16px;
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   Localization Picker & Modal Styles
   ========================================================================== */

.header-right {
  gap: 12px;
}

.localization-picker-container {
  display: inline-flex;
  align-items: center;
  position: relative;
}

/* Localization Pill Highlighting Animation */
.localization-pill.highlight-pulse {
  border-color: var(--brand-primary);
  box-shadow: 0 0 10px var(--brand-glow), 0 0 0 2px rgba(59, 130, 246, 0.4);
  animation: pillGlowPulse 2.2s infinite ease-in-out;
}

@keyframes pillGlowPulse {

  0%,
  100% {
    box-shadow: 0 0 10px var(--brand-glow), 0 0 0 1px rgba(59, 130, 246, 0.3);
  }

  50% {
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.55), 0 0 0 3px rgba(59, 130, 246, 0.35);
  }
}

/* PLZ Hint Speech Bubble */
.plz-hint-bubble {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 290px;
  max-width: min(290px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(59, 130, 246, 0.22);
  padding: 14px 16px;
  z-index: 1001;
  text-align: left;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.plz-hint-bubble.show {
  display: block !important;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.plz-hint-arrow {
  position: absolute;
  top: -7px;
  right: 36px;
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border-left: 1px solid var(--brand-primary);
  border-top: 1px solid var(--brand-primary);
  transform: rotate(45deg);
  pointer-events: none;
}

.plz-hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.plz-hint-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plz-hint-icon {
  color: var(--brand-primary);
  flex-shrink: 0;
}

.plz-hint-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.plz-hint-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.plz-hint-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0 0 12px 0;
}

.plz-hint-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-hint-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.775rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.btn-hint-dismiss:hover {
  color: var(--text-primary);
}

.btn-hint-action {
  font-size: 0.8rem;
  padding: 5px 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.localization-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.localization-pill:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--brand-primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.loc-pill-flag {
  font-size: 0.95rem;
  line-height: 1;
}

.loc-pill-divider {
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 400;
}

.loc-pill-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.localization-modal-dialog {
  max-width: 480px;
}

.modal-header-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

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

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

.loc-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.loc-select {
  width: 100%;
  cursor: not-allowed;
  opacity: 0.8;
}

.loc-plz-row {
  display: flex;
  gap: 8px;
}

.loc-plz-input {
  flex: 1;
  font-size: 1rem;
  letter-spacing: 1px;
  font-weight: 600;
}

.loc-field-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 5px;
  display: block;
}

.loc-feedback {
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 500;
}

.loc-feedback-success {
  color: var(--deal-green);
}

.loc-feedback-error {
  color: var(--accent-red);
}

.loc-radio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.loc-radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.loc-radio-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--brand-primary);
}

.loc-radio-card input[type="radio"] {
  accent-color: var(--brand-primary);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.loc-radio-card:has(input:checked) {
  border-color: var(--brand-primary);
  background-color: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.loc-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.loc-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loc-card-flag {
  font-size: 0.95rem;
}

.loc-card-symbol {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.loc-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.loc-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.loc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 640px) {

  .loc-pill-divider:nth-of-type(3),
  .loc-pill-lang {
    display: none;
  }
}