/* ===== Fund Detail Page – Premium Styles ===== */

/* ---------- Google Font import ---------- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

/* ---------- CSS Variables ---------- */
:root {
  --fd-bg: #f4f6f9;
  --fd-card-bg: #ffffff;
  --fd-card-border: rgba(0, 0, 0, 0.08);
  --fd-accent: #2563eb;
  --fd-accent-light: #3b82f6;
  --fd-green: #16a34a;
  --fd-red: #dc2626;
  --fd-yellow: #ca8a04;
  --fd-text: #1e293b;
  --fd-text-muted: #475569;
  --fd-text-dim: #94a3b8;
  --fd-radius: 14px;
  --fd-radius-sm: 10px;
  --fd-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Wrapper ---------- */
.fund-detail-wrapper {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--fd-text);
  padding-bottom: 40px;
}

/* ---------- Hero Section ---------- */
.fund-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a365d 60%, #1e293b 100%);
  border-radius: var(--fd-radius);
  padding: 32px 36px 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(30, 58, 95, 0.3);
  box-shadow: 0 4px 24px rgba(30, 58, 95, 0.15);
}

.fund-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 420px;
  height: 420px;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.fund-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.fund-hero-left {
  flex: 1;
  min-width: 280px;
}

.fund-hero-left h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 6px;
  color: #fff;
  line-height: 1.2;
}

.fund-hero-left .fund-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 4px;
  font-weight: 500;
}

.fund-hero-left .fund-isin {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  font-family: "SF Mono", "Fira Code", monospace;
  letter-spacing: 0.5px;
}

.fund-hero-right {
  text-align: right;
  min-width: 200px;
}

.fund-hero-right .fund-price {
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
  line-height: 1;
}

.fund-hero-right .fund-price .fund-currency {
  font-size: 20px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 6px;
}

.fund-hero-right .fund-date {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.fund-hero-right .fund-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
}

.fund-change.up {
  background: rgba(34, 197, 94, 0.15);
  color: var(--fd-green);
}

.fund-change.down {
  background: rgba(239, 68, 68, 0.15);
  color: var(--fd-red);
}

.fund-change.flat {
  background: rgba(234, 179, 8, 0.15);
  color: var(--fd-yellow);
}

.fund-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.fund-hero-actions .btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--fd-transition);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.fund-hero-actions .btn-hero:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.fund-hero-actions .btn-hero.primary {
  background: var(--fd-accent);
  border-color: var(--fd-accent);
  color: #fff;
}

.fund-hero-actions .btn-hero.primary:hover {
  background: var(--fd-accent-light);
  border-color: var(--fd-accent-light);
}

/* ---------- Tabs Navigation ---------- */
.fund-tabs-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #eef1f6;
  border-radius: var(--fd-radius-sm);
  border: 1px solid var(--fd-card-border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fund-tabs-nav .fund-tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--fd-text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--fd-transition);
  white-space: nowrap;
  text-align: center;
  font-family: inherit;
}

.fund-tabs-nav .fund-tab-btn:hover {
  color: var(--fd-text);
  background: rgba(0, 0, 0, 0.04);
}

