/* Portfolio Page Styles - Galaxy Theme with Glassmorphism */

/* Portfolio Section Base */
.portfolio-section {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Galaxy Background */
.portfolio-galaxy-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.portfolio-stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #eee, transparent),
    radial-gradient(2px 2px at 40px 70px, #eee, transparent),
    radial-gradient(1px 1px at 50px 90px, #eee, transparent),
    radial-gradient(1px 1px at 130px 80px, #eee, transparent),
    radial-gradient(2px 2px at 200px 10px, #eee, transparent),
    radial-gradient(1px 1px at 300px 60px, #eee, transparent),
    radial-gradient(2px 2px at 250px 150px, #eee, transparent),
    radial-gradient(1px 1px at 180px 200px, #eee, transparent);
  background-size: 300px 300px;
  background-repeat: repeat;
  opacity: 0.3;
  animation: drift 100s linear infinite;
}

.portfolio-nebula {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
              radial-gradient(ellipse at bottom, rgba(30, 144, 255, 0.1) 0%, transparent 50%);
  opacity: 0.5;
  animation: nebulaPulse 20s ease-in-out infinite;
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-300px, -300px); }
}

@keyframes nebulaPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* Portfolio Content */
.portfolio-content {
  position: relative;
  z-index: 1;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Portfolio Header */
.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 48px;
  flex-wrap: wrap;
  gap: 24px;
}

.wallet-info {
  flex: 1;
  min-width: 300px;
}

.portfolio-title {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.wallet-address-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  width: fit-content;
}

.address-text {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.02em;
}

.copy-address-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
}

.copy-address-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
}

/* Portfolio Value */
.portfolio-value {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px 32px;
  text-align: right;
}

.value-label {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value-amount {
  display: block;
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.value-change {
  display: inline-block;
  font-size: 16px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.value-change.negative {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Portfolio Stats */
.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
}

.stat-info {
  flex: 1;
}

.stat-label {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

/* Holdings Section */
.holdings-section {
  margin-bottom: 48px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

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

.holding-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.holding-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.holding-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.token-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
}

.token-info {
  flex: 1;
}

.token-symbol {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: block;
}

.token-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.holding-details {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.balance-info {
  flex: 1;
}

.balance-amount {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  display: block;
  margin-bottom: 4px;
}

.balance-value {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.token-change {
  text-align: right;
  font-size: 14px;
  font-weight: 500;
}

.token-change.positive {
  color: #10b981;
}

.token-change.negative {
  color: #ef4444;
}

/* No Holdings State */
.no-holdings {
  text-align: center;
  padding: 80px 20px;
  color: rgba(255, 255, 255, 0.5);
}

.no-holdings svg {
  margin-bottom: 20px;
  opacity: 0.3;
}

.no-holdings p {
  font-size: 16px;
}

/* Transactions Section */
.transactions-section {
  margin-bottom: 48px;
}

.transactions-list {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
}

.transaction-item {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s ease;
}

.transaction-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

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

.transaction-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.transaction-icon.send {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.transaction-icon.receive {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.transaction-icon.swap {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.transaction-details {
  flex: 1;
}

.transaction-type {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.transaction-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.transaction-amount {
  text-align: right;
}

.amount-crypto {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: block;
  margin-bottom: 4px;
}

.amount-fiat {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.no-transactions {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.5);
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.05) 25%, 
    rgba(255, 255, 255, 0.1) 50%, 
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 1200px) {
  .portfolio-content {
    padding: 24px;
  }
  
  .holdings-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Tablet Styles */
@media (max-width: 768px) {
  /* Disable performance-heavy animations on mobile */
  .portfolio-stars,
  .portfolio-nebula {
    animation: none;
    opacity: 0.2;
  }
  
  .portfolio-content {
    padding: 20px;
    padding-top: 80px; /* Account for fixed header */
  }
  
  .portfolio-header {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
  }
  
  .portfolio-title {
    font-size: 28px;
    margin-bottom: 12px;
  }
  
  .wallet-address-display {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
  }
  
  .address-text {
    font-size: 13px;
  }
  
  .portfolio-value {
    width: 100%;
    text-align: center;
    padding: 20px 24px;
  }
  
  .value-amount {
    font-size: 36px;
  }
  
  .value-change {
    font-size: 14px;
  }
  
  .portfolio-stats {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
  }
  
  .stat-card {
    padding: 16px 20px;
    gap: 16px;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
  }
  
  .stat-label {
    font-size: 13px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  .holdings-section,
  .transactions-section {
    margin-bottom: 32px;
  }
  
  .section-title {
    font-size: 20px;
    margin-bottom: 16px;
  }
  
  .holdings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .holding-card {
    padding: 16px;
  }
  
  .token-icon {
    width: 36px;
    height: 36px;
  }
  
  .token-symbol {
    font-size: 15px;
  }
  
  .balance-value {
    font-size: 18px;
  }
  
  .wallet-info {
    min-width: 100%;
  }
  
  .transaction-item {
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .transaction-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .transaction-details {
    flex: 1;
    min-width: 150px;
  }
  
  .transaction-amount {
    width: 100%;
    text-align: left;
    padding-left: 52px;
  }
}

/* Mobile Styles */
@media (max-width: 480px) {
  .portfolio-content {
    padding: 16px;
    padding-top: 76px; /* Account for mobile header */
  }
  
  .portfolio-header {
    gap: 16px;
    margin-bottom: 24px;
  }
  
  .portfolio-title {
    font-size: 24px;
    margin-bottom: 8px;
  }
  
  .wallet-address-display {
    padding: 10px 12px;
    border-radius: 10px;
  }
  
  .address-text {
    font-size: 12px;
  }
  
  .copy-address-btn {
    padding: 2px;
  }
  
  .copy-address-btn svg {
    width: 14px;
    height: 14px;
  }
  
  .portfolio-value {
    padding: 16px 20px;
    border-radius: 16px;
  }
  
  .value-label {
    font-size: 12px;
    margin-bottom: 6px;
  }
  
  .value-amount {
    font-size: 28px;
    margin-bottom: 6px;
  }
  
  .value-change {
    font-size: 13px;
    padding: 3px 10px;
  }
  
  .portfolio-stats {
    gap: 10px;
    margin-bottom: 24px;
  }
  
  .stat-card {
    padding: 14px 16px;
    border-radius: 12px;
    gap: 12px;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  
  .stat-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .stat-value {
    font-size: 18px;
  }
  
  .holdings-section,
  .transactions-section {
    margin-bottom: 24px;
  }
  
  .section-title {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  .holdings-grid {
    gap: 10px;
  }
  
  .holding-card {
    padding: 14px;
    border-radius: 12px;
  }
  
  .holding-header {
    gap: 10px;
    margin-bottom: 12px;
  }
  
  .token-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .token-symbol {
    font-size: 14px;
  }
  
  .token-name {
    font-size: 11px;
  }
  
  .balance-amount {
    font-size: 13px;
  }
  
  .balance-value {
    font-size: 16px;
  }
  
  .token-change {
    font-size: 13px;
  }
  
  .transactions-list {
    border-radius: 12px;
  }
  
  .transaction-item {
    padding: 14px 16px;
  }
  
  .transaction-info {
    gap: 12px;
  }
  
  .transaction-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .transaction-type {
    font-size: 14px;
  }
  
  .transaction-time {
    font-size: 11px;
  }
  
  .transaction-amount {
    padding-left: 44px;
  }
  
  .amount-crypto {
    font-size: 14px;
  }
  
  .amount-fiat {
    font-size: 11px;
  }
  
  .no-holdings,
  .no-transactions {
    padding: 60px 16px;
  }
  
  .no-holdings svg {
    width: 48px;
    height: 48px;
  }
  
  .no-holdings p,
  .no-transactions p {
    font-size: 14px;
  }
}

/* Small Mobile Optimization */
@media (max-width: 380px) {
  .portfolio-content {
    padding: 12px;
    padding-top: 72px;
  }
  
  .portfolio-title {
    font-size: 22px;
  }
  
  .value-amount {
    font-size: 24px;
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-value {
    font-size: 16px;
  }
  
  .holding-card {
    padding: 12px;
  }
  
  .transaction-item {
    padding: 12px;
  }
}

/* Touch-friendly optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .copy-address-btn,
  .holding-card,
  .transaction-item {
    min-height: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .holding-card:hover,
  .transaction-item:hover,
  .stat-card:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.03);
  }
  
  /* Add active states for better feedback */
  .holding-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .copy-address-btn:active {
    transform: scale(0.9);
  }
}

/* Optimize for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
  .portfolio-content {
    padding-top: calc(80px + env(safe-area-inset-top));
  }
  
  @media (max-width: 480px) {
    .portfolio-content {
      padding-top: calc(76px + env(safe-area-inset-top));
      padding-left: calc(16px + env(safe-area-inset-left));
      padding-right: calc(16px + env(safe-area-inset-right));
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
  }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
  /* Reduce blur effects for better performance */
  .portfolio-value,
  .stat-card,
  .holding-card,
  .transactions-list,
  .wallet-address-display {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
  
  /* Disable complex animations */
  * {
    animation-duration: 0.3s !important;
  }
  
  /* Use GPU acceleration for transforms */
  .holding-card,
  .stat-card,
  .transaction-item {
    transform: translateZ(0);
    will-change: transform;
  }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  
  .portfolio-stars,
  .portfolio-nebula {
    display: none;
  }
}

/* Pull-to-refresh styles */
.pull-to-refresh-indicator {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 60px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: none;
  z-index: 10;
  pointer-events: none;
}

.refresh-icon {
  color: rgba(255, 255, 255, 0.8);
  transition: transform 0.3s ease;
}

.refresh-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  text-align: center;
}

.pull-to-refresh-indicator.can-refresh .refresh-icon {
  color: #10b981;
}

.pull-to-refresh-indicator.refreshing .refresh-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}