/* =========================================================================
   GN Connect Tools Portal — stylesheet
   "Polished Refresh" (minimal-risk facelift, promoted 2026-06-11)
   ----------------------------------------------------------------------
   - Brand color: #EA7200 (GN orange)
   - Inter typeface, refined type scale
   - Restrained colour palette; orange used as single accent
   - Softer shadows, unified 14px radius, calmer hover motion
   - HTML structure unchanged; all original class names preserved
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --gn-orange: #EA7200;
  --gn-orange-hover: #c95f00;
  --gn-orange-soft: rgba(234, 114, 0, 0.10);
  --gn-orange-ring: rgba(234, 114, 0, 0.18);

  /* Type & shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows (soft, modern) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);

  --card-shadow: var(--shadow-sm);
  --card-hover-shadow: 0 20px 45px var(--accent-glow), var(--shadow-lg);

  /* Semantic */
  --success: #059669;
  --danger:  #dc2626;
  --info:    #0284c7;
}

/* ----- LIGHT THEME (refined warm neutrals) ----- */
[data-theme="light"] {
  --bg: #f5f6f9;
  --bg-secondary: #ffffff;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --panel-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --card-bg: #ffffff;
  --accent: var(--gn-orange);
  --accent-glow: rgba(234, 114, 0, 0.16);
  --accent-glow-strong: rgba(234, 114, 0, 0.28);
}

/* ----- DARK THEME (cooler, refined) ----- */
[data-theme="dark"] {
  --bg: #0a0e1a;
  --bg-secondary: #131b2e;
  --bg-elevated: #1a2540;
  --text: #e6ecf5;
  --text-secondary: #95a3bd;
  --text-tertiary: #64748b;
  --panel-hover: #1f2a44;
  --border: #233354;
  --border-strong: #2f4170;
  --card-bg: #131b2e;
  --accent: var(--gn-orange);
  --accent-glow: rgba(255, 138, 61, 0.22);
  --accent-glow-strong: rgba(255, 138, 61, 0.38);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 12% -10%, var(--accent-glow), transparent 40%),
    radial-gradient(circle at 88% 0%, var(--accent-glow), transparent 35%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding: 32px 20px 48px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  transition: background 0.3s, color 0.3s;
}

.container { max-width: 1200px; margin: 0 auto; }

/* =====================================================================
   HEADER
   ===================================================================== */
header {
  text-align: center;
  margin: 0 auto 32px;
  max-width: 1200px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--gn-orange);
}

.header-content { text-align: center; }

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}

.logo-container img {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 4px 18px var(--accent-glow-strong));
}

h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--text) 0%, var(--text) 55%, var(--gn-orange) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

/* Decorative soundwave — GN/Jabra "sound" motif */
.wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 26px;
  margin: 0 0 14px;
}

.wave span {
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gn-orange) 0%, var(--gn-orange-hover) 100%);
  animation: wave-bounce 1.2s ease-in-out infinite;
}

.wave span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.wave span:nth-child(2) { height: 16px; animation-delay: .1s; }
.wave span:nth-child(3) { height: 24px; animation-delay: .2s; }
.wave span:nth-child(4) { height: 12px; animation-delay: .3s; }
.wave span:nth-child(5) { height: 20px; animation-delay: .4s; }
.wave span:nth-child(6) { height: 9px;  animation-delay: .5s; }
.wave span:nth-child(7) { height: 18px; animation-delay: .6s; }
.wave span:nth-child(8) { height: 11px; animation-delay: .7s; }

@keyframes wave-bounce {
  0%, 100% { transform: scaleY(0.45); }
  50%      { transform: scaleY(1); }
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

.slogan {
  font-size: 12px;
  color: var(--gn-orange);
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  margin-top: 6px;
  letter-spacing: 0.18em;
}

/* Header secondary links — restrained, not competing with primary actions */
.guides-header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--border);
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.guides-header-link:hover {
  background: var(--gn-orange-soft);
  color: var(--gn-orange);
  border-color: var(--gn-orange);
  text-decoration: none;
  transform: none;
  box-shadow: none;
}

/* =====================================================================
   ACTION BAR
   ===================================================================== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto 28px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 12px;
  z-index: 40;
}

.action-bar-left,
.action-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-bar-left { flex: 1 1 auto; min-width: 0; }
.action-bar-right { flex: 0 0 auto; justify-content: flex-end; }

/* Search */
.tool-search-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 360px;
  max-width: 420px;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  opacity: 0.55;
  pointer-events: none;
}

.tool-search {
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  height: 40px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.tool-search:focus {
  border-color: var(--gn-orange);
  box-shadow: 0 0 0 3px var(--gn-orange-ring);
}

.tool-search::placeholder { color: var(--text-tertiary); opacity: 1; }

/* Unified action button base — quiet, neutral */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none;
  font-family: inherit;
}

.action-btn:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
  transform: none;
  box-shadow: none;
}

.action-btn:active { transform: none; }

.btn-icon { font-size: 15px; display: flex; align-items: center; line-height: 1; }
.btn-text { font-weight: 500; }

/* Subtle colored variants — color on icon/border only */
.reset-btn:hover  { border-color: var(--gn-orange); color: var(--gn-orange); }
.admin-btn:hover  { border-color: var(--info);      color: var(--info); }
.signout-btn:hover{ border-color: var(--danger);    color: var(--danger); }

/* Theme toggle: match action-btn shape */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: none;
}

.theme-toggle:hover {
  background: var(--panel-hover);
  border-color: var(--gn-orange);
  transform: none;
  box-shadow: none;
}

