/* ==========================================================================
   Portfolio & Multi-Project Overview Styles
   ========================================================================== */

.portfolio-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1300px;
  margin: 0 auto;
}

.portfolio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.portfolio-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portfolio-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.portfolio-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.project-card-meta {
  display: flex;
  flex-direction: column;
}

.project-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.project-card-key {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.health-pill {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.health-pill.on-track {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.health-pill.at-risk {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.health-pill.delayed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.project-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.progress-fill-done {
  background: #10b981;
  height: 100%;
}

.progress-fill-inprogress {
  background: #f59e0b;
  height: 100%;
}

.progress-fill-todo {
  background: #0ea5e9;
  height: 100%;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-lead-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* My Unified Work View */
.my-work-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.my-work-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.my-work-table th,
.my-work-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.my-work-table th {
  background: var(--bg-surface-elevated);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.my-work-table tr:hover td {
  background: var(--bg-card-hover);
  cursor: pointer;
}

/* --- Portfolio Status Filters & Toolbar --- */
.portfolio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.portfolio-filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.portfolio-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.portfolio-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.portfolio-tab.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.portfolio-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  min-width: 320px;
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.portfolio-search-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-light);
}

.portfolio-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.84rem;
  width: 100%;
}

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

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
}

.btn-clear-search:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.kpi-card.active-kpi {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 2px var(--brand-primary-border);
  transform: translateY(-2px);
}

/* --- Project Card Status Control --- */
.project-status-control {
  position: relative;
  z-index: 2;
}

.project-status-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 26px 5px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 8px;
}

.project-status-select:hover {
  filter: brightness(1.15);
}

.project-status-select.status-ongoing {
  background-color: rgba(56, 139, 253, 0.16);
  color: #58a6ff;
  border-color: rgba(56, 139, 253, 0.4);
}

.project-status-select.status-under-amc {
  background-color: rgba(163, 113, 247, 0.16);
  color: #bc8cff;
  border-color: rgba(163, 113, 247, 0.4);
}

.project-status-select.status-changes-started {
  background-color: rgba(210, 153, 34, 0.16);
  color: #d29922;
  border-color: rgba(210, 153, 34, 0.4);
}

.project-status-select.status-done {
  background-color: rgba(63, 185, 80, 0.16);
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.4);
}

/* --- Repo Path Row --- */
.repo-path-row {
  display: flex;
  align-items: center;
}

.repo-path-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 100%;
}

.repo-path-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.repo-path-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-badge {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.repo-path-pill:hover .copy-badge {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.15);
}

/* --- Tech Tags --- */
.tech-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tech-tag-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.71rem;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
}

.tech-tag-more {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Responsive Portfolio */
@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .portfolio-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

