/* Investments Page Styles */

/* Override dark mode for investments page */
/* Override dark mode for investments page */
/* We want to rely on the global dark mode variables where possible, but if specific overrides are needed, use variables */
[data-theme="dark"] .summary-card,
[data-theme="dark"] .add-investment-section,
[data-theme="dark"] .investments-container,
[data-theme="dark"] .investment-card,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .loading-state,
[data-theme="dark"] .modal-container {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  border-color: var(--primary-blue);
}

[data-theme="dark"] .form-group label {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-title {
  color: var(--text-primary);
}

[data-theme="dark"] .analytics-section {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

[data-theme="dark"] .analytics-section h3 {
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .analytics-card {
  background: var(--bg-card);
  border-color: var(--primary-blue);
}

[data-theme="dark"] .analytics-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .analytics-value {
  color: var(--text-primary);
}

[data-theme="dark"] .analytics-detail {
  color: var(--text-secondary);
}

[data-theme="dark"] .price-history-table {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .price-history-table tbody tr {
  border-color: var(--border-color);
}

[data-theme="dark"] .price-history-table tbody tr:hover {
  background-color: var(--bg-hover);
}

[data-theme="dark"] .price-history-table tbody td {
  color: var(--text-primary);
}

[data-theme="dark"] .price-history-table tbody td:nth-child(2) {
  color: var(--primary-blue);
}

[data-theme="dark"] .price-history-table tbody td:nth-child(3) {
  color: var(--text-secondary);
}

/* Fix text colors getting lost in dark mode */
[data-theme="dark"] .summary-value {
  color: var(--text-primary);
}
[data-theme="dark"] .add-investment-title {
  color: var(--text-primary);
}
[data-theme="dark"] .investment-name {
  color: var(--text-primary);
}
[data-theme="dark"] .investment-stat-value {
  color: var(--text-primary);
}
[data-theme="dark"] .empty-state-title {
  color: var(--text-primary);
}

/* Investments Tabs */
.investments-tabs-container {
  margin-bottom: 1.5rem;
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  overflow: hidden;
}

.investments-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.investments-tabs::-webkit-scrollbar {
  height: 4px;
}

.investments-tabs::-webkit-scrollbar-track {
  background: #F0F0F0;
}

.investments-tabs::-webkit-scrollbar-thumb {
  background: #4A90E2;
  border-radius: 2px;
}

.tab-button {
  flex: 1;
  min-width: 100px;
  padding: 1rem 0.75rem;
  border: none;
  background: white;
  color: #7F8C8D;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-button:hover {
  background: #F8F9FA;
  color: #4A90E2;
}

.tab-button.active {
  color: #4A90E2;
  border-bottom-color: #4A90E2;
  background: linear-gradient(to bottom, rgba(74, 144, 226, 0.05), transparent);
}

.tab-icon {
  font-size: 1.25rem;
  display: block;
}

.tab-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Portfolio Summary */
.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.summary-card:hover {
  border-color: #00CED1;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  transform: translateY(-2px);
}

.summary-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4A90E2 0%, #00CED1 100%);
  border-radius: 10px;
  flex-shrink: 0;
}

.summary-content {
  flex: 1;
}

.summary-label {
  font-size: 0.8rem;
  color: #7F8C8D;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2C3E50;
}

.summary-change {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.summary-change.positive {
  color: #27AE60;
}

.summary-change.negative {
  color: #E74C3C;
}

/* Add Investment Section */
.add-investment-section {
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  display: none;
  overflow: visible;
}

.add-investment-section.show {
  display: block;
  animation: slideDown 0.3s ease-out;
  overflow: visible;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.add-investment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #E8E8E8;
}

.add-investment-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2C3E50;
  margin: 0;
}

/* Ensure all form inputs in add-investment-section have white background */
.add-investment-section .form-group input,
.add-investment-section .form-group select,
.add-investment-section .form-group textarea {
  background: #FFFFFF !important;
  background-color: #FFFFFF !important;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  overflow: visible;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group-full {
  grid-column: 1 / -1;
  overflow: visible;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2C3E50;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #E8E8E8;
  border-radius: 8px;
  font-size: 1rem;
  color: #2C3E50;
  background: white !important;
  background-color: white !important;
  transition: all 0.25s ease;
  font-family: inherit;
  line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #7F8C8D;
  opacity: 0.6;
}

.form-group select {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%237F8C8D' stroke='none' d='M2 5l6 6 6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 12px;
  padding-right: 40px;
}

.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-group input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.form-group input[type="date"] {
  cursor: pointer;
}

.error-message {
  font-size: 0.875rem;
  color: #E74C3C;
  margin-top: 0.5rem;
  min-height: 20px;
  display: block;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #E8E8E8;
}

.form-actions .btn {
  min-width: 120px;
}

/* Investments Container */
.investments-container {
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  padding: 2rem;
}

.investments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Investment Card */
.investment-card {
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.investment-card:hover {
  border-color: #00CED1;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  transform: translateY(-2px);
}

.investment-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.investment-info {
  flex: 1;
}

.investment-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 0.25rem;
}

.investment-type {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, #4A90E2 0%, #00CED1 100%);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.investment-symbol {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(74, 144, 226, 0.1);
  color: #4A90E2;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.investment-actions {
  display: flex;
  gap: 0.5rem;
}

.investment-actions .btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 2px solid #4A90E2;
  background: white;
  color: #4A90E2;
  cursor: pointer;
  transition: all 0.3s ease;
}

.investment-actions .btn-icon:hover {
  background: #4A90E2;
  color: white;
}

.investment-actions .btn-icon.btn-danger {
  border-color: #E74C3C;
  color: #E74C3C;
}

.investment-actions .btn-icon.btn-danger:hover {
  background: #E74C3C;
  color: white;
}

.investment-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex: 1;
}

.investment-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}

