/*
 * PAGE-HEADER.CSS - Consistent Page Headers
 * Part of Simpler Design System
 *
 * Usage:
 *   <div class="page-header">
 *     <div class="page-header-left">
 *       <h1 class="page-header-title">Page Title</h1>
 *       <p class="page-header-subtitle">Optional subtitle text</p>
 *     </div>
 *     <div class="page-header-actions">
 *       <button class="btn-tech">Action</button>
 *     </div>
 *   </div>
 *
 * Variants:
 *   - .page-header-with-tabs: Use when tabs appear below header
 */

/* ===========================================
   MAIN CONTAINER
   =========================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ===========================================
   LEFT SIDE - TITLE AREA
   =========================================== */

.page-header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0; /* Allows text truncation */
}

.page-header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================================
   RIGHT SIDE - ACTIONS AREA
   =========================================== */

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ===========================================
   VARIANT: WITH TABS
   When tabs appear below the header, remove
   the bottom border (tabs will have it)
   =========================================== */

.page-header-with-tabs {
  border-bottom: none;
}

/* Tabs container that goes below page-header-with-tabs */
.page-header-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  height: 44px;
}

.page-header-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  margin-bottom: -1px; /* Overlap border */
}

.page-header-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.page-header-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-primary);
}

/* ===========================================
   RESPONSIVE ADJUSTMENTS
   =========================================== */

@media (max-width: 768px) {
  .page-header {
    padding: 0 16px;
    min-height: 56px;
    height: auto;
  }

  .page-header-title {
    font-size: 16px;
  }

  .page-header-subtitle {
    font-size: 13px;
    white-space: normal;
  }

  .page-header-actions {
    gap: 8px;
  }

  .page-header-tabs {
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-header-tab {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

/* ===========================================
   CONTENT WRAPPER CLASSES
   Standard padding for page content areas
   =========================================== */

.page-content {
  padding: 24px;
}

.page-content-flush {
  padding: 0;
}

/* For pages with sidebar layouts */
.page-content-with-sidebar {
  display: flex;
  height: calc(100vh - 64px);
}

.page-content-with-sidebar > .sidebar {
  flex-shrink: 0;
}

.page-content-with-sidebar > .content-area {
  flex: 1;
  overflow: auto;
}

@media (max-width: 768px) {
  .page-content {
    padding: 16px;
  }

  .page-content-with-sidebar {
    flex-direction: column;
    height: auto;
  }
}