.fund-tabs-nav .fund-tab-btn.active {
  background: var(--fd-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.fund-tabs-nav .fund-tab-btn .tab-icon {
  margin-right: 6px;
  font-size: 15px;
}

/* ---------- Tab Content ---------- */
.fund-tab-pane {
  display: none;
  animation: fadeInTab 0.35s ease-out;
}

.fund-tab-pane.active {
  display: block;
}

@keyframes fadeInTab {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Cards ---------- */
.fd-card {
  background: var(--fd-card-bg);
  border: 1px solid var(--fd-card-border);
  border-radius: var(--fd-radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--fd-transition);
}

.fd-card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.fd-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.fd-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fd-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fd-card-title .card-icon {
  font-size: 18px;
  opacity: 0.7;
}

/* ---------- Metric Cards Grid ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--fd-card-bg);
  border: 1px solid var(--fd-card-border);
  border-radius: var(--fd-radius-sm);
  padding: 16px 18px;
  transition: var(--fd-transition);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 3px 0 0 3px;
}

.metric-card.accent::after {
  background: var(--fd-accent);
}
.metric-card.green::after {
  background: var(--fd-green);
}
.metric-card.red::after {
  background: var(--fd-red);
}
.metric-card.yellow::after {
  background: var(--fd-yellow);
}
.metric-card.blue::after {
  background: #6366f1;
}
.metric-card.purple::after {
  background: #a855f7;
}
.metric-card.teal::after {
  background: #14b8a6;
}
.metric-card.orange::after {
  background: #f97316;
}

.metric-card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.metric-card .metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--fd-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.metric-card .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--fd-text);
  line-height: 1.1;
}

.metric-card .metric-value.up {
  color: var(--fd-green);
}
.metric-card .metric-value.down {
  color: var(--fd-red);
}

.metric-card .metric-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--fd-text-muted);
  margin-left: 2px;
}

/* ---------- Returns Table ---------- */
.returns-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.returns-table thead th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fd-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--fd-card-border);
  text-align: right;
}

.returns-table thead th:first-child {
  text-align: left;
}

.returns-table tbody td {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-align: right;
}

.returns-table tbody td:first-child {
  text-align: left;
  color: var(--fd-text-muted);
  font-weight: 500;
}

.returns-table tbody tr:last-child td {
  border-bottom: none;
}

.returns-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.returns-table .ret-up {
  color: var(--fd-green);
}
.returns-table .ret-down {
  color: var(--fd-red);
}
.returns-table .ret-flat {
  color: var(--fd-text-muted);
}

/* ---------- Chart Wrapper ---------- */
.fd-chart-container {
  position: relative;
  border-radius: var(--fd-radius-sm);
  overflow: hidden;
}

.fd-chart-container .fund-chart-wrapper {
  background: transparent;
}

/* ---------- Chart Period Selector ---------- */
.chart-period-selector {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  margin-bottom: 16px;
}

.chart-period-selector .period-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--fd-text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--fd-transition);
  font-family: inherit;
}

.chart-period-selector .period-btn:hover {
  color: var(--fd-text);
}

.chart-period-selector .period-btn.active {
  background: var(--fd-accent);
  color: #fff;
}

/* ---------- Info Grid ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

.info-item .info-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.1);
  color: var(--fd-accent);
}

.info-item .info-content {
  flex: 1;
}

.info-item .info-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--fd-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 2px;
}

.info-item .info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fd-text);
}

/* ---------- Documents Grid ---------- */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid var(--fd-card-border);
  border-radius: var(--fd-radius-sm);
  text-decoration: none;
  color: var(--fd-text);
  transition: var(--fd-transition);
}

.doc-card:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
  color: var(--fd-accent);
  text-decoration: none;
}

.doc-card .doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--fd-red);
  flex-shrink: 0;
}

.doc-card .doc-info .doc-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.doc-card .doc-info .doc-desc {
  font-size: 12px;
  color: var(--fd-text-dim);
}

/* ---------- Investment Policy ---------- */
.fd-policy-text {
  font-size: 15px;
  line-height: 1.75;
  color: var(--fd-text-muted);
  text-align: justify;
}

/* ---------- Related Funds ---------- */
.fd-related-tabs {
  margin-bottom: 0;
}

.fd-related-tabs .nav-tabs {
  border-bottom: 1px solid var(--fd-card-border);
  margin-bottom: 16px;
}

.fd-related-tabs .nav-tabs > li > a {
  color: var(--fd-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--fd-transition);
  background: transparent;
}

.fd-related-tabs .nav-tabs > li > a:hover {
  color: var(--fd-text);
  border-bottom-color: rgba(59, 130, 246, 0.4);
  background: transparent;
}

.fd-related-tabs .nav-tabs > li.active > a,
.fd-related-tabs .nav-tabs > li.active > a:hover,
.fd-related-tabs .nav-tabs > li.active > a:focus {
  color: var(--fd-accent);
  border: none;
  border-bottom: 2px solid var(--fd-accent);
  background: transparent;
}

/* ---------- Breadcrumb Override ---------- */
.fund-detail-wrapper .breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 16px;
  font-size: 13px;
}

.fund-detail-wrapper .breadcrumb a {
  color: var(--fd-text-dim);
  text-decoration: none;
  transition: var(--fd-transition);
}

.fund-detail-wrapper .breadcrumb a:hover {
  color: var(--fd-accent-light);
}

