/* ============================================
   LAYOUT - Header, Tabs, Content Structure
   Finanzberatung CRM
   ============================================ */

/* Header */
.header {
  background: var(--bg-card);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Add a subtle icon/accent before the logo */
.header h1::before {
  content: '';
  width: 8px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 2px;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px;
  padding-left: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--bg-subtle);
  transition: all var(--transition-fast);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-focus);
}

/* Search icon */
.search-box::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-size: contain;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-subtle);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item .name {
  font-weight: 600;
  color: var(--text);
}

.search-result-item .meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

#settingsBtn {
  order: 10;
}

/* Perspective Selector */
.perspective-selector {
  display: flex;
  gap: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.perspective-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.perspective-btn:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.perspective-btn.active {
  background: var(--primary);
  color: white;
}

@media (max-width: 768px) {
  .perspective-selector { order: -1; }
  .perspective-btn { padding: 4px 8px; font-size: 11px; }
}

/* User Menu */
.user-menu {
  position: relative;
  margin-left: 8px;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.user-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border);
}

.user-icon {
  font-size: 16px;
}

.user-email {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  display: none;
  z-index: 300;
  overflow: hidden;
}

.user-dropdown.active {
  display: block;
}

.user-dropdown-email {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
  background: var(--bg-subtle);
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  background: none;
  border: none;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-dropdown-item:hover {
  background: var(--bg-subtle);
}

.user-dropdown-role {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

/* Account Switcher */
.account-switcher {
  margin-right: 8px;
}

.account-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  min-width: 180px;
  max-width: 250px;
  transition: all var(--transition-fast);
}

.account-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.account-info {
  margin-right: 8px;
  padding: 8px 12px;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-muted);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--primary-dark);
}

.viewing-label {
  color: var(--primary);
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 4px;
}

.tab {
  position: relative;
  padding: 14px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-light);
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
}

/* Active tab indicator */
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* Content */
.content {
  padding: 24px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  border-radius: var(--radius) var(--radius) 0 0;
}

.filters select,
.filters input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition-fast);
}

.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