.investment-stats-row:first-child {
  grid-template-columns: 1fr;
}

.investment-stats-row:nth-child(2) {
  grid-template-columns: repeat(2, 1fr);
}

.investment-stats-row:nth-child(3) {
  grid-template-columns: repeat(2, 1fr);
}

.investment-returns-row {
  padding-top: 0.75rem;
  border-top: 1px dashed #E8E8E8;
}

.investment-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.investment-stat-full {
  text-align: center;
  grid-column: 1 / -1;
}

.investment-stat-full .investment-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.investment-stat-full .investment-stat-value.positive {
  color: #27AE60;
}

.investment-stat-full .investment-stat-value.negative {
  color: #E74C3C;
}

.investment-stat-label {
  font-size: 0.75rem;
  color: #7F8C8D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.investment-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: #2C3E50;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.investment-stat-inr {
  font-size: 0.875rem;
  color: #4A90E2;
  font-weight: 600;
  margin-top: 0.25rem;
}

.price-change {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-weight: 600;
}

.price-change.positive {
  color: #27AE60;
}

.price-change.negative {
  color: #E74C3C;
}

.price-change.inr-change {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
}

.live-indicator {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #E74C3C;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.investment-card-footer {
  padding-top: 1rem;
  border-top: 2px solid #E8E8E8;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: auto;
}

.investment-date {
  font-size: 0.875rem;
  color: #7F8C8D;
}

.investment-notes {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #E8E8E8;
  font-size: 0.875rem;
  color: #7F8C8D;
  line-height: 1.5;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 0.5rem;
}

