/* ============================================================
   TINA Theme v3 — Investment Module Design System
   Inspired by: https://tina.trade (Metronic/KeenThemes)
   Font: Open Sans (300, 400, 600, 700)
   Primary: Blue (#2980b9) | Accent: Teal (#1abc9c)
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --tina-primary: #2980b9;
  --tina-primary-dark: #1a5276;
  --tina-primary-light: #85c1e9;
  --tina-primary-bg: rgba(41, 128, 185, 0.08);

  --tina-teal: #1abc9c;
  --tina-teal-dark: #148f77;
  --tina-teal-bg: rgba(26, 188, 156, 0.08);

  --tina-warning: #e67e22;
  --tina-warning-dark: #d35400;

  --tina-danger: #e74c3c;
  --tina-green: #27ae60;
  --tina-deep-pink: #8e44ad;

  --tina-dark: #2c3e50;
  --tina-darker: #1a1a2e;
  --tina-darkest: #0d1b2a;
  --tina-dark-gray: #34495e;
  --tina-medium-gray: #7f8c8d;
  --tina-light-gray: #ecf0f1;
  --tina-bg-light: #f5f7fa;
  --tina-white: #ffffff;

  --tina-text-dark: #2d3436;
  --tina-text-light: #636e72;
  --tina-border: #dfe6e9;
  --tina-border-light: #eef0f2;

  --tina-shadow: 0 2px 15px rgba(0,0,0,0.08);
  --tina-shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --tina-shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
  --tina-radius: 6px;
  --tina-radius-lg: 10px;

  --tina-font: 'Open Sans', sans-serif;

  --tina-nav-height: 70px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--tina-font);
  font-weight: 400;
  color: var(--tina-text-dark);
  background: var(--tina-bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { color: var(--tina-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--tina-primary-dark); }

/* --- Navigation (TINA-style fixed header) --- */
.tina-nav {
  background: var(--tina-darker);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--tina-nav-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tina-nav .nav-brand { display: flex; align-items: center; gap: 12px; }
.tina-nav .nav-brand img { height: 32px; width: auto; }

.tina-nav .nav-brand .brand-text {
  color: var(--tina-white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tina-nav .nav-brand .brand-sub {
  color: var(--tina-primary-light);
  font-size: 10px;
  font-weight: 400;
}

.tina-nav .nav-links { display: flex; align-items: center; gap: 6px; list-style: none; }
.tina-nav .nav-links a {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tina-nav .nav-links a:hover,
.tina-nav .nav-links a.active { color: var(--tina-white); background: rgba(255,255,255,0.08); }

/* --- Main Content (offset for fixed nav) --- */
.main-content { margin-top: var(--tina-nav-height); min-height: calc(100vh - var(--tina-nav-height)); }

/* ============================================
   PAGE HEADER (Dark hero area)
   ============================================ */
.page-header {
  background: linear-gradient(135deg, var(--tina-darker) 0%, var(--tina-darkest) 100%);
  padding: 30px 0;
  color: var(--tina-white);
  position: relative;
  overflow: hidden;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.page-header h1 i { color: var(--tina-teal); margin-right: 10px; }

.page-header p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  max-width: 750px;
  font-weight: 300;
}

.page-header .header-meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  flex-wrap: wrap;
}
.page-header .header-meta i { margin-right: 5px; color: var(--tina-teal); }

/* --- Breadcrumb --- */
.breadcrumb-bar {
  background: var(--tina-white);
  padding: 10px 0;
  border-bottom: 1px solid var(--tina-border-light);
  font-size: 12px;
}
.breadcrumb-bar .container { display: flex; align-items: center; gap: 8px; }
.breadcrumb-bar a { color: var(--tina-medium-gray); }
.breadcrumb-bar span { color: var(--tina-text-light); }
.breadcrumb-bar .separator { color: var(--tina-border); }

/* ============================================
   CONTAINER
   ============================================ */
.container { max-width: 1240px; margin: 0 auto; padding: 0 25px; }

/* ============================================
   PORTLET / CARD (TINA Metronic style)
   ============================================ */
.portlet {
  background: var(--tina-white);
  border-radius: var(--tina-radius-lg);
  box-shadow: var(--tina-shadow-sm);
  border: 1px solid var(--tina-border-light);
  transition: box-shadow 0.2s;
  margin-bottom: 20px;
}
.portlet:hover { box-shadow: var(--tina-shadow); }
.portlet .portlet-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--tina-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.portlet .portlet-head .portlet-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tina-text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.portlet .portlet-head .portlet-title i { color: var(--tina-primary); font-size: 16px; }
.portlet .portlet-head .portlet-tools { display: flex; gap: 8px; align-items: center; }
.portlet .portlet-body { padding: 20px; }

/* Legacy card class (backward compat) */
.card {
  background: var(--tina-white);
  border-radius: var(--tina-radius-lg);
  box-shadow: var(--tina-shadow-sm);
  border: 1px solid var(--tina-border-light);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--tina-shadow);
}

.card .card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tina-text-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card .card-title i { color: var(--tina-primary); font-size: 18px; }
.card .card-subtitle {
  font-size: 12px;
  color: var(--tina-text-light);
  margin-bottom: 14px;
}

/* --- Stat Cards (dashboard numbers) --- */
.stat-card {
  background: var(--tina-white);
  border-radius: var(--tina-radius-lg);
  box-shadow: var(--tina-shadow-sm);
  border: 1px solid var(--tina-border-light);
  padding: 18px 20px;
  text-align: center;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--tina-shadow); }
.stat-card .stat-icon { font-size: 24px; color: var(--tina-primary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--tina-darker); margin-bottom: 2px; }
.stat-card .stat-label { font-size: 11px; color: var(--tina-text-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-card .stat-change { font-size: 11px; margin-top: 4px; font-weight: 600; }
.stat-card .stat-change.positive { color: var(--tina-green); }
.stat-card .stat-change.negative { color: var(--tina-danger); }

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ============================================
   DATA TABLES
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table thead th {
  background: var(--tina-bg-light);
  color: var(--tina-dark);
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--tina-border-light);
}
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--tina-border-light);
  color: var(--tina-text-dark);
  vertical-align: top;
}
.data-table tbody tr:hover td { background: var(--tina-primary-bg); }
.data-table .badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }

