/* Portfolio Borrowing Overview - Portfolio Level */
.portfolio-borrowing-overview {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.borrowing-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: -0.01em;
}

/* Borrowing Overview - Two stats with divider */
.borrowing-overview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.overview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.overview-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.overview-value {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.overview-usd {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.overview-divider {
  font-size: 20px;
  color: #d1d5db;
  font-weight: 300;
}

.portfolio-borrow-utilization {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.portfolio-borrow-utilization .utilization-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.portfolio-borrow-utilization .utilization-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

.portfolio-borrow-utilization .utilization-percentage {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.portfolio-borrow-utilization .utilization-bar-container {
  margin-bottom: 0;
}

.portfolio-borrow-utilization .utilization-bar {
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.portfolio-borrow-utilization .utilization-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 6px;
  transition: width 0.5s ease;
}

/* Portfolio Page Styles - Matching Figma Design Language */

.portfolio-subpage {
  min-height: 100vh;
  background: #f8f9fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.portfolio-subpage .content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  /* Remove padding to allow full-width background */
  width: 100%;
  box-sizing: border-box;
}

/* Full-width grey background for portfolio summary */
.portfolio-summary-wrapper {
  background: #f3f4f6;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 32px 0;
}

.portfolio-summary {
  background: white;
  border-radius: 16px;
  padding: 32px;
  margin: 0 auto;
  max-width: 1200px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Portfolio grid wrapper with padding */
.portfolio-grid-wrapper {
  padding: 24px;
}

.portfolio-header h1 {
  font-size: 48px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 24px 0;
  letter-spacing: -0.02em;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.stat-group {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: 14px;
  font-weight: 600;
}

.stat-change.positive {
  color: #10b981;
}

.stat-change.negative {
  color: #ef4444;
}

/* Portfolio Grid - Updated with separators */
.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  /* Remove gap since we'll use separators */
}

/* Project Cards - Updated with separators */
.portfolio-project-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
  width: 100%;
  max-width: none;
  margin-bottom: 40px;
  position: relative;
}

/* Add separator line after each card except the last one */
.portfolio-project-card:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: -20px;
  /* Half of margin-bottom for centered positioning */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  /* Slightly narrower than card width */
  height: 2px;
  background: linear-gradient(90deg, transparent, #d1d5db 15%, #d1d5db 85%, transparent);
  z-index: 1;
}

.portfolio-project-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  z-index: 2;
  /* Ensure hovered card appears above separator */
}

/* Project Header - Split into three sections */
.project-card-header {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin-bottom: 24px;
  min-height: 120px;
}

/* Left Section - Project Info (Clickable) */
.project-info-section {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 12px;
  padding: 8px;
  margin: -8px;
}

.project-info-section:hover {
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-1px);
}

.project-logo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-placeholder {
  font-size: 18px;
  font-weight: 700;
  color: #6b7280;
}

.project-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #1a1a1a;
}

.project-symbol {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

.project-website {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 4px 0;
}

.token-price {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  margin-bottom: 4px;
}

.token-address-inline {
  font-size: 11px;
  color: #6b7280;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.token-address-inline .address-label {
  font-weight: 500;
  margin-right: 4px;
}

.token-address-inline .address-value {
  font-weight: 600;
  color: #374151;
}

/* Middle Section - Total Holdings Display */
.total-holdings-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
}

.holdings-number {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  text-align: center;
  line-height: 1.2;
}

.holdings-value {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  text-align: center;
}

/* Right Section - Holdings and Capacity Cards */
.project-holdings-section {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  justify-content: flex-end;
}

.holdings-card,
.capacity-card {
  background: #f8f9fa;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  min-width: 160px;
  border: 1px solid #e5e7eb;
}

.holdings-card .stat-label,
.capacity-card .stat-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.holdings-card .stat-value,
.capacity-card .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 6px;
  line-height: 1.2;
}

.holdings-card .stat-usd,
.capacity-card .stat-usd {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 8px;
}

