/* NetworthAfrica - Professional Design with Muted Colors */

:root {
  /* Primary Colors */
  --primary-color: #1e3a8a;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --secondary-color: #34495e;

  /* Accent Colors */
  --accent-gold: #f59e0b;
  --accent-amber: #fbbf24;
  --accent-color: #e67e22;

  /* Text Colors */
  --text-dark: #1f2937;
  --text-medium: #4b5563;
  --text-light: #6b7280;
  --text-lighter: #9ca3af;

  /* Background Colors */
  --background-light: #f9fafb;
  --background-white: #ffffff;
  --background-gray: #f3f4f6;

  /* Border & Divider */
  --border-color: #e5e7eb;
  --border-dark: #d1d5db;

  /* Status Colors */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --info-color: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --gradient-overlay: linear-gradient(to bottom, rgba(30, 58, 138, 0.8), rgba(30, 64, 175, 0.9));

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-dark);
  background-color: var(--background-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 3rem;
  line-height: 1.1;
}

h2 {
  font-size: 2.5rem;
}

h3 {
  font-size: 2rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1.125rem;
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-medium);
  line-height: 1.8;
}

/* Responsive Typography */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  body {
    font-size: 1rem;
  }
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

@media (max-width: 1440px) {
  .container {
    max-width: 1200px;
  }
}

@media (max-width: 1024px) {
  .container {
    max-width: 960px;
    padding: 0 var(--spacing-md);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.col {
  padding: 0 15px;
  flex: 1;
}

/* Header */
.header {
  background: var(--background-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--accent-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.025em;
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

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

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.2);
}

/* Cards */
.card {
  background: var(--background-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition-base);
  border: 1px solid var(--border-color);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.card-body {
  padding: var(--spacing-xl);
}

.card-footer {
  padding: var(--spacing-lg);
  background: var(--background-gray);
  border-top: 1px solid var(--border-color);
}

/* Ensure white text in gradient/colored cards and sections */
.card[style*="linear-gradient"] h1,
.card[style*="linear-gradient"] h2,
.card[style*="linear-gradient"] h3,
.card[style*="linear-gradient"] h4,
.card[style*="linear-gradient"] h5,
.card[style*="linear-gradient"] h6,
.card[style*="linear-gradient"] p,
.card[style*="linear-gradient"] span,
.card[style*="linear-gradient"] label,
section[style*="linear-gradient"] h1,
section[style*="linear-gradient"] h2,
section[style*="linear-gradient"] h3,
section[style*="linear-gradient"] p,
section[style*="linear-gradient"] span,
div[style*="linear-gradient"][style*="primary-color"] h1,
div[style*="linear-gradient"][style*="primary-color"] h2,
div[style*="linear-gradient"][style*="primary-color"] h3,
div[style*="linear-gradient"][style*="primary-color"] p,
div[style*="linear-gradient"][style*="primary-color"] span {
  color: white !important;
}

/* Preserve specific colored values like green/red for assets/liabilities */
#totalAssets {
  color: #10b981 !important;
}

#totalLiabilities {
  color: #ef4444 !important;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  color: white;
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  color: white;
}

/* Grid System */
.grid {
  display: grid;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

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

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

.grid-4 {
  grid-template-columns: repeat(3, 1fr);
}

/* Changed from 4 to 3 for wider cards */

@media (max-width: 1024px) {

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

@media (max-width: 768px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 1.5rem;
  }
}

/* Card hover effects */
.card img {
  transition: transform 0.4s ease;
}

.card:hover img {
  transform: scale(1.05);
}

/* Search */
.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  font-size: 1rem;
}

.search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-color);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: white;
  cursor: pointer;
}

/* Stats */
.stats {
  display: flex;
  justify-content: space-around;
  padding: 3rem 0;
  background: var(--background-white);
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  color: var(--text-light);
  font-weight: 500;
}

/* Footer */
.footer {
  background: var(--primary-color);
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: white;
  margin-bottom: 1rem;
}

.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-section a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}