.empty-state-text {
  font-size: 1rem;
  color: #7F8C8D;
  margin-bottom: 2rem;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.loading-state p {
  margin-top: 1rem;
  color: #7F8C8D;
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.show {
  display: flex;
}

.modal-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

.modal-container.modal-sm {
  max-width: 400px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #E8E8E8;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2C3E50;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #7F8C8D;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  font-size: 1.5rem;
}

.modal-close:hover {
  color: #2C3E50;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid #E8E8E8;
}

.delete-info {
  background: #fff5f5;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.delete-info strong {
  display: block;
  font-size: 1rem;
  color: #E74C3C;
  margin-bottom: 0.5rem;
}

/* Price History Modal Styles */
.price-history-analytics {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.analytics-section {
  background: #F8F9FA;
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid #E8E8E8;
}

.analytics-section h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #2C3E50;
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #E8E8E8;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.analytics-card {
  background: white;
  border: 2px solid #4A90E2;
  border-radius: 10px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.analytics-card:hover {
  border-color: #00CED1;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  transform: translateY(-2px);
}

.analytics-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7F8C8D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.analytics-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2C3E50;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.analytics-value.positive {
  color: #27AE60;
}

.analytics-value.negative {
  color: #E74C3C;
}

.analytics-percent {
  font-size: 0.875rem;
  font-weight: 600;
}

.analytics-detail {
  font-size: 0.75rem;
  color: #7F8C8D;
  margin-top: 0.25rem;
}

/* Price History Table */
.price-history-table {
  overflow-x: auto;
  border-radius: 8px;
  border: 2px solid #E8E8E8;
  background: white;
}

.price-history-table table {
  width: 100%;
  border-collapse: collapse;
}

.price-history-table thead {
  background: linear-gradient(135deg, #4A90E2 0%, #00CED1 100%);
}

.price-history-table thead th {
  padding: 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-history-table tbody tr {
  border-bottom: 1px solid #E8E8E8;
  transition: background-color 0.2s ease;
}

.price-history-table tbody tr:last-child {
  border-bottom: none;
}

.price-history-table tbody tr:hover {
  background-color: #F8F9FA;
}

.price-history-table tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #2C3E50;
}

.price-history-table tbody td:nth-child(2) {
  font-weight: 600;
  color: #4A90E2;
}

.price-history-table tbody td:nth-child(3) {
  color: #7F8C8D;
  font-style: italic;
}

/* Loading State in Modal */
.modal-body .loading {
  text-align: center;
  padding: 3rem 1rem;
  color: #7F8C8D;
  font-size: 1rem;
}

.modal-body .loading::before {
  content: "⏳";
  display: block;
  font-size: 2rem;
  margin-bottom: 1rem;
  animation: pulse 1.5s infinite;
}

/* Error State in Modal */
.modal-body .error-message {
  text-align: center;
  padding: 3rem 1rem;
  color: #E74C3C;
  font-size: 1rem;
  background: #fff5f5;
  border-radius: 8px;
  border: 2px solid #E74C3C;
}

.modal-body .error-message::before {
  content: "⚠️";
  display: block;
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .investments-tabs-container {
    margin-bottom: 1rem;
  }

  .investments-tabs {
    gap: 0;
  }

  .tab-button {
    flex: 1;
    min-width: 70px;
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.375rem;
  }

  .tab-icon {
    font-size: 1rem;
  }

  .tab-label {
    font-size: 0.65rem;
  }

  .portfolio-summary {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .summary-card {
    padding: 0.75rem;
    flex-direction: row;
    text-align: left;
    gap: 0.75rem;
    min-height: auto;
  }
  
  .summary-icon {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    flex-shrink: 0;
  }
  
  .summary-label {
    font-size: 0.65rem;
  }
  
  .summary-value {
    font-size: 0.95rem;
  }
  
  .summary-change {
    font-size: 0.75rem;
  }

  .add-investment-section {
    padding: 1.5rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .form-group {
    margin-bottom: 0;
  }
  
  .form-group-full {
    grid-column: 1 / -1;
  }
  
  .form-group label {
    margin-bottom: 4px;
    font-size: 13px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 14px;
  }

  .form-actions {
    flex-direction: row;
    gap: 10px;
  }

  .form-actions .btn {
    flex: 1;
  }

  .investments-container {
    padding: 1.5rem;
  }

  .investments-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .investment-card {
    padding: 1rem;
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .investment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
  }

  .investment-info {
    flex: 1;
    min-width: 0;
  }

  .investment-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2C3E50;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .investment-type {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #4A90E2 0%, #00CED1 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-right: 0.25rem;
  }

  .investment-symbol {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(74, 144, 226, 0.1);
    color: #4A90E2;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
  }

  .investment-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
  }

  .investment-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1.5px solid #4A90E2;
    background: white;
    color: #4A90E2;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
  }

  .investment-actions .btn-icon:hover {
    background: #4A90E2;
    color: white;
  }

  .investment-actions .btn-icon.btn-danger {
    border-color: #E74C3C;
    color: #E74C3C;
  }

  .investment-actions .btn-icon.btn-danger:hover {
    background: #E74C3C;
    color: white;
  }

  .investment-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex: 1;
  }

  .investment-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    width: 100%;
  }

  .investment-stats-row:first-child {
    grid-template-columns: 1fr;
  }

  .investment-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .investment-stat-label {
    font-size: 0.65rem;
    color: #7F8C8D;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
  }

  .investment-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2C3E50;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .investment-stat-inr {
    font-size: 0.75rem;
    color: #4A90E2;
    font-weight: 600;
    margin-top: 0.125rem;
  }

  .price-change {
    font-size: 0.7rem;
    margin-top: 0.125rem;
    font-weight: 600;
  }

  .price-change.positive {
    color: #27AE60;
  }

  .price-change.negative {
    color: #E74C3C;
  }

  .investment-returns-row {
    padding-top: 0.5rem;
    border-top: 1px dashed #E8E8E8;
    margin-top: 0.5rem;
  }

  .investment-stat-full {
    text-align: center;
    grid-column: 1 / -1;
  }

  .investment-stat-full .investment-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
  }

  .investment-stat-full .investment-stat-value.positive {
    color: #27AE60;
  }

  .investment-stat-full .investment-stat-value.negative {
    color: #E74C3C;
  }

  .investment-card-footer {
    padding-top: 0.75rem;
    border-top: 1px solid #E8E8E8;
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
  }

  .investment-date {
    font-size: 0.75rem;
    color: #7F8C8D;
    line-height: 1.3;
  }

  .investment-notes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #E8E8E8;
    font-size: 0.75rem;
    color: #7F8C8D;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .modal-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .modal-body {
    padding: 12px;
  }
  
  .modal-header {
    padding: 12px;
  }
  
  .modal-footer {
    padding: 12px;
    gap: 10px;
  }

  /* Price History Modal - Mobile */
  .price-history-analytics {
    gap: 1rem;
  }

  .analytics-section {
    padding: 1rem;
  }

  .analytics-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .analytics-card {
    padding: 0.75rem;
  }

  .analytics-label {
    font-size: 0.65rem;
    margin-bottom: 0.375rem;
  }

  .analytics-value {
    font-size: 1rem;
    gap: 0.25rem;
  }

  .analytics-percent {
    font-size: 0.75rem;
  }

  .analytics-detail {
    font-size: 0.65rem;
  }

  .price-history-table thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }

  .price-history-table tbody td {
    padding: 0.625rem 0.5rem;
    font-size: 0.75rem;
  }

  .empty-state {
    padding: 2rem 1rem;
    min-height: 350px;
  }

  .empty-state-icon {
    font-size: 64px;
    margin-bottom: 1rem;
  }

  .empty-state-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .empty-state-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .investments-tabs-container {
    margin-bottom: 0.75rem;
  }

  .tab-button {
    min-width: 60px;
    padding: 0.625rem 0.375rem;
    font-size: 0.65rem;
    gap: 0.25rem;
  }

  .tab-icon {
    font-size: 0.875rem;
  }

  .tab-label {
    font-size: 0.55rem;
  }

  .portfolio-summary {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .summary-card {
    padding: 0.5rem;
    flex-direction: row;
    text-align: left;
    gap: 0.5rem;
  }
  
  .summary-icon {
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    border-radius: 8px;
    flex-shrink: 0;
  }
  
  .summary-label {
    font-size: 0.55rem;
  }
  
  .summary-value {
    font-size: 0.8rem;
  }
  
  .summary-change {
    font-size: 0.65rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .form-group-full {
    grid-column: 1 / -1;
  }
  
  .form-group label {
    font-size: 12px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 8px 10px;
    font-size: 13px;
  }

  .investments-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .investment-card {
    padding: 0.75rem;
    min-height: auto;
  }

  .investment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.375rem;
  }

  .investment-info {
    flex: 1;
    min-width: 0;
  }

  .investment-name {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .investment-type,
  .investment-symbol {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    display: inline-block;
  }

  .investment-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .investment-actions .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.7rem;
    border-width: 1px;
  }

  .investment-card-body {
    gap: 0.375rem;
    margin-bottom: 0.5rem;
    flex: 1;
  }

  .investment-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }

  .investment-stats-row:first-child {
    grid-template-columns: 1fr;
  }

  .investment-stat-label {
    font-size: 0.6rem;
  }

  .investment-stat-value {
    font-size: 0.8rem;
  }

  .investment-stat-inr {
    font-size: 0.65rem;
  }

  .price-change {
    font-size: 0.6rem;
  }

  .investment-returns-row {
    padding-top: 0.375rem;
    margin-top: 0.375rem;
  }

  .investment-stat-full .investment-stat-value {
    font-size: 0.85rem;
  }

  .investment-card-footer {
    padding-top: 0.5rem;
  }

  .investment-date {
    font-size: 0.7rem;
  }

  .investment-notes {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-size: 0.7rem;
  }

  .modal-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  /* Price History Modal - Small Mobile */
  .price-history-analytics {
    gap: 0.75rem;
  }

  .analytics-section {
    padding: 0.75rem;
  }

  .analytics-section h3 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .analytics-card {
    padding: 0.625rem;
  }
  
  .analytics-card-full {
    grid-column: 1 / -1;
  }

  .analytics-label {
    font-size: 0.625rem;
  }

  .analytics-value {
    font-size: 0.875rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }

  .analytics-percent {
    font-size: 0.75rem;
  }

  .analytics-detail {
    font-size: 0.625rem;
  }

  .price-history-table {
    font-size: 0.75rem;
  }

  .price-history-table thead th {
    padding: 0.5rem 0.375rem;
    font-size: 0.65rem;
  }

  .price-history-table tbody td {
    padding: 0.5rem 0.375rem;
    font-size: 0.7rem;
  }

  .price-history-table tbody td:nth-child(3) {
    display: none; /* Hide notes column on very small screens */
  }

  .price-history-table thead th:nth-child(3) {
    display: none;
  }
}