/* =====================================================================
   LOGIN CARD
   ===================================================================== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

#loginView h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

#loginView input[type="email"],
#loginView input[type="password"] {
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#loginView input[type="email"]:focus,
#loginView input[type="password"]:focus {
  outline: none;
  border-color: var(--gn-orange) !important;
  box-shadow: 0 0 0 3px var(--gn-orange-ring);
}

/* Override inline green gradient on the Sign In button with brand orange */
#loginView button[onclick="signIn()"] {
  background: var(--gn-orange) !important;
  font-family: inherit !important;
  transition: background 0.15s ease, transform 0.05s ease;
}

#loginView button[onclick="signIn()"]:hover {
  background: var(--gn-orange-hover) !important;
}

#loginView button[onclick="signIn()"]:active {
  transform: translateY(1px);
}

/* =====================================================================
   TOOLS GRID
   ===================================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0 auto 40px;
  max-width: 1200px;
}

.tool-card {
  background: linear-gradient(180deg, var(--card-bg) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: grab;
  text-decoration: none;
  color: var(--text);
  display: block;
  position: relative;
  overflow: hidden;
}

.tool-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: scale(0.97);
}

.tool-card.drag-over {
  border: 1px dashed var(--gn-orange);
  background: var(--panel-hover);
}

/* Drag-handle dots, muted */
.tool-card::after {
  content: '⋮⋮';
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.tool-card:hover::after { opacity: 0.5; }

/* Top accent bar reveals on hover */
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gn-orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--gn-orange);
}

.tool-card:hover::before { transform: scaleX(1); }

/* Tool icon tile — keep gradient variety but reduce visual weight */
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  color: white;
  box-shadow: 0 6px 18px var(--accent-glow);
}

.icon-heatmap  { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.icon-forward  { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.icon-callback { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.tool-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 6px;
}

.tool-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}

.tool-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.tool-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

/* =====================================================================
   FOOTER
   ===================================================================== */
footer {
  text-align: center;
  color: var(--text-tertiary);
  margin: 48px auto 8px;
  padding: 0 20px;
  font-size: 12.5px;
  max-width: 1200px;
}

.hidden { display: none !important; }

/* =====================================================================
   GENERIC FORM ELEMENTS (used inside login + modals)
   ===================================================================== */
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
.row > div { flex: 1; min-width: 150px; }
.spacer { flex: 1000; min-width: 100%; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: var(--gn-orange);
  box-shadow: 0 0 0 3px var(--gn-orange-ring);
}

.btn {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn.primary {
  background: var(--gn-orange);
  color: white;
}

.btn.primary:hover {
  background: var(--gn-orange-hover);
  transform: none;
}

.btn.secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--border);
}

.btn.secondary:hover { background: var(--panel-hover); border-color: var(--border-strong); }

.muted  { color: var(--text-secondary); font-size: 13px; }
.error  { color: var(--danger);  font-size: 13px; }
.success{ color: var(--success); font-size: 13px; }

/* SSO button (Entra) */
.sso-btn {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 13px 20px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}

.sso-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  transform: none;
}

.divider {
  text-align: center;
  margin: 16px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

/* =====================================================================
   STATS BANNER (kept compatible)
   ===================================================================== */
.stats-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-xs);
}

.stats-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
}

.stat-item {
  text-align: center;
  position: relative;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.stat-item:hover { background: var(--panel-hover); }

.stat-item:hover .stat-regions {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--gn-orange);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-divider { width: 1px; height: 48px; background: var(--border); }

.stat-regions {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-width: 200px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 10;
  margin-top: 6px;
}

.stat-region-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.stat-region-row:last-child { border-bottom: none; }

.stat-prev-year-inline {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  font-style: italic;
  opacity: 0.75;
  margin-left: 6px;
}

.stat-region-name  { color: var(--text-secondary); font-weight: 500; }
.stat-region-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.stats-footer {
  text-align: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
}

.loading-spinner {
  animation: pulse 1.5s ease-in-out infinite;
  color: var(--text-tertiary);
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* =====================================================================
   USER MANAGEMENT MODAL (kept compatible)
   ===================================================================== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

[data-theme="light"] .modal { background: rgba(15, 23, 42, 0.4); }

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .modal-content { background: #ffffff; }

.user-list-item { transition: background 0.15s; }
.user-list-item:hover { background: var(--panel-hover); }

.user-list-item.selected {
  background: var(--gn-orange-soft);
  border-left: 3px solid var(--gn-orange);
}

[data-theme="light"] .user-list-item.selected {
  background: var(--gn-orange-soft);
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }

  .action-bar { flex-wrap: wrap; }
  .action-bar-left,
  .action-bar-right { width: 100%; }
  .action-bar-right { justify-content: flex-start; flex-wrap: wrap; }

  .tool-search-container { max-width: none; }

  .stats-container { gap: 32px; }
  .stat-value { font-size: 26px; }
}

@media (max-width: 768px) {
  body { padding: 20px 14px 36px; }

  h1 { font-size: 26px; }

  .action-bar { padding: 12px; }
  .action-bar-left,
  .action-bar-right { flex-wrap: wrap; }

  .tool-search-container { min-width: 100%; }

  .tools-grid { grid-template-columns: 1fr; gap: 16px; }
  .tool-card { padding: 20px; }

  .stats-banner { padding: 16px; }
  .stats-container { flex-direction: column; gap: 20px; }
  .stat-divider { width: 60px; height: 1px; }
  .stat-value { font-size: 28px; }
}