.fund-detail-wrapper .breadcrumb > li + li::before {
  color: var(--fd-text-dim);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .fund-hero {
    padding: 20px;
  }

  .fund-hero-left h1 {
    font-size: 22px;
  }

  .fund-hero-right .fund-price {
    font-size: 28px;
  }

  .fund-hero-top {
    flex-direction: column;
  }

  .fund-hero-right {
    text-align: left;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fund-tabs-nav .fund-tab-btn {
    min-width: 100px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .docs-grid {
    grid-template-columns: 1fr;
  }

  .metric-card .metric-value {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 12px 14px;
  }

  .fund-tabs-nav {
    gap: 2px;
    padding: 3px;
  }

  .fund-tabs-nav .fund-tab-btn {
    min-width: 80px;
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* ---------- Comparison button (mini) ---------- */
.compare-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--fd-text-muted);
  text-decoration: none;
  transition: var(--fd-transition);
}

.compare-link:hover {
  color: var(--fd-accent-light);
  text-decoration: none;
}

/* ---------- Badge ---------- */
.fd-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.fd-badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--fd-accent);
}
.fd-badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--fd-green);
}
.fd-badge-yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--fd-yellow);
}
.fd-badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--fd-red);
}

/* ---------- No data placeholder ---------- */
.fd-no-data {
  text-align: center;
  padding: 48px 20px;
  color: var(--fd-text-dim);
  font-size: 15px;
}

.fd-no-data .no-data-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

/* ---------- Skeleton loaders ---------- */
.fd-skeleton {
  background: linear-gradient(
    90deg,
    var(--fd-card-bg) 25%,
    rgba(0, 0, 0, 0.04) 50%,
    var(--fd-card-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

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

/* ---------- Panel overrides inside fund-detail ---------- */
.fund-detail-wrapper .panel {
  background: var(--fd-card-bg);
  border: 1px solid var(--fd-card-border);
  border-radius: var(--fd-radius);
  box-shadow: none;
}

.fund-detail-wrapper .panel-primary > .panel-heading {
  background: rgba(37, 99, 235, 0.08);
  border-color: transparent;
  color: var(--fd-accent);
  font-weight: 600;
  border-radius: var(--fd-radius) var(--fd-radius) 0 0;
}

.fund-detail-wrapper .panel-body {
  color: var(--fd-text);
}

.fund-detail-wrapper .table {
  color: var(--fd-text);
}

.fund-detail-wrapper .table > thead > tr > th {
  border-bottom-color: var(--fd-card-border);
  color: var(--fd-text-dim);
}

.fund-detail-wrapper .table > tbody > tr > td {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.fund-detail-wrapper .table-stripped > tbody > tr:nth-of-type(odd) {
  background: rgba(37, 99, 235, 0.03);
}

/* ---------- fund-chart-wrapper override ---------- */
.fund-detail-wrapper .fund-chart-wrapper {
  margin: 0;
}

/* ---------- Animate on scroll ---------- */
.fd-animate {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.fd-animate.visible {
  opacity: 1;
  transform: translateY(0);
}
/* ---------- Allocation & Portfolio ---------- */
.alloc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.alloc-label {
  width: 200px;
  font-size: 14px;
  color: var(--fd-text-muted);
  flex-shrink: 0;
}

.alloc-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.alloc-bar {
  height: 100%;
  background: var(--fd-accent);
  border-radius: 4px;
}

.alloc-value {
  width: 60px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fd-text);
  text-align: right;
  flex-shrink: 0;
}

.fd-card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--fd-card-border);
  font-size: 12px;
  color: var(--fd-text-dim);
  text-align: right;
}

.sri-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.sri-1 {
  background-color: #008000;
}
.sri-2 {
  background-color: #adff2f;
  color: #000;
}
.sri-3 {
  background-color: #ffff00;
  color: #000;
}
.sri-4 {
  background-color: #ffa500;
}
.sri-5 {
  background-color: #ff4500;
}
.sri-6 {
  background-color: #ff0000;
}
.sri-7 {
  background-color: #8b0000;
}

@media (max-width: 600px) {
  .alloc-label {
    width: 120px;
    font-size: 12px;
  }
  .alloc-value {
    width: 50px;
    font-size: 12px;
  }
}
