/* Doctor Serial Cloud — Main Application & Layout Styles */

/* App Layout Grid - Unified Shell */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Topbar Layout */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  height: var(--topbar-height, 60px);
  min-height: 60px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  flex-shrink: 0;
  box-sizing: border-box;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 8px;
}

.topbar-logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--accent);
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.topbar-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Mobile Menu Base Styles (Desktop) */
.mobile-menu-toggle {
  display: none;
}
.topbar-collapse {
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: space-between;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 12px;
}

.topbar-link {
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-link:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.topbar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-search {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  width: 200px;
  flex-shrink: 0;
  cursor: text;
  transition: border-color var(--transition-fast);
}

.topbar-search:hover {
  border-color: var(--border-control);
}

.topbar-search-kbd {
  margin-left: auto;
  font-size: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  padding: 2px 5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding-left: 10px;
  border-left: 1px solid var(--bg-border);
  flex-shrink: 0;
}

/* Main Area Layout */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--canvas);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Auth Layout */
.auth-layout {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Flat fill. No background gradients anywhere (design.md §13). */
  background: var(--canvas);
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .topbar {
    padding: 12px 16px;
    justify-content: space-between;
    position: relative; /* For absolute dropdown positioning */
  }
  
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
  }
  
  .topbar-collapse {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%; /* Just below topbar */
    left: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--bg-border);
    padding: 16px 24px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    align-items: stretch;
    gap: 16px;
  }
  
  .topbar-collapse.active {
    display: flex;
  }
  
  .topbar-nav {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  
  .topbar-link {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px !important;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-start;
    border-top: 1px solid var(--bg-border);
    padding-top: 16px;
    margin-left: 0;
    width: 100%;
    gap: 12px;
  }
  
  .topbar-profile {
    padding-left: 0;
    border-left: none;
  }

  .topbar-search {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 16px;
  }
}