/* Investment Card Actions */
.investment-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color, #E5E7EB);
  background: var(--bg-hover, #F9FAFB);
  border-radius: 0 0 12px 12px;
}

.investment-card-actions .btn {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
}

/* Investment Info Banner */
.investment-info-banner {
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(0, 206, 209, 0.1) 100%);
  border-left: 4px solid #4A90E2;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #2C3E50;
}

.investment-info-banner svg {
  float: left;
  margin-right: 8px;
  margin-top: 2px;
  color: #4A90E2;
  flex-shrink: 0;
}

.investment-info-banner strong {
  color: #4A90E2;
  font-weight: 600;
}

[data-theme="dark"] .investment-info-banner {
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(0, 206, 209, 0.15) 100%);
  color: var(--text-primary);
  border-left-color: #4A90E2;
}

[data-theme="dark"] .investment-info-banner svg {
  color: #4A90E2;
}

[data-theme="dark"] .investment-info-banner strong {
  color: #4A90E2;
}

/* Capital Gains Preview */
.capital-gains-preview {
  background: var(--bg-hover, #F3F4F6);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.capital-gains-preview h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary, #6B7280);
}

.preview-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color, #E5E7EB);
}

.preview-row:last-child {
  border-bottom: none;
}

.gains-row {
  font-weight: 600;
  font-size: 1.1rem;
}