.badge-active { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-terminated { background: #f8d7da; color: #721c24; }
.badge-signed { background: #d1ecf1; color: #0c5460; }
.badge-tina { background: var(--tina-primary-bg); color: var(--tina-primary-dark); }

/* ============================================
   DATA VALUE COLOR CODING WITH IEEE CITATIONS
   ============================================ */
.data-verified { color: #155724; font-weight: 600; }
.data-verified-bg { background: #d4edda; }
.data-verified::after { content: " ✓"; font-size: 10px; color: var(--tina-green); }

.data-estimated { color: #856404; font-weight: 600; }
.data-estimated-bg { background: #fff3cd; }
.data-estimated::after { content: " ~"; font-size: 10px; color: var(--tina-warning); }

.data-dummy { color: #6c3483; font-weight: 600; }
.data-dummy-bg { background: #f5eef8; }
.data-dummy::after { content: " ∅"; font-size: 10px; color: var(--tina-deep-pink); }

.data-simulated { color: #1a5276; font-weight: 600; }
.data-simulated-bg { background: #d6eaf8; }
.data-simulated::after { content: " ≈"; font-size: 10px; color: var(--tina-primary); }

/* --- Inline data reliability tags --- */
.data-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 3px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
.data-tag-verified { background: #d4edda; color: #155724; }
.data-tag-estimated { background: #fff3cd; color: #856404; }
.data-tag-dummy { background: #f5eef8; color: #6c3483; }
.data-tag-simulated { background: #d6eaf8; color: #1a5276; }

/* ============================================
   IEEE CITATION STYLES
   ============================================ */
.cite {
  font-size: 10px;
  font-weight: 700;
  color: var(--tina-primary);
  cursor: pointer;
  vertical-align: super;
  line-height: 0;
  transition: color 0.2s;
  text-decoration: none;
}
.cite:hover { color: var(--tina-primary-dark); text-decoration: underline; }
.cite::before { content: "["; }
.cite::after { content: "]"; }

.ref-section {
  margin-top: 30px;
  padding: 20px;
  background: var(--tina-white);
  border: 1px solid var(--tina-border-light);
  border-radius: var(--tina-radius-lg);
}
.ref-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--tina-text-dark);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tina-border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-section h3 i { color: var(--tina-primary); }
.ref-section ol {
  list-style: none;
  counter-reset: ref-counter;
  padding: 0;
}
.ref-section ol li {
  counter-increment: ref-counter;
  position: relative;
  padding: 6px 0 6px 32px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--tina-text-light);
  border-bottom: 1px solid var(--tina-border-light);
}
.ref-section ol li:last-child { border-bottom: none; }
.ref-section ol li::before {
  content: "[" counter(ref-counter) "]";
  position: absolute;
  left: 0;
  top: 6px;
  font-weight: 700;
  color: var(--tina-primary);
  font-size: 11px;
}
.ref-section ol li a { color: var(--tina-primary); word-break: break-all; }
.ref-section ol li a:hover { text-decoration: underline; }
.ref-section ol li .ref-note { color: var(--tina-medium-gray); font-size: 11px; }

/* ============================================
   DISCLAIMER BANNERS
   ============================================ */
.disclaimer-banner {
  background: repeating-linear-gradient(45deg, #f5eef8, #f5eef8 10px, #f0e6f5 10px, #f0e6f5 20px);
  border: 2px solid var(--tina-deep-pink);
  border-radius: var(--tina-radius-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.disclaimer-banner .disclaimer-icon {
  width: 36px; height: 36px;
  background: var(--tina-deep-pink);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.disclaimer-banner .disclaimer-title {
  font-weight: 700; color: #6c3483;
  font-size: 12px; margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.disclaimer-banner .disclaimer-text { color: #4a235a; font-size: 12px; line-height: 1.5; }
.disclaimer-banner .disclaimer-text code { background: rgba(106, 27, 154, 0.1); padding: 1px 4px; border-radius: 2px; font-size: 11px; }

/* --- Prototype watermark --- */
.prototype-watermark {
  position: fixed; bottom: 80px; right: 20px;
  background: var(--tina-deep-pink); color: white;
  padding: 5px 12px; border-radius: 18px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; opacity: 0.6; z-index: 999; pointer-events: none;
}

/* ============================================
   DATA SOURCE BANNER
   ============================================ */
.data-source-banner {
  background: linear-gradient(135deg, #2d3436 0%, var(--tina-darker) 100%);
  border-radius: var(--tina-radius-lg);
  padding: 18px 22px;
  margin-top: 18px;
  color: var(--tina-white);
}
.data-source-banner h4 {
  font-size: 13px; font-weight: 600;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.data-source-banner h4 i { color: var(--tina-teal); }
.data-source-banner .source-item {
  display: flex; align-items: flex-start;
  gap: 10px; padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
}
.data-source-banner .source-item:last-child { border-bottom: none; }
.data-source-banner .source-item .source-icon {
  width: 28px; height: 28px;
  background: rgba(41, 128, 185, 0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.data-source-banner .source-item .source-label { font-weight: 600; color: var(--tina-teal); }
.data-source-banner .source-item .source-url { color: rgba(255,255,255,0.4); font-size: 10px; word-break: break-all; }
.data-source-banner .source-item .source-status {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  font-size: 9px; font-weight: 600; margin-left: 6px;
}
.source-status.ok { background: rgba(39,174,96,0.2); color: #2ecc71; }
.source-status.partial { background: rgba(243,156,18,0.2); color: #f39c12; }
.source-status.manual { background: rgba(41,128,185,0.2); color: #5dade2; }

/* ============================================
   COUNTRY / PARTNER SELECTOR
   ============================================ */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.selector-bar select, .selector-bar input {
  padding: 8px 14px;
  border: 2px solid var(--tina-border);
  border-radius: var(--tina-radius);
  font-family: var(--tina-font);
  font-size: 13px;
  background: var(--tina-white);
  color: var(--tina-text-dark);
  min-width: 180px;
  transition: border-color 0.2s;
}
.selector-bar select:focus, .selector-bar input:focus {
  outline: none;
  border-color: var(--tina-primary);
}
.selector-bar .flag-icon { font-size: 22px; }
.selector-bar .separator { color: var(--tina-medium-gray); font-size: 16px; }
.selector-bar label { font-size: 12px; font-weight: 600; color: var(--tina-text-light); }

/* ============================================
   SECTION
   ============================================ */
.section { padding: 25px 0; }

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tina-text-dark);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tina-border-light);
}
.section-title i { color: var(--tina-primary); margin-right: 8px; }

/* ============================================
   TABS
   ============================================ */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--tina-border-light);
  margin-bottom: 18px;
}
.tab-bar .tab-item {
  padding: 10px 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tina-text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab-bar .tab-item:hover { color: var(--tina-text-dark); }
.tab-bar .tab-item.active { color: var(--tina-primary); border-bottom-color: var(--tina-primary); }

/* ============================================
   FOOTER (TINA-style)
   ============================================ */
.tina-footer {
  background: var(--tina-darker);
  color: rgba(255,255,255,0.5);
  padding: 24px 0;
  margin-top: 30px;
  font-size: 12px;
}
.tina-footer .footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.tina-footer .footer-brand { display: flex; align-items: center; gap: 8px; }
.tina-footer .footer-brand img { height: 24px; }
.tina-footer a { color: rgba(255,255,255,0.5); }
.tina-footer a:hover { color: var(--tina-white); }

/* ============================================
   ALERT / NOTE BOXES
   ============================================ */
.alert-note {
  background: #eaf2f8;
  border-left: 4px solid var(--tina-primary);
  padding: 12px 16px;
  border-radius: var(--tina-radius);
  font-size: 12px;
  margin: 14px 0;
}
.alert-note i { color: var(--tina-primary); margin-right: 6px; }

.alert-warning {
  background: #fef9e7;
  border-left: 4px solid var(--tina-warning);
  padding: 12px 16px;
  border-radius: var(--tina-radius);
  font-size: 12px;
  margin: 14px 0;
}
.alert-warning i { color: var(--tina-warning); margin-right: 6px; }

.alert-success {
  background: #d4edda;
  border-left: 4px solid var(--tina-green);
  padding: 12px 16px;
  border-radius: var(--tina-radius);
  font-size: 12px;
  margin: 14px 0;
}
.alert-success i { color: var(--tina-green); margin-right: 6px; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--tina-radius);
  font-family: var(--tina-font);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.btn-primary { background: var(--tina-primary); color: white; }
.btn-primary:hover { background: var(--tina-primary-dark); color: white; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--tina-border);
  color: var(--tina-text-dark);
}
.btn-outline:hover { border-color: var(--tina-primary); color: var(--tina-primary); }

.btn-teal { background: var(--tina-teal); color: white; }
.btn-teal:hover { background: var(--tina-teal-dark); color: white; }

.btn-sm { padding: 5px 12px; font-size: 11px; }

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-container { position: relative; height: 280px; width: 100%; }
.chart-container-sm { height: 200px; }
.chart-container-lg { height: 340px; }

/* ============================================
   KEYWORD / TAG CHIPS
   ============================================ */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  margin: 2px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.tag-blue { background: var(--tina-primary-bg); color: var(--tina-primary-dark); }
.tag-teal { background: var(--tina-teal-bg); color: var(--tina-teal-dark); }
.tag-orange { background: rgba(230, 126, 34, 0.12); color: var(--tina-warning-dark); }
.tag-green { background: rgba(39, 174, 96, 0.12); color: var(--tina-green); }
.tag-pink { background: rgba(142, 68, 173, 0.12); color: var(--tina-deep-pink); }
.tag-dark { background: rgba(44, 62, 80, 0.12); color: var(--tina-dark); }

/* ============================================
   LEGAL TINA SPECIFIC
   ============================================ */
.legal-header { background: linear-gradient(135deg, #0d1b2a 0%, #1b2838 100%); }
.legal-header .brand-text { color: var(--tina-white); }
.legal-header .brand-sub { color: #85c1e9; }

/* ============================================
   SEARCH MOCK
   ============================================ */
.search-mock {
  background: #f8f9fa;
  border: 1px solid var(--tina-border);
  border-radius: var(--tina-radius);
  padding: 14px;
  margin-top: 10px;
}
.search-mock .mock-result { padding: 8px 0; border-bottom: 1px solid var(--tina-border); }
.search-mock .mock-result:last-child { border-bottom: none; }
.search-mock .mock-result .agreement-name { font-weight: 600; color: var(--tina-primary); }
.search-mock .mock-result .snippet { font-size: 12px; color: var(--tina-text-light); margin-top: 3px; }
.search-mock .mock-result .snippet em { background: #fff3cd; font-style: normal; padding: 1px 3px; border-radius: 2px; }

/* ============================================
   UTILITY
   ============================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--tina-medium-gray);
  margin-bottom: 12px;
}
.back-link:hover { color: var(--tina-primary); }

.tooltip-trigger { cursor: help; border-bottom: 1px dashed var(--tina-medium-gray); }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--tina-border);
  border-top-color: var(--tina-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .tina-nav { padding: 0 15px; }
  .tina-nav .nav-links { display: none; }
  .page-header h1 { font-size: 20px; }
  .stat-card .stat-value { font-size: 20px; }
  .selector-bar { flex-direction: column; align-items: stretch; }
  .selector-bar select, .selector-bar input { width: 100%; }
  .tina-footer .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .disclaimer-banner { flex-direction: column; }
}