.holdings-card .stat-breakdown,
.capacity-card .stat-breakdown {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

/* Remove old portfolio stats grid styles since they're now in header */

/* Remove old borrowing section styles */

/* Section Titles */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: -0.01em;
}

/* Borrowing Detail - Just funding rate now */
.borrowing-detail {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.detail-value {
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

/* Action Flow Section - Redesigned layout */
.action-flow-section {
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

/* Staking Indicator - Visual pointer above bar */
.staking-indicator {
  position: relative;
  height: 40px;
  margin-bottom: 8px;
}

.staking-pointer {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.staking-pointer .pointer-line {
  width: 2px;
  height: 20px;
  background: #374151;
  margin-bottom: 4px;
  border-radius: 1px;
}

.staking-pointer .pointer-label {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.staked-amount {
  font-weight: 700;
  color: #1a1a1a;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.total-amount {
  font-weight: 500;
  color: #6b7280;
  font-size: 10px;
}

/* Claiming Indicator - Visual pointer above bar */
.claiming-indicator {
  position: relative;
  height: 40px;
  margin-bottom: 8px;
}

.claiming-pointer {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.claiming-pointer .pointer-line {
  width: 2px;
  height: 20px;
  background: #ef4444;
  margin-bottom: 4px;
  border-radius: 1px;
}

.claiming-pointer .pointer-label {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.claimed-amount {
  font-weight: 700;
  color: #1a1a1a;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.action-flow-bar {
  height: 32px;
  background: #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  margin-bottom: 20px;
}

.flow-segment {
  height: 100%;
  transition: all 0.3s ease;
}

.flow-segment.borrowed {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.flow-segment.available {
  background: linear-gradient(135deg, #10b981, #059669);
}

.flow-segment.potential {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

/* Action Buttons Row - All 4 buttons in single row */
.action-buttons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.action-cell {
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Claim Cell (JUST CLAIM) */
.action-cell.claim-cell {
  background: transparent;
  color: #10b981;
  border: 2px solid #10b981;
  font-weight: 700;
}

.action-cell.claim-cell:hover {
  transform: translateY(-2px);
  background: #10b981;
  color: white;
}

/* Stake & Claim Cell (STAKE ALL : CLAIM ALL) */
.action-cell.stake-claim-cell {
  background: transparent;
  color: #3b82f6;
  border: 2px solid #3b82f6;
  font-weight: 700;
}

.action-cell.stake-claim-cell:hover {
  transform: translateY(-2px);
  background: #3b82f6;
  color: white;
}

/* Unstake & Return Cell (UNSTAKE ALL : RETURN) */
.action-cell.unstake-return-cell {
  background: transparent;
  color: #f59e0b;
  border: 2px solid #f59e0b;
  font-weight: 700;
}

.action-cell.unstake-return-cell:hover {
  transform: translateY(-2px);
  background: #f59e0b;
  color: white;
}

/* Burn Cell */
.action-cell.burn-cell {
  background: transparent;
  color: #ef4444;
  border: 2px solid #ef4444;
  font-weight: 700;
}

.action-cell.burn-cell:hover {
  transform: translateY(-2px);
  background: #ef4444;
  background: #f59e0b;
  color: white;
}

/* Disabled Cell */
.action-cell.disabled-cell {
  background: #f3f4f6;
  color: #9ca3af;
  border: 2px solid #e5e7eb;
  cursor: not-allowed;
}

.action-cell.disabled-cell:hover {
  transform: none;
  background: #f3f4f6;
  color: #9ca3af;
}

.btn-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  opacity: 0.9;
  line-height: 1.2;
}

.btn-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

/* Remove old project meta styles */

/* Loading and Error States */
.loading-state,
.error-state,
.empty-portfolio {
  text-align: center;
  padding: 64px 32px;
}

.loading-state h1,
.error-state h1,
.empty-portfolio h1 {
  font-size: 48px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.loading-state p {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

.empty-message {
  margin-top: 32px;
}

.empty-message h3 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px 0;
}

.empty-message p {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 24px 0;
}

.back-to-projects-btn,
.retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-to-projects-btn:hover,
.retry-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}

.error-message {
  margin-top: 32px;
}

.error-message h3 {
  font-size: 24px;
  font-weight: 700;
  color: #dc2626;
  margin: 0 0 8px 0;
}

.error-message p {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 24px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .project-holdings-section {
    flex-direction: column;
    gap: 12px;
  }

  .holdings-card,
  .capacity-card {
    min-width: 140px;
    padding: 20px 16px;
  }

  .holdings-card .stat-value,
  .capacity-card .stat-value {
    font-size: 18px;
  }

  .holdings-card .stat-usd,
  .capacity-card .stat-usd {
    font-size: 12px;
  }

  .holdings-card .stat-breakdown,
  .capacity-card .stat-breakdown {
    font-size: 11px;
    padding: 3px 6px;
  }

  .meta-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .portfolio-header h1 {
    font-size: 36px;
  }

  .stat-value {
    font-size: 24px;
  }

  .action-buttons-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .action-cell {
    min-height: 50px;
    padding: 8px 6px;
  }

  .btn-label {
    font-size: 10px;
  }

  .btn-value {
    font-size: 12px;
  }

  .staking-pointer .pointer-label,
  .claiming-pointer .pointer-label {
    font-size: 10px;
    padding: 3px 6px;
  }

  .staked-amount,
  .claimed-amount {
    font-size: 10px;
  }

  .total-amount {
    font-size: 9px;
  }

  /* Responsive separator adjustments */
  .portfolio-project-card:not(:last-child)::after {
    width: calc(100% - 24px);
    /* Adjust for smaller screens */
    bottom: -20px;
  }
}

@media (max-width: 480px) {
  .portfolio-summary {
    padding: 24px;
    margin-bottom: 24px;
  }

  .portfolio-project-card {
    padding: 20px;
    margin-bottom: 32px;
  }

  .project-card-header {
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
  }

  .project-info-section {
    gap: 12px;
  }

  .project-logo {
    width: 60px;
    height: 60px;
  }

  .project-holdings-section {
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
  }

  .holdings-card,
  .capacity-card {
    flex: 1;
    min-width: 0;
    padding: 16px 12px;
  }

  .holdings-card .stat-value,
  .capacity-card .stat-value {
    font-size: 16px;
  }

  .holdings-card .stat-usd,
  .capacity-card .stat-usd {
    font-size: 12px;
  }

  .holdings-card .stat-breakdown,
  .capacity-card .stat-breakdown {
    font-size: 10px;
    padding: 2px 4px;
  }

  .project-name {
    font-size: 18px;
  }

  .portfolio-header h1 {
    font-size: 28px;
  }

  .project-detail-btn {
    align-self: flex-end;
    margin-top: 8px;
  }

  .action-buttons-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-cell {
    min-height: 60px;
    padding: 12px 8px;
  }

  .btn-label {
    font-size: 11px;
  }

  .btn-value {
    font-size: 14px;
  }

  .staking-indicator,
  .claiming-indicator {
    height: 35px;
    margin-bottom: 6px;
  }

  .staking-pointer .pointer-line,
  .claiming-pointer .pointer-line {
    height: 15px;
  }

  .staking-pointer .pointer-label,
  .claiming-pointer .pointer-label {
    font-size: 9px;
    padding: 2px 4px;
  }

  .staked-amount,
  .claimed-amount {
    font-size: 9px;
  }

  .total-amount {
    font-size: 8px;
  }

  /* Responsive separator adjustments for mobile */
  .portfolio-project-card:not(:last-child)::after {
    bottom: -16px;
    width: calc(100% - 20px);
  }
}

/* Animation keyframes */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portfolio-project-card {
  animation: slideUp 0.3s ease forwards;
}

.portfolio-project-card:nth-child(1) {
  animation-delay: 0.1s;
}

.portfolio-project-card:nth-child(2) {
  animation-delay: 0.2s;
}

.portfolio-project-card:nth-child(3) {
  animation-delay: 0.3s;
}

.portfolio-project-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* Focus states for accessibility */
.action-cell:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.project-detail-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}