/* ==========================================================================
   Global Platform Navigation & Intelligent Footer Stylesheet
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.layout-container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
}

/* Sticky Glassmorphic Header */
.platform-header-nav {
  position: sticky;
  top: 0;
  z-index: 9000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.nav-inner-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
}

.platform-logo-link {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.platform-logo-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--primary-100);
  color: var(--primary-700);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.primary-menu-list {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0.25rem;
  transition: color 0.15s ease;
  cursor: pointer;
}

.menu-item-link:hover, .menu-item-link:focus-visible {
  color: var(--primary-600);
}

/* Mega Menu Popovers */
.mega-menu-wrapper {
  position: relative;
}

.mega-popover-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 480px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 9500;
}

.mega-menu-wrapper:hover .mega-popover-panel,
.mega-menu-wrapper:focus-within .mega-popover-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.mega-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.mega-link-item {
  display: block;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s ease;
}

.mega-link-item:hover {
  background: var(--bg-secondary);
}

.mega-link-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

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

/* Intelligent Footer */
.intelligent-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem 0;
}

.footer-columns-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.footer-col-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 1.25rem;
}

.footer-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links-list li {
  margin-bottom: 0.65rem;
}

.footer-links-list a {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links-list a:hover {
  color: var(--primary-600);
}

/* Footer Status Bar */
.footer-status-bar {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.status-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #059669;
}

.status-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

/* Mobile Menu Hamburger Button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-main, #1e293b);
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--bg-secondary, #f8fafc);
}

/* Mobile Drawer Overlay */
.platform-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.platform-mobile-drawer.active {
  opacity: 1;
  visibility: visible;
}

.platform-mobile-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 82%;
  max-width: 320px;
  height: 100%;
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.platform-mobile-drawer.active .platform-mobile-drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 0.25rem;
}

.drawer-nav-list {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
}

.drawer-nav-item {
  border-bottom: 1px solid #f1f5f9;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  text-decoration: none;
  transition: background 0.15s;
}

.drawer-nav-link:hover {
  background: #f8fafc;
  color: #2563eb;
}

/* Universal Command Palette / Search Modal */
.universal-search-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.universal-search-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.universal-search-modal {
  width: 90%;
  max-width: 600px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transform: translateY(-20px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.universal-search-backdrop.active .universal-search-modal {
  transform: translateY(0) scale(1);
}

.search-modal-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.search-modal-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 1.1rem;
  font-weight: 500;
  color: #1e293b;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  height: auto !important;
}

.search-modal-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.search-result-item:hover, .search-result-item.selected {
  background: #f1f5f9;
}

.search-result-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

.search-result-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.search-modal-footer {
  padding: 0.65rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Dark Mode Variables & Harmonization */
body.dark-theme, html.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --border-color: #334155;
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

body.dark-theme .platform-header-nav, html.dark .platform-header-nav {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: #334155;
}

body.dark-theme .mega-popover-panel, html.dark .mega-popover-panel {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .mega-link-title, html.dark .mega-link-title {
  color: #f8fafc;
}

body.dark-theme .intelligent-footer, html.dark .intelligent-footer {
  background: #090d16;
  border-top-color: #334155;
}

body.dark-theme .footer-status-bar, html.dark .footer-status-bar {
  border-top-color: #334155;
}

body.dark-theme .platform-mobile-drawer-panel, html.dark .platform-mobile-drawer-panel {
  background: #0f172a;
  color: #f8fafc;
}

body.dark-theme .drawer-header, html.dark .drawer-header,
body.dark-theme .drawer-nav-item, html.dark .drawer-nav-item {
  border-color: #334155;
}

body.dark-theme .drawer-nav-link, html.dark .drawer-nav-link {
  color: #f8fafc;
}

body.dark-theme .universal-search-modal, html.dark .universal-search-modal {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .search-modal-header, html.dark .search-modal-header,
body.dark-theme .search-modal-footer, html.dark .search-modal-footer {
  border-color: #334155;
  background: #0f172a;
}

body.dark-theme .search-modal-input, html.dark .search-modal-input {
  color: #f8fafc !important;
}

body.dark-theme .search-result-title, html.dark .search-result-title {
  color: #f8fafc;
}

body.dark-theme .search-result-item:hover, html.dark .search-result-item:hover {
  background: #334155;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .primary-menu-list {
    display: none;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .footer-columns-grid {
    grid-template-columns: 1fr;
  }
}