/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.mobile-menu-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--primary-color);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background-color: var(--background-white);
    width: 100%;
    text-align: center;
    transition: left 0.3s ease;
    box-shadow: var(--shadow);
    padding: 2rem 0;
    gap: 0;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-menu li {
    margin: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-link {
    display: block;
    padding: 0.5rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .stats {
    flex-direction: column;
    gap: 2rem;
  }

  .grid {
    grid-template-columns: 1fr !important;
  }

  .row {
    flex-direction: column;
  }

  .container {
    padding: 0 15px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* Utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

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

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.p-1 {
  padding: 0.5rem;
}

.p-2 {
  padding: 1rem;
}

.p-3 {
  padding: 1.5rem;
}

/* Footer Styles */
.footer {
  background: var(--gradient-primary);
  color: white;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-section h3 {
  color: white;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.footer-section a {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color var(--transition-fast);
}

.footer-section a:hover {
  color: white;
  padding-left: 0.5rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 2rem;
  text-align: center;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

@media (max-width: 768px) {
  .footer {
    padding: 3rem 0 1.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Financial Breakdown Styles */
.financial-table-container {
  margin-bottom: 2rem;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.financial-table-container table {
  min-width: 600px;
}

.financial-charts {
  margin-bottom: 2.5rem;
}

.financial-charts canvas {
  max-width: 100%;
  height: auto !important;
}

/* Mobile Responsive Styles for Financial Breakdown */
@media (max-width: 768px) {
  .financial-charts {
    grid-template-columns: 1fr !important;
  }

  .financial-table-container table {
    font-size: 0.875rem;
  }

  .financial-table-container th,
  .financial-table-container td {
    padding: 0.75rem !important;
  }

  /* Hide description column on very small screens */
  @media (max-width: 480px) {
    .financial-table-container table {
      min-width: 100%;
    }
  }
}

/* Smooth transitions for toggle buttons */
.asset-row,
.liability-row {
  transition: all 0.3s ease;
}

/* Biography content styling */
.biography-content h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.biography-content h3 {
  color: var(--text-dark);
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.biography-content p {
  margin-bottom: 1rem;
}

.biography-content ul,
.biography-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.biography-content li {
  margin-bottom: 0.5rem;
}

/* ========================================
   PROFILE PAGE MOBILE RESPONSIVENESS
   ======================================== */

/* Profile Hero Section */
.profile-hero-flex {
  display: flex;
  gap: 4rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Tablet and below */
@media (max-width: 1024px) {

  /* Hero section adjustments */
  main>div:first-child {
    padding: 2rem 0 4rem !important;
  }

  /* Profile hero flex layout */
  main>div:first-child .container>div {
    gap: 2rem !important;
  }

  /* Profile image size */
  main>div:first-child img,
  main>div:first-child>.container>div>div:first-child>div {
    width: 200px !important;
    height: 200px !important;
  }

  /* Profile name font size */
  main>div:first-child h1 {
    font-size: 2.5rem !important;
  }

  /* Role text */
  main>div:first-child>.container>div>div:nth-child(2)>p:first-of-type {
    font-size: 1.2rem !important;
  }
}

/* Mobile devices */
@media (max-width: 768px) {

  /* Hero section */
  main>div:first-child {
    padding: 1.5rem 0 3rem !important;
  }

  /* Center the hero content */
  main>div:first-child .container>div {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1.5rem !important;
  }

  /* Profile image size for mobile */
  main>div:first-child img,
  main>div:first-child>.container>div>div:first-child>div {
    width: 150px !important;
    height: 150px !important;
    border-width: 4px !important;
  }

  /* Profile name */
  main>div:first-child h1 {
    font-size: 1.8rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Verified icon */
  main>div:first-child h1 i {
    font-size: 1.2rem !important;
    margin-left: 0.5rem !important;
  }

  /* Role text */
  main>div:first-child>.container>div>div:nth-child(2)>p:first-of-type {
    font-size: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* Meta info (country, birth, views, updated) */
  main>div:first-child>.container>div>div:nth-child(2)>div:nth-child(3) {
    justify-content: center !important;
    gap: 1rem !important;
    font-size: 0.9rem !important;
  }

  main>div:first-child>.container>div>div:nth-child(2)>div:nth-child(3) span {
    font-size: 0.9rem !important;
  }

  /* Category tags */
  main>div:first-child>.container>div>div:nth-child(2)>div:last-child {
    justify-content: center !important;
  }

  main>div:first-child>.container>div>div:nth-child(2)>div:last-child span {
    padding: 6px 16px !important;
    font-size: 0.85rem !important;
  }

  /* Main content area adjustments */
  .container>.row {
    flex-direction: column !important;
  }

  .container>.row>.col {
    min-width: 100% !important;
    flex: none !important;
  }

  /* Card body padding */
  .card-body {
    padding: 1.5rem !important;
  }

  .card-header {
    padding: 1rem 1.5rem !important;
  }

  /* Net Worth card */
  .card[style*="background: #1e3a8a"] .card-body h2 {
    font-size: 2rem !important;
  }

  /* Financial breakdown grid */
  .financial-charts {
    grid-template-columns: 1fr !important;
  }

  /* Financial overview stats */
  .card-body>div[style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Quote section */
  .card[style*="background: #f8fafc"] .card-body {
    padding: 1.5rem !important;
  }

  .card[style*="background: #f8fafc"] .card-body p {
    font-size: 1.1rem !important;
  }

  /* Biography content */
  .biography-content {
    padding: 1.5rem !important;
    font-size: 1rem !important;
  }

  /* Related people section */
  main>.container>div[style*="margin-top: 3rem"] {
    margin-top: 2rem !important;
  }

  main>.container>div[style*="margin-top: 3rem"] h2 {
    font-size: 1.5rem !important;
    margin-bottom: 1rem !important;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {

  /* Extra small screens */
  main>div:first-child {
    padding: 1rem 0 2rem !important;
  }

  /* Profile image */
  main>div:first-child img,
  main>div:first-child>.container>div>div:first-child>div {
    width: 120px !important;
    height: 120px !important;
  }

  /* Profile name */
  main>div:first-child h1 {
    font-size: 1.5rem !important;
  }

  /* Card body padding */
  .card-body {
    padding: 1rem !important;
  }

  .card-header {
    padding: 0.75rem 1rem !important;
  }

  /* Net Worth value */
  .card[style*="background: #1e3a8a"] .card-body h2 {
    font-size: 1.75rem !important;
  }

  /* Make buttons stack on mobile */
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Reduce meta info spacing */
  main>div:first-child>.container>div>div:nth-child(2)>div:nth-child(3) {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  /* Financial breakdown smaller text */
  .financial-table-container table {
    font-size: 0.8rem;
  }

  .financial-table-container th,
  .financial-table-container td {
    padding: 0.5rem !important;
  }
}

/* ========================================
   CRITICAL: Global Overflow Prevention
   ======================================== */
html,
body {
  overflow-x: hidden;
}

main {
  overflow-x: hidden;
  max-width: 100vw;
}

.container {
  overflow-x: hidden;
}

/* Mobile Overflow Fixes */
@media (max-width: 768px) {

  /* Force all grid layouts to single column on mobile */
  [style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Force all flex containers with gap to wrap */
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }

  /* Financial breakdown overview stats - FORCE STACK */
  .card-body>div[style*="grid-template-columns"] {
    display: block !important;
  }

  .card-body>div[style*="grid-template-columns"]>div {
    margin-bottom: 1rem !important;
  }

  /* Financial charts container */
  .financial-charts {
    display: block !important;
  }

  .financial-charts>div {
    margin-bottom: 1.5rem !important;
  }

  /* Table responsive wrapper */
  .table-responsive,
  .financial-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }

  .financial-table-container table {
    min-width: auto !important;
    width: 100% !important;
  }

  /* Biography content fix */
  .biography-content {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  .biography-content * {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
  }

  .biography-content img {
    max-width: 100% !important;
    height: auto !important;
  }

  .biography-content pre,
  .biography-content code {
    overflow-x: auto !important;
    white-space: pre-wrap !important;
  }

  /* Row layout fixes */
  .row {
    display: block !important;
    margin: 0 !important;
  }

  .row>.col {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    margin-bottom: 1.5rem !important;
  }

  /* Card fixes */
  .card {
    max-width: 100% !important;
    overflow: hidden;
  }

  .card-body {
    overflow-x: hidden !important;
  }

  /* Fix any inline styled grids */
  div[style*="grid-template-columns: repeat(auto-fit"] {
    display: block !important;
  }

  div[style*="grid-template-columns: repeat(auto-fit"]>div {
    margin-bottom: 1rem !important;
  }

  /* Specific fix for financial overview cards */
  .card-body>div>div[style*="background: linear-gradient"] {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
}