.gains-row .positive {
  color: var(--success-green, #10B981);
}

.gains-row .negative {
  color: var(--danger-red, #EF4444);
}

[data-theme="dark"] .capital-gains-preview {
  background: var(--bg-hover);
}

[data-theme="dark"] .capital-gains-preview h4 {
  color: var(--text-secondary);
}

[data-theme="dark"] .preview-row {
  border-color: var(--border-color);
}

/* Button variants */
.btn-success {
  background: var(--success-green, #10B981);
  color: white;
  border: none;
}

.btn-success:hover {
  background: #059669;
}

/* Modal styles for dividend and capital gains */
#dividendModal .modal-container,
#capitalGainsModal .modal-container {
  max-width: 500px;
}

#dividendModal .form-group,
#capitalGainsModal .form-group {
  margin-bottom: 1rem;
}

#dividendModal .form-group label,
#capitalGainsModal .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary, #1F2937);
}

#dividendModal .form-group input,
#dividendModal .form-group textarea,
#capitalGainsModal .form-group input,
#capitalGainsModal .form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #D1D5DB);
  border-radius: 8px;
  font-size: 1rem;
}

#dividendModal .form-group input:focus,
#dividendModal .form-group textarea:focus,
#capitalGainsModal .form-group input:focus,
#capitalGainsModal .form-group textarea:focus {
  outline: none;
  border-color: var(--primary-blue, #4A90E2);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* ============================================
   PORTFOLIO ANALYTICS STYLES
   ============================================ */

/* Analytics Toggle */
.analytics-toggle-section {
  margin: 1rem 0;
  text-align: center;
}

.analytics-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Analytics Section */
.portfolio-analytics-section {
  background: var(--bg-card, #FFFFFF);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color, #E5E7EB);
}

.analytics-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary, #1F2937);
}

/* Analytics Grid */
.portfolio-analytics-section .analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.portfolio-analytics-section .analytics-card {
  background: var(--bg-hover, #F9FAFB);
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid var(--border-color, #E5E7EB);
}

.portfolio-analytics-section .analytics-card h3 {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
  color: var(--text-secondary, #6B7280);
  font-weight: 600;
}

.analytics-card-wide {
  grid-column: span 2;
}

.analytics-card-full {
  grid-column: 1 / -1;
}

/* Performance Metrics */
.performance-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.metric-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg-card, #FFFFFF);
  border-radius: 8px;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6B7280);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1F2937);
}

.metric-value.positive {
  color: var(--success-green, #10B981);
}

.metric-value.negative {
  color: var(--danger-red, #EF4444);
}

/* Risk Meter */
.risk-meter {
  text-align: center;
}

.risk-score {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary, #1F2937);
}

.risk-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.5rem 0;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-block;
}

.risk-label.risk-very-low { background: #D1FAE5; color: #065F46; }
.risk-label.risk-low { background: #D1FAE5; color: #065F46; }
.risk-label.risk-medium-low { background: #FEF3C7; color: #92400E; }
.risk-label.risk-medium { background: #FEF3C7; color: #92400E; }
.risk-label.risk-medium-high { background: #FED7AA; color: #9A3412; }
.risk-label.risk-high { background: #FEE2E2; color: #991B1B; }
.risk-label.risk-very-high { background: #FEE2E2; color: #991B1B; }

.risk-bar {
  height: 8px;
  background: var(--border-color, #E5E7EB);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1rem;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Diversification Score */
.diversification-score {
  text-align: center;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 6px solid var(--border-color, #E5E7EB);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  transition: border-color 0.3s ease;
}

.score-value {
  font-size: 2rem;
  font-weight: 700;
}

.score-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6B7280);
}

.score-description {
  font-size: 0.85rem;
  color: var(--text-secondary, #6B7280);
  margin: 0;
}

/* Allocation Bars */
.allocation-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.allocation-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.allocation-bar-label {
  font-size: 0.8rem;
  color: var(--text-secondary, #6B7280);
}

.allocation-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 24px;
  background: var(--bg-card, #FFFFFF);
  border-radius: 4px;
  overflow: hidden;
}

.allocation-bar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.5s ease;
}

.allocation-bar-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #1F2937);
  padding-right: 0.5rem;
}

/* Legend */
.allocation-legend,
.sector-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color, #E5E7EB);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-secondary, #6B7280);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Benchmark Table */
.benchmark-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.benchmark-comparison-table th,
.benchmark-comparison-table td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #E5E7EB);
  white-space: nowrap;
}

.benchmark-comparison-table th {
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  font-size: 0.75rem;
}

.benchmark-comparison-table td.positive {
  color: var(--success-green, #10B981);
}

.benchmark-comparison-table td.negative {
  color: var(--danger-red, #EF4444);
}

.benchmark-comparison-table td:last-child {
  white-space: nowrap;
  min-width: 150px;
}

/* Performers List */
.performers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.performer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: var(--bg-card, #FFFFFF);
  border-radius: 6px;
}

.performer-info {
  display: flex;
  flex-direction: column;
}

.performer-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary, #1F2937);
}

.performer-symbol {
  font-size: 0.7rem;
  color: var(--text-secondary, #6B7280);
}

.performer-returns {
  font-size: 0.9rem;
  font-weight: 600;
}

.performer-returns.positive {
  color: var(--success-green, #10B981);
}

.performer-returns.negative {
  color: var(--danger-red, #EF4444);
}

/* Recommendations */
.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recommendation-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  background: var(--bg-card, #FFFFFF);
}

.recommendation-item.recommendation-warning {
  border-left: 4px solid #F59E0B;
}

.recommendation-item.recommendation-info {
  border-left: 4px solid #3B82F6;
}

.recommendation-item.recommendation-suggestion {
  border-left: 4px solid #10B981;
}

.recommendation-icon {
  font-size: 1.25rem;
}

.recommendation-content strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-primary, #1F2937);
}

.recommendation-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary, #6B7280);
}

/* Chart Placeholder */
.chart-placeholder {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary, #6B7280);
  font-size: 0.9rem;
}

/* Dark Mode */
[data-theme="dark"] .portfolio-analytics-section {
  background: var(--bg-card);
}

[data-theme="dark"] .portfolio-analytics-section .analytics-card {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

[data-theme="dark"] .metric-item,
[data-theme="dark"] .performer-item,
[data-theme="dark"] .recommendation-item,
[data-theme="dark"] .allocation-bar-container {
  background: var(--bg-card);
}

[data-theme="dark"] .benchmark-comparison-table th,
[data-theme="dark"] .benchmark-comparison-table td {
  border-color: var(--border-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .portfolio-analytics-section {
    padding: 1rem;
  }

  .analytics-header h2 {
    font-size: 1.125rem;
  }

  /* Analytics Grid - 2 columns on mobile */
  .portfolio-analytics-section .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .portfolio-analytics-section .analytics-card {
    padding: 1rem;
  }

  .portfolio-analytics-section .analytics-card h3 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .analytics-card-wide {
    grid-column: span 2;
  }
  
  .analytics-card-full {
    grid-column: 1 / -1;
  }
  
  /* Performance Metrics - 2 columns on mobile */
  .performance-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .metric-item {
    padding: 0.625rem;
  }

  .metric-label {
    font-size: 0.7rem;
  }

  .metric-value {
    font-size: 1.125rem;
  }

  /* Risk Meter - Mobile optimized */
  .risk-score {
    font-size: 2rem;
  }

  .risk-label {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
  }

  /* Diversification Score - Mobile optimized */
  .score-circle {
    width: 80px;
    height: 80px;
    border-width: 5px;
  }

  .score-value {
    font-size: 1.5rem;
  }

  .score-label {
    font-size: 0.7rem;
  }

  .score-description {
    font-size: 0.8rem;
  }

  /* Allocation Bars - Mobile optimized */
  .allocation-bars {
    gap: 0.625rem;
  }

  .allocation-bar-label {
    font-size: 0.75rem;
  }

  .allocation-bar-container {
    height: 20px;
  }

  .allocation-bar-value {
    font-size: 0.7rem;
  }

  /* Legend - Mobile optimized */
  .allocation-legend,
  .sector-legend {
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding-top: 0.625rem;
  }

  .legend-item {
    font-size: 0.65rem;
  }

  .legend-color {
    width: 8px;
    height: 8px;
  }
  
  /* Benchmark Table - Mobile optimized */
  .benchmark-comparison-table {
    font-size: 0.75rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .benchmark-comparison-table thead,
  .benchmark-comparison-table tbody,
  .benchmark-comparison-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }
  
  .benchmark-comparison-table th,
  .benchmark-comparison-table td {
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .benchmark-comparison-table th {
    font-size: 0.7rem;
  }

  .benchmark-comparison-table th:nth-child(1),
  .benchmark-comparison-table td:nth-child(1) {
    width: 25%;
  }

  .benchmark-comparison-table th:nth-child(2),
  .benchmark-comparison-table td:nth-child(2) {
    width: 25%;
  }

  .benchmark-comparison-table th:nth-child(3),
  .benchmark-comparison-table td:nth-child(3) {
    width: 25%;
  }

  .benchmark-comparison-table th:nth-child(4),
  .benchmark-comparison-table td:nth-child(4) {
    width: 25%;
    white-space: nowrap;
  }

  /* Performers List - Mobile optimized */
  .performers-list {
    gap: 0.375rem;
  }

  .performer-item {
    padding: 0.625rem;
  }

  .performer-name {
    font-size: 0.8rem;
  }

  .performer-symbol {
    font-size: 0.65rem;
  }

  .performer-returns {
    font-size: 0.85rem;
  }

  /* Recommendations - Mobile optimized */
  .recommendations-list {
    gap: 0.625rem;
  }

  .recommendation-item {
    gap: 0.625rem;
    padding: 0.875rem;
  }

  .recommendation-icon {
    font-size: 1.125rem;
  }

  .recommendation-content strong {
    font-size: 0.85rem;
  }

  .recommendation-content p {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .portfolio-analytics-section {
    padding: 0.75rem;
  }

  .analytics-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .analytics-header h2 {
    font-size: 1rem;
  }

  /* Analytics Grid - Keep 2 columns on small mobile */
  .portfolio-analytics-section .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .portfolio-analytics-section .analytics-card {
    padding: 0.75rem;
  }

  .portfolio-analytics-section .analytics-card h3 {
    font-size: 0.8rem;
    margin-bottom: 0.625rem;
  }

  /* Performance Metrics - 2 columns on small mobile */
  .performance-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .metric-item {
    padding: 0.5rem;
  }

  .metric-label {
    font-size: 0.65rem;
    margin-bottom: 0.2rem;
  }

  .metric-value {
    font-size: 1rem;
  }

  /* Risk Meter - Small mobile */
  .risk-score {
    font-size: 1.75rem;
  }

  .risk-label {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  .risk-bar {
    height: 6px;
  }

  /* Diversification Score - Small mobile */
  .score-circle {
    width: 70px;
    height: 70px;
    border-width: 4px;
  }

  .score-value {
    font-size: 1.25rem;
  }

  .score-label {
    font-size: 0.65rem;
  }

  .score-description {
    font-size: 0.75rem;
  }

  /* Allocation Bars - Small mobile */
  .allocation-bars {
    gap: 0.5rem;
  }

  .allocation-bar-label {
    font-size: 0.7rem;
  }

  .allocation-bar-container {
    height: 18px;
  }

  .allocation-bar-value {
    font-size: 0.65rem;
  }

  /* Legend - Small mobile */
  .allocation-legend,
  .sector-legend {
    gap: 0.3rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
  }

  .legend-item {
    font-size: 0.6rem;
  }

  .legend-color {
    width: 7px;
    height: 7px;
  }

  /* Benchmark Table - Small mobile */
  .benchmark-comparison-table {
    font-size: 0.7rem;
  }

  .benchmark-comparison-table th,
  .benchmark-comparison-table td {
    padding: 0.375rem 0.2rem;
  }

  .benchmark-comparison-table th {
    font-size: 0.65rem;
  }

  /* Hide Expected Value column on very small screens */
  .benchmark-comparison-table th:nth-child(2),
  .benchmark-comparison-table td:nth-child(2) {
    display: none;
  }

  /* Adjust column widths after hiding Expected Value */
  .benchmark-comparison-table th:nth-child(1),
  .benchmark-comparison-table td:nth-child(1) {
    width: 30%;
  }

  .benchmark-comparison-table th:nth-child(3),
  .benchmark-comparison-table td:nth-child(3) {
    width: 30%;
  }

  .benchmark-comparison-table th:nth-child(4),
  .benchmark-comparison-table td:nth-child(4) {
    width: 40%;
    white-space: nowrap;
    font-size: 0.65rem;
  }

  /* Performers List - Small mobile */
  .performers-list {
    gap: 0.3rem;
  }

  .performer-item {
    padding: 0.5rem;
  }

  .performer-name {
    font-size: 0.75rem;
  }

  .performer-symbol {
    font-size: 0.6rem;
  }

  .performer-returns {
    font-size: 0.8rem;
  }

  /* Recommendations - Small mobile */
  .recommendations-list {
    gap: 0.5rem;
  }

  .recommendation-item {
    gap: 0.5rem;
    padding: 0.75rem;
    border-left-width: 3px;
  }

  .recommendation-icon {
    font-size: 1rem;
  }

  .recommendation-content strong {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
  }

  .recommendation-content p {
    font-size: 0.75rem;
  }

  /* Chart Placeholder - Small mobile */
  .chart-placeholder {
    padding: 1.5rem;
    font-size: 0.85rem;
  }
}

/* Pagination */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  flex-wrap: wrap;
  max-width: 100%;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-numbers button {
  min-width: 40px;
  height: 40px;
  padding: 0.5rem;
  border: 2px solid var(--border-color);
  background: white;
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pagination-numbers button:hover:not(.active):not(:disabled) {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: rgba(74, 144, 226, 0.05);
}

.pagination-numbers button.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  cursor: default;
}

.pagination-numbers button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-numbers .ellipsis {
  padding: 0.5rem;
  color: var(--text-secondary);
  user-select: none;
  flex-shrink: 0;
}

.btn-pagination {
  min-width: 100px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Mobile Responsive Pagination */
@media (max-width: 768px) {
  .pagination-container {
    gap: 0.25rem;
    padding: var(--spacing-md);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .btn-pagination {
    min-width: 60px;
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
  }
  
  .pagination-numbers {
    gap: 0.25rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  
  .pagination-numbers button {
    min-width: 32px;
    height: 32px;
    font-size: 0.75rem;
    padding: 0.25rem;
    flex-shrink: 0;
  }
  
  .pagination-numbers .ellipsis {
    padding: 0.25rem;
    font-size: 0.75rem;
  }
}
