/* ── UX Enhancement Styles ── scoped under .cg-theme ── */

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--blue);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ── Back to Top ── */
.cg-theme .back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 35;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(180, 213, 248, 0.78);
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.92),
    rgba(239, 248, 255, 0.82)
  );
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(20, 61, 114, 0.14);
  color: var(--blue);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.3s,
    visibility 0.3s,
    transform 0.3s,
    box-shadow 0.2s;
}
.cg-theme .back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cg-theme .back-to-top:hover {
  box-shadow: 0 12px 36px rgba(20, 61, 114, 0.22);
  transform: translateY(-2px);
}

/* ── Cookie Banner ── */
.cg-theme .cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 16px 24px;
  background: linear-gradient(135deg, #09224b, #0b2d5e);
  border-top: 1px solid rgba(28, 115, 255, 0.2);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100%);
  transition:
    opacity 0.35s,
    visibility 0.35s,
    transform 0.35s;
}
.cg-theme .cookie-banner.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cg-theme .cookie-banner p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  margin: 0;
}
.cg-theme .cookie-banner .primary-button {
  padding: 8px 20px;
  font-size: 13px;
}
.cg-theme .cookie-banner .secondary-button {
  padding: 8px 20px;
  font-size: 13px;
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
}
.cg-theme .cookie-banner .secondary-button:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

/* ── Loading Screen ── */
.cg-theme .loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft, #edf7ff);
  transition:
    opacity 0.4s,
    visibility 0.4s;
}
.cg-theme .loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.cg-theme .loading-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(28, 115, 255, 0.2);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Page Transition ── */
.cg-theme .page-leaving {
  opacity: 0.6;
  transition: opacity 0.15s;
}

/* ── Theme Toggle Button ── */
.cg-theme .theme-button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(180, 213, 248, 0.78);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.cg-theme .theme-button:hover {
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.9);
}
.cg-theme .theme-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Dark Mode ── */
.cg-theme.dark {
  --ink: #e4ecf7;
  --muted: #8aa1bc;
  --line: rgba(100, 140, 200, 0.25);
  --surface: rgba(16, 32, 56, 0.85);
  --soft: #0a1628;
  --blue: #4d9aff;
  --blue-dark: #1c5fd4;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  background: #0a1628;
  color: var(--ink);
}
.cg-theme.dark .site-header {
  background: rgba(10, 22, 40, 0.92);
  border-color: rgba(100, 140, 200, 0.2);
}
.cg-theme.dark .site-header .brand img {
  filter: brightness(1.2);
}
.cg-theme.dark .desktop-nav a,
.cg-theme.dark .mobile-nav a {
  color: var(--muted);
}
.cg-theme.dark .desktop-nav a:hover {
  color: var(--ink);
}
.cg-theme.dark .login-button {
  border-color: rgba(100, 140, 200, 0.3);
  color: var(--blue);
}
.cg-theme.dark .login-button:hover {
  background: rgba(77, 154, 255, 0.1);
}

/* Hero */
.cg-theme.dark .hero-overlay {
  background: linear-gradient(
    135deg,
    rgba(10, 22, 40, 0.88),
    rgba(10, 22, 40, 0.55)
  );
}
.cg-theme.dark .hero-content-frame {
  background: rgba(16, 32, 56, 0.78);
  border-color: rgba(100, 140, 200, 0.2);
}
.cg-theme.dark .sub-hero::after {
  background: linear-gradient(
    135deg,
    rgba(10, 22, 40, 0.9),
    rgba(10, 22, 40, 0.5)
  );
}

/* Cards */
.cg-theme.dark .feature-card,
.cg-theme.dark .send-card,
.cg-theme.dark .tracking-card,
.cg-theme.dark .rail-card,
.cg-theme.dark .sub-card,
.cg-theme.dark .product-card,
.cg-theme.dark .process-card,
.cg-theme.dark .metric-card,
.cg-theme.dark .subpage-cta-box {
  background: rgba(16, 32, 56, 0.78);
  border-color: rgba(100, 140, 200, 0.2);
}
.cg-theme.dark .feature-card:hover,
.cg-theme.dark .send-card:hover,
.cg-theme.dark .tracking-card:hover {
  border-color: rgba(77, 154, 255, 0.4);
}

