:root {
  --bg-base: #0f141a;
  --panel-bg: rgba(22, 26, 32, 0.95);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-color: #17c4c7;
  --accent-hover: #14aeb0;
  --danger: #ef4444;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body,
html {
  width: 100%;
  height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: var(--bg-base);
}

.bg-image {
  position: fixed;
  top: -5%;
  left: -5%;
  right: -5%;
  bottom: -5%;
  background-image: url('../resources/eng.jpg');
  background-size: cover;
  background-position: center;
  filter: blur(2px) grayscale(10%); /* FIX: was blur(2x) which is invalid */
  z-index: 1;
}

.bg-mixed-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(23, 196, 199, 0.25) 0%, rgba(15, 20, 26, 0.4) 60%, rgba(10, 12, 16, 0.6) 100%),
    linear-gradient(135deg, rgba(16, 31, 45, 0.3) 0%, rgba(20, 50, 60, 0.15) 50%, rgba(26, 20, 40, 0.3) 100%);
  z-index: 2;
}

.central-panel {
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 3.5rem 3rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(23, 196, 199, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
  animation: panelEntrance 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.central-panel::-webkit-scrollbar {
  width: 6px;
}

.central-panel::-webkit-scrollbar-track {
  background: transparent;
}

.central-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.central-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.panel-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-logo {
  width: 300px;
  max-width: 90%;
  height: auto;
}

/* ── Search Bar ── */
.search-container {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: 12px 20px;
  margin: 0 auto 2.5rem auto;
  max-width: 500px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(23, 196, 199, 0.15);
  background: rgba(0, 0, 0, 0.4);
}

.search-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.search-container:focus-within .search-icon {
  color: var(--accent-color);
}

.search-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1rem;
  width: 100%;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.search-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, color var(--transition), background var(--transition);
}

.search-clear.visible {
  opacity: 1;
  pointer-events: all;
}

.search-clear:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.search-kbd {
  display: flex;
  align-items: center;
  margin-left: 10px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.search-container:focus-within .search-kbd {
  opacity: 0;
  pointer-events: none;
}

.kbd {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ── Auth Controls (Login State) ── */
.auth-controls {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

button {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  padding: 16px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #0f141a;
  box-shadow: 0 4px 12px rgba(23, 196, 199, 0.2);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(23, 196, 199, 0.3);
}

.sso-group {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex-grow: 1;
  background-color: var(--accent-color);
  color: #0f141a;
  border: none;
  box-shadow: 0 4px 12px rgba(23, 196, 199, 0.2);
}

.btn-secondary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(23, 196, 199, 0.3);
}

.btn-icon {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: 10px;
  padding: 14px;
}

.btn-icon:hover,
.btn-icon.active {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: rgba(23, 196, 199, 0.15);
}

.btn-loading {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.info-panel {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 1.25rem;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease;
}

.info-panel.active {
  max-height: 200px;
  opacity: 1;
  padding: 1.25rem;
}

.link-text {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.link-text:hover {
  text-decoration: underline;
}

/* ── Dashboard Grid ── */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.no-results {
  display: none;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0 0.5rem;
}

.no-results.visible {
  display: block;
}

.grid-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.grid-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-color);
  transform: scaleY(0);
  transition: transform var(--transition);
  transform-origin: center;
}

.grid-item::after {
  content: '→';
  position: absolute;
  right: 20px;
  font-family: monospace;
  font-size: 1.2rem;
  opacity: 0;
  transform: translateX(-15px);
  transition: var(--transition);
  color: var(--accent-color);
}

.grid-item:hover {
  background: rgba(23, 196, 199, 0.05);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 0 0 15px rgba(23, 196, 199, 0.1);
}

.grid-item:hover::before {
  transform: scaleY(1);
}

.grid-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.grid-item.secondary {
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}

/* ── Expander ── */
.expander-group {
  margin-bottom: 2rem;
  width: 100%;
}

.btn-expander {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-muted);
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-expander:hover,
.btn-expander.active {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(23, 196, 199, 0.03);
}

.expander-chevron {
  transition: transform var(--transition);
  flex-shrink: 0;
}

.btn-expander.active .expander-chevron {
  transform: rotate(180deg);
}

.expand-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.expand-content.active {
  max-height: 3000px;
  opacity: 1;
}

/* ── User Actions ── */
.panel-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin-top: auto;
  padding-top: 3rem;
}

.user-badge {
  font-size: 1.05rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
  flex-shrink: 0;
  animation: statusPulse 2.5s ease-in-out infinite;
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 10px 35px;
  border-radius: 30px;
  font-size: 0.95rem;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.panel-footer {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 2rem;
}

/* ── Primary Dashboard Highlight ── */
.grid-item.primary-dashboard {
  background: linear-gradient(135deg, rgba(23, 196, 199, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(23, 196, 199, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.grid-item.primary-dashboard:hover {
  background: linear-gradient(135deg, rgba(23, 196, 199, 0.15) 0%, rgba(23, 196, 199, 0.05) 100%);
  border-color: var(--accent-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(23, 196, 199, 0.2);
}

/* ── Focus Accessibility ── */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ── Animations ── */
@keyframes panelEntrance {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px var(--accent-color);
  }
  50% {
    opacity: 0.75;
    box-shadow: 0 0 14px var(--accent-color), 0 0 22px rgba(23, 196, 199, 0.35);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .central-panel {
    padding: 1.5rem;
    height: auto;
    max-height: 85vh;
    width: 92%;
  }

  .brand-logo {
    width: 170px;
    margin-bottom: 0.5rem;
  }

  .nav-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .grid-item {
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  .grid-item::after {
    font-size: 1rem;
    right: 12px;
  }

  .search-container {
    padding: 8px 14px;
    margin-bottom: 1rem;
  }

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

  .search-kbd {
    display: none;
  }

  .btn-expander {
    padding: 8px;
    font-size: 0.85rem;
  }

  .panel-actions {
    padding-top: 0.75rem;
  }

  .user-badge {
    padding: 4px 12px;
    font-size: 0.85rem;
  }

  .btn-logout {
    padding: 6px 20px;
    font-size: 0.85rem;
  }

  .panel-footer {
    font-size: 0.65rem;
  }
}
