/**
 * Atlas Core Embedded Styles
 * 
 * Custom styles for the embedded version of Olympus Atlas
 * when running inside the Atlas Core desktop application.
 */

/* Embedded mode specific adjustments */
body.atlas-core-embedded {
  /* Remove any unnecessary padding/margins for tighter integration */
  margin: 0;
  padding: 0;
}

/* Cleaner topbar for embedded mode */
body.atlas-core-embedded .topbar {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 14, 20, 0.95);
}

/* Enhanced brand styling */
body.atlas-core-embedded .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

body.atlas-core-embedded .brand-icon {
  font-size: 20px;
}

body.atlas-core-embedded .brand-text {
  font-weight: 750;
  font-size: 16px;
  letter-spacing: -0.2px;
  color: rgba(219, 234, 254, 0.95);
}

/* Connection status indicator */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.connection-status:hover {
  background: rgba(255, 255, 255, 0.08);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.status-indicator.connected {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-indicator.disconnected {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulse-red 2s infinite;
}

.status-indicator.waiting {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: pulse-yellow 1.5s infinite;
}

.status-indicator.error {
  background: #ef4444;
}

.status-text {
  font-weight: 500;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* Session expired / auth view styling for embedded mode */
body.atlas-core-embedded .authCard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

body.atlas-core-embedded .authCard .authLogo {
  font-size: 56px;
  margin-bottom: 20px;
}

body.atlas-core-embedded .authCard h1 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--text);
}

body.atlas-core-embedded .authCard p.muted {
  font-size: 14px;
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto 24px;
}

body.atlas-core-embedded #refreshSessionBtn {
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
}

/* Hide login form in embedded mode - not needed */
body.atlas-core-embedded .authForm {
  display: none !important;
}

body.atlas-core-embedded .authFooter {
  margin-top: 0;
}

/* Tighter main content wrapper */
body.atlas-core-embedded .wrap {
  padding: 16px 20px;
  max-width: 100%;
}

/* Better spacing for board view */
body.atlas-core-embedded #appView .row.space {
  padding: 0 4px;
}

body.atlas-core-embedded #boardTitle {
  font-size: 20px;
  font-weight: 600;
}

body.atlas-core-embedded #projectTitle {
  font-size: 13px;
}

/* Enhanced nav tabs for embedded */
body.atlas-core-embedded .mainNav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0;
  background: transparent;
  justify-content: center;
}

body.atlas-core-embedded .navGroup {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 12px;
}

body.atlas-core-embedded .navGroupLabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.78);
  padding: 0 8px;
  border-right: 1px solid var(--border);
  user-select: none;
}

/* Dropdown section titles (More menu) */
body.atlas-core-embedded .navMenuSectionLabel {
  color: rgba(147, 197, 253, 0.78);
}

body.atlas-core-embedded .navMenuSection.adminOnly .navMenuSectionLabel {
  color: rgba(248, 113, 113, 0.92);
}

/* Dropdown headers (e.g., Notifications) */
body.atlas-core-embedded .notificationHeader h3 {
  color: rgba(219, 234, 254, 0.95);
}

body.atlas-core-embedded .navGroupTabs {
  display: flex;
  gap: 4px;
}

body.atlas-core-embedded .navTab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.atlas-core-embedded .navMenuBtn {
  padding: 8px 16px;
  border-radius: 8px;
  background: transparent;
  border: none;
}

body.atlas-core-embedded .navMenuBtn:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.atlas-core-embedded .navMenuBtn.active {
  background: rgba(59, 130, 246, 0.12);
}

body.atlas-core-embedded .navTab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

body.atlas-core-embedded .navTab.active {
  color: var(--text);
  background: rgba(59, 130, 246, 0.15);
}

/* Admin-only nav tabs - red styling to indicate admin features */
body.atlas-core-embedded .navTab.adminOnly {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

body.atlas-core-embedded .navTab.adminOnly:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

body.atlas-core-embedded .navTab.adminOnly.active {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Project selector improvements */
body.atlas-core-embedded .projectSelectorBtn {
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

body.atlas-core-embedded .projectSelectorBtn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

/* Notification improvements */
body.atlas-core-embedded .notificationContainer {
  position: relative;
}

body.atlas-core-embedded .headerBtn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

body.atlas-core-embedded .headerBtn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
}

body.atlas-core-embedded .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Better presence pills */
body.atlas-core-embedded .presence {
  display: flex;
  gap: 6px;
}

body.atlas-core-embedded .pill {
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

/* Board columns */
body.atlas-core-embedded .board {
  margin-top: 16px;
  gap: 14px;
}

body.atlas-core-embedded .column {
  border-radius: 14px;
  padding: 12px;
}

/* Wiki layout improvements */
body.atlas-core-embedded .wikiLayout {
  gap: 16px;
}

body.atlas-core-embedded .wikiSidebar {
  border-radius: 14px;
}

/* Chat layout improvements */
body.atlas-core-embedded .chatLayout {
  gap: 16px;
}

body.atlas-core-embedded .chatSidebar {
  border-radius: 14px;
}

/* Modal improvements */
body.atlas-core-embedded .modal {
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.7);
}

body.atlas-core-embedded .modalCard {
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Profile view (read-only in embedded) */
body.atlas-core-embedded .portfolioHero {
  border-radius: 14px;
  overflow: hidden;
}

body.atlas-core-embedded .portfolioCard {
  border-radius: 14px;
}

/* Scrollbar styling for embedded */
body.atlas-core-embedded ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.atlas-core-embedded ::-webkit-scrollbar-track {
  background: transparent;
}

body.atlas-core-embedded ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

body.atlas-core-embedded ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Responsive adjustments for embedded */
@media (max-width: 900px) {
  body.atlas-core-embedded .topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
  }

  body.atlas-core-embedded .mainNav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }

  body.atlas-core-embedded .connection-status .status-text {
    display: none;
  }
}

/* Compact mode for smaller embedded windows */
body.atlas-core-embedded.compact .topbar {
  padding: 6px 12px;
}

body.atlas-core-embedded.compact .navTab {
  padding: 6px 12px;
  font-size: 12px;
}

body.atlas-core-embedded.compact .wrap {
  padding: 12px;
}

body.atlas-core-embedded.compact .board {
  grid-auto-columns: 280px;
}

/* Loading state */
body.atlas-core-embedded .loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

body.atlas-core-embedded .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.atlas-core-embedded .loading-text {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Ensure hidden elements stay hidden */
body.atlas-core-embedded #logoutBtn,
body.atlas-core-embedded #profileBtn,
body.atlas-core-embedded #loginForm {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Profile actions hidden in embedded - managed by Atlas Core */
body.atlas-core-embedded .profileActions {
  display: none !important;
}

body.atlas-core-embedded #editProfileBtn,
body.atlas-core-embedded #profileMenuWrapper {
  display: none !important;
}

/* Smooth transitions */
body.atlas-core-embedded section {
  transition: opacity 0.2s ease;
}

body.atlas-core-embedded section.hidden {
  opacity: 0;
}