/* Forms */
.cg-theme.dark .contact-form {
  background: rgba(16, 32, 56, 0.82);
  border-color: rgba(100, 140, 200, 0.25);
}
.cg-theme.dark .form-field input,
.cg-theme.dark .form-field select,
.cg-theme.dark .form-field textarea {
  background: rgba(10, 22, 40, 0.8);
  border-color: rgba(100, 140, 200, 0.25);
  color: var(--ink);
}
.cg-theme.dark .form-field input::placeholder,
.cg-theme.dark .form-field textarea::placeholder {
  color: #5a7394;
}

/* Modal */
.cg-theme.dark .modal-card {
  background: rgba(16, 32, 56, 0.92);
  border-color: rgba(100, 140, 200, 0.25);
}
.cg-theme.dark .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}
.cg-theme.dark .modal-tabs {
  background: rgba(100, 140, 200, 0.15);
}
.cg-theme.dark .user-menu-trigger {
  background: rgba(16, 32, 56, 0.8);
  border-color: rgba(100, 140, 200, 0.3);
  color: var(--ink);
}

/* Footer */
.cg-theme.dark .site-footer {
  background: linear-gradient(135deg, #040d1e, #081630);
  border-top-color: rgba(100, 140, 200, 0.15);
}
.cg-theme.dark .subpage-footer {
  background: rgba(8, 18, 38, 0.95);
  border-top-color: rgba(100, 140, 200, 0.15);
}

/* Scope marquee cards */
.cg-theme.dark .scope-card {
  background: rgba(16, 32, 56, 0.7);
  border-color: rgba(100, 140, 200, 0.15);
}
.cg-theme.dark .scope-card b {
  color: var(--ink);
}

/* Buttons */
.cg-theme.dark .primary-button {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}
.cg-theme.dark .secondary-button {
  border-color: rgba(100, 140, 200, 0.3);
  color: var(--blue);
  background: rgba(77, 154, 255, 0.08);
}

/* Sections */
.cg-theme.dark .section {
  background: transparent;
}
.cg-theme.dark .subpage-section {
  background: transparent;
}
.cg-theme.dark .visual-band {
  background: rgba(10, 22, 40, 0.5);
}

/* Misc */
.cg-theme.dark .back-to-top {
  background: rgba(16, 32, 56, 0.9);
  border-color: rgba(100, 140, 200, 0.3);
}
.cg-theme.dark .sub-anchor-bar {
  background: rgba(10, 22, 40, 0.9);
  border-color: rgba(100, 140, 200, 0.2);
}
.cg-theme.dark .mobile-nav {
  background: rgba(10, 22, 40, 0.96);
}
.cg-theme.dark .send-tab {
  color: var(--muted);
}
.cg-theme.dark .quick-item {
  background: rgba(16, 32, 56, 0.7);
  border-color: rgba(100, 140, 200, 0.2);
  color: var(--ink);
}
.cg-theme.dark .quick-item:hover {
  border-color: var(--blue);
  background: rgba(77, 154, 255, 0.1);
}
.cg-theme.dark .stats-grid > div {
  background: rgba(16, 32, 56, 0.7);
  border-color: rgba(100, 140, 200, 0.15);
}
.cg-theme.dark .loading-screen {
  background: #0a1628;
}

/* Language button in dark */
.cg-theme.dark .language-button {
  border-color: rgba(100, 140, 200, 0.3);
  color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 680px) {
  .cg-theme .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .cg-theme .cookie-banner {
    padding: 14px 16px;
    gap: 10px;
  }
  .cg-theme .cookie-banner p {
    font-size: 13px;
  }
}

/* ── Language Toggle Button ── */
.cg-theme .lang-button {
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(180, 213, 248, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cg-theme .lang-button:hover {
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.95);
}

.cg-theme.dark .lang-button {
  background: rgba(19, 30, 56, 0.7);
  border-color: rgba(120, 150, 200, 0.32);
  color: #d7e8ff;
}

.cg-theme.dark .lang-button:hover {
  border-color: var(--blue);
  background: rgba(28, 50, 92, 0.92);
  color: #fff;
}

@media (max-width: 680px) {
  .cg-theme .lang-button {
    min-width: 32px;
    padding: 0 8px;
  }
}
