/* Global box-sizing rule */
* {
  box-sizing: border-box !important;
}

/* Safari mobile-specific resets */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
  margin: 0 !important;
  padding: 0 !important;
}

article, section {
  margin: 0;
  padding: 0;
}

/* Mobile viewport fixes for iOS */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific styles */
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  
  main {
    padding: 0.5rem !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .stock-dashboard,
  .etf-dashboard {
    padding: 0.5rem !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Basic body and layout styles */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #ffffff;
  color: #000000;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Header styles now handled by Tailwind CDN --- */
/* Prevent any conflicts with header styles */
header a {
  text-decoration: none !important;
}

header h1 {
  text-decoration: none !important;
  border: none !important;
  outline: none !important;
}

/* Remove conflicting utility class definitions since we now use Tailwind CDN */

/* --- Unified Static Homepage Footer Styles --- */
footer {
  background: #ffffff !important;
  color: #000000 !important;
  border-top: 1px solid #e5e7eb !important;
  text-align: center;
  padding: 1.5rem 0 !important;
  margin-top: 2rem !important;
  font-size: 1rem !important;
  margin: 0 !important;
  width: 100%;
  box-sizing: border-box;
}

footer a {
  color: #000000 !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  margin: 0 0.5em;
  font-size: 1rem !important;
  transition: color 0.2s !important;
  opacity: 1 !important;
  -webkit-font-smoothing: auto !important;
  -moz-osx-font-smoothing: auto !important;
  filter: none !important;
}

footer a:hover {
  text-decoration: underline !important; /* Tailwind hover:underline exact match */
  color: #1d4ed8 !important; /* Keep same blue, just add underline on hover */
}

footer span {
  color: #9ca3af !important; /* Tailwind text-gray-400 for subtle separator */
  font-size: 1rem !important;
}

@media (max-width: 768px) {
  footer {
    padding: 1.5rem 0 !important; /* Keep same padding for mobile */
    font-size: 1rem !important;
  }
  footer a {
    font-size: 1rem !important; /* Keep consistent font size */
    margin: 0 0.5em;
  }
  footer span {
    font-size: 1rem !important; /* Keep consistent font size */
  }
}

/* Remove all conflicting nav/menu/header/footer styles */
nav, .layout, .menu-item, .menu-item a, .menu-item.stock-dashboard, .menu-item.etf-dashboard, .hamburger {
  background: none !important;
  color: inherit !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

nav {
  width: 0 !important;
  padding: 0 !important;
}

.menu-item, .menu-item a {
  padding: 0 !important;
  margin: 0 !important;
}

/* Hamburger Menu Styles */
.hamburger {
  display: none;
  font-size: 1.5em;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

/* Layout Container Styles */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Navigation Styles */
nav {
  width: 250px;
  background-color: #111;
  color: white;
  padding: 1em;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  padding: 0.5em 0;
}

nav li a {
  color: #00d8ff;
  text-decoration: none;
  font-weight: 500;
}

nav li a:hover {
  color: white;
  text-decoration: underline;
}

/* Main Content Area Styles */
main {
  flex: 1;
  padding: 2em;
  overflow-y: auto;
  font-size: 1.1em;
  line-height: 1.6;
}

/* Mobile and Smaller Screen Adjustments */
@media (max-width: 768px) {
  body {
    font-size: 17px;
  }

  nav {
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100% - 60px);
    transform: translateX(-100%);
    z-index: 1000;
  }

  nav.open {
    transform: translateX(0);
  }

  .hamburger {
    display: block;
  }

  .layout {
    flex-direction: column;
  }

  main {
    padding: 1rem !important;
    margin: 0 !important;
  }

  /* Extra mobile specificity for React components */
  .stock-dashboard,
  .etf-dashboard,
  article {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Ensure no default body margins on mobile */
  body {
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Even more specific mobile targeting for actual devices */
@media only screen and (max-device-width: 768px),
       only screen and (max-width: 768px) and (orientation: portrait),
       only screen and (max-width: 768px) and (orientation: landscape) {
  
  * {
    box-sizing: border-box !important;
  }
  
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }
  
  main {
    padding: 0.5rem !important;
    margin: 0 !important;
    width: 100% !important;
  }
  
  .stock-dashboard,
  .etf-dashboard,
  article {
    padding: 0.5rem !important;
    margin: 0 !important;
    width: 100% !important;
  }
}

/* Specific iPhone targeting */
@media only screen 
  and (device-width: 375px) 
  and (device-height: 667px) 
  and (-webkit-device-pixel-ratio: 2),
  only screen 
  and (device-width: 414px) 
  and (device-height: 736px) 
  and (-webkit-device-pixel-ratio: 3),
  only screen 
  and (device-width: 375px) 
  and (device-height: 812px) 
  and (-webkit-device-pixel-ratio: 3) {
  
  html, body, main, .stock-dashboard, .etf-dashboard, article {
    margin: 0 !important;
    padding: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Simplified Styles for Menu */
#menu {
  list-style-type: none;
  padding: 0;
  margin: 0;
  font-family: Arial, sans-serif;
}

.menu-item {
  margin-bottom: 5px;
  font-size: 16px; /* Slightly smaller font size for compactness */
}

.menu-item a {
  text-decoration: none;
  color: #ddd;  /* Lighter color for menu items */
  padding: 8px 10px; /* Reduced padding for a compact look */
  display: block;
  background-color: transparent;  /* No background color for other links */
  border-radius: 5px;
  font-weight: normal;
}

.menu-item a:hover {
  color: #00d8ff;  /* Highlight color on hover */
}

/* Refined styling for Stock Dashboard link with icon */
.menu-item.stock-dashboard a {
  display: flex;
  align-items: center;
  color: #ddd;
  text-decoration: none;
  font-weight: normal;
  padding: 8px 10px;
  gap: 0.4em;
  background-color: transparent;
}

.menu-item.stock-dashboard a:hover {
  color: #00d8ff;
  text-decoration: underline;
}

/* Styling for the sub-menu under Stock Dashboard */
.submenu {
  list-style-type: none;
  padding-left: 15px;  /* Reduced padding to make it more compact */
  margin: 0;
}

.submenu-item {
  margin-bottom: 3px; /* Reduced space between items */
}

.submenu-item a {
  font-size: 13px;
  color: #bbb;
  padding: 2px 6px;
  text-decoration: none;
  display: block;
  background: none;
  border: none;
  text-align: left;
  border-radius: 0;
  line-height: 1.4;
}

.submenu-item a:hover {
  color: #00d8ff;
  background-color: transparent;
  text-decoration: underline;
}

/* --- Stock Dashboard Page --- */

.stock-dashboard {
  padding: 1rem;
}

/* Removed conflicting h1 styles to allow React inline styles to work */

/* Specific styling for dashboard main titles */
.dashboard-main-title {
  font-size: 2.5rem !important;
  font-weight: 800 !important;
  color: #000000 !important;
  margin-bottom: 1rem !important;
  text-align: left !important;
  letter-spacing: -0.025em !important;
}

/* Mobile optimizations for reduced outer padding and larger fonts */
@media (max-width: 768px) {
  .stock-dashboard {
    padding: 0.25rem !important;
  }
  
  .dashboard {
    padding: 0.25rem !important;
  }
  
  .stock-dashboard h1,
  .stock-dashboard h2,
  .dashboard h1 {
    font-size: 1.8rem !important;
  }
  
  .stock-dashboard h3,
  .dashboard h3 {
    font-size: 1.4rem !important;
  }
  
  /* Increase general text sizes */
  .stock-dashboard p,
  .stock-dashboard li,
  .stock-dashboard a,
  .stock-dashboard input {
    font-size: 1.1rem !important;
  }
  
  /* Override general paragraph styling for Performance Notes using class selector */
  .stock-dashboard .performance-notes p,
  .dashboard .performance-notes p {
    font-size: 0.9rem !important;
  }
  
  /* Performance Notes title should be slightly larger but still smaller than h3 */
  .stock-dashboard .performance-notes p:first-child,
  .dashboard .performance-notes p:first-child {
    font-size: 1.05rem !important;
    font-weight: bold !important;
  }
  
  /* Table font size increases */
  table {
    font-size: 1rem !important;
  }
  
  table th,
  table td {
    font-size: 1rem !important;
  }
}

/* Grid layout for cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* Individual cards */
.card {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.card h3 {
  margin-top: 0;
  font-size: 1.2rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
  color: #111;
}

.card p, .card li {
  margin: 0.5em 0;
  font-size: 0.95rem;
}

/* For wide sections like SWOT or long text */
.full-width {
  grid-column: 1 / -1;
}

.card ul {
  padding-left: 1.2rem;
  margin: 0;
}

.swot-section {
  margin-top: 2rem;
}

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

.swot-card {
  background: #fff;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  border-left: 4px solid #ccc;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}

.swot-card:hover {
  transform: translateY(-2px);
}

.swot-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #222;
}

.swot-card ul {
  margin: 0;
  padding-left: 1.2rem;
  color: #444;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Color accents by SWOT type */
.swot-card.strengths {
  border-color: #28a745;
}

.swot-card.weaknesses {
  border-color: #dc3545;
}

.swot-card.opportunities {
  border-color: #17a2b8;
}

.swot-card.threats {
  border-color: #ffc107;
}

@media (max-width: 768px) {
  nav {
    transform: translateX(-100%);
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100% - 60px);
    width: 250px;
    background-color: #111;
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
  }

  nav.open {
    transform: translateX(0);
  }

  .layout {
    flex-direction: column;
  }

  .hamburger {
    display: block;
  }

  main {
    padding: 0.5rem;
  }
}
.menu-item {
  margin-bottom: 5px;
  font-size: 16px;
  padding-left: 0; /* Uniform indentation */
  margin-left: 0;
}

.menu-item a {
  padding: 8px 10px; /* Uniform padding inside link */
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: #ddd;
  text-decoration: none;
}

.menu-item a:hover {
  color: #00d8ff;
  text-decoration: underline;
}

/* Remove zero padding/margin overrides on specific menu items */
.menu-item.stock-dashboard,
.menu-item.etf-dashboard {
  padding-left: 8px;  /* Same as other menu items */
  margin-left: 0;
}

.menu-item.stock-dashboard a,
.menu-item.etf-dashboard a {
  padding-left: 8px;
}

.menu-item a svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  margin-right: 8px;
  vertical-align: middle;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* --- Ensure logo displays correctly in header --- */
.header-logo-img {
  height: 2.5rem;
  min-width: 40px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(14,165,233,0.08);
  transition: transform 0.2s;
  background: #fff;
}
.header-logo-img:hover {
  transform: scale(1.05);
}

/* --- Navigation buttons --- */
.header-nav-link,
.header-nav-btn {
  background: #2563eb !important;
  color: #fff !important;
  font-weight: 500;
  text-decoration: none;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  margin-left: 0.5rem;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  box-shadow: 0 1px 4px rgba(14,165,233,0.08);
  border: none;
  display: inline-block;
}
.header-nav-link.bg-purple,
.header-nav-btn.bg-purple {
  background: #9333ea !important;
}
.header-nav-link:hover,
.header-nav-btn:hover {
  background: #0369a1 !important;
  color: #fff !important;
  transform: scale(1.05);
}
.header-nav-link.bg-purple:hover,
.header-nav-btn.bg-purple:hover {
  background: #6d28d9 !important;
}

/* --- Mobile nav overlay --- */
/* Let Tailwind classes handle mobile menu styling */

/* --- Blog Dropdown Styles (copied from static homepage) --- */
#blog-nav-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  width: 16rem;
  background: #fff;
  border: 1px solid #cce6ff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(14,165,233,0.10);
  z-index: 1010;
  padding: 0.5rem 0;
  transition: all 0.2s;
  overflow: hidden;
  display: block;
}
#blog-nav-dropdown.hidden {
  display: none !important;
}
#blog-nav-dropdown a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #1e293b;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
#blog-nav-dropdown a:hover {
  background: #e0f2fe;
  color: #0369a1;
}

/* --- Header container and flex fixes --- */
/* Removed duplicate header styles - using Tailwind utilities instead */

/* Header styles now match static exactly - no font overrides */

header span {
  font-weight: 500 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Ensure dropdown links have proper font weight */
#blog-nav-dropdown a {
  font-weight: 400 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Ensure mobile menu elements have proper font weights */
#new-mobile-menu h3 {
  font-weight: 600 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

#new-mobile-menu a {
  font-weight: 400 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Override React app default font styling for header elements */
header * {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Specific overrides for header navigation elements to match static exactly */
header a[aria-label="Stock Dashboard"],
header a[aria-label="ETF Returns"] {
  font-weight: 500 !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
}

header button[aria-label="Open Blogs menu"] {
  font-weight: 500 !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
}

/* Force header title styling to match static exactly */
header h1 {
  font-weight: 700 !important;
  font-size: clamp(1.5rem, 4vw, 1.875rem) !important;
  line-height: 1.2 !important;
}

/* Force header tagline styling to match static exactly */
header span {
  font-weight: 500 !important;
  font-size: clamp(0.875rem, 2vw, 1rem) !important;
  line-height: 1.5 !important;
}

/* AGGRESSIVE font weight overrides to match static header exactly */
body header a,
body header button,
body header .bg-blue-600,
body header .bg-purple-600,
body header .bg-gray-100,
div header a,
div header button {
  font-weight: 500 !important;
  -webkit-font-smoothing: auto !important;
  -moz-osx-font-smoothing: auto !important;
}

body header h1,
div header h1 {
  font-weight: 700 !important;
  -webkit-font-smoothing: auto !important;
  -moz-osx-font-smoothing: auto !important;
}

body header span,
div header span {
  font-weight: 500 !important;
  -webkit-font-smoothing: auto !important;
  -moz-osx-font-smoothing: auto !important;
}

/* Force specific font weights with React Link components */
header a[href="/"],
header a[href="/etfs"],
header a[aria-label*="Dashboard"] {
  font-weight: 500 !important;
  font-style: normal !important;
  text-rendering: optimizeLegibility !important;
}

/* Override any Tailwind font-medium class conflicts */
.font-medium {
  font-weight: 500 !important;
}

.font-bold {
  font-weight: 700 !important;
}

/* Override React app base styles that might be affecting font rendering */
#root header *,
[data-reactroot] header * {
  font-weight: inherit !important;
}

#root header a,
#root header button,
[data-reactroot] header a,
[data-reactroot] header button {
  font-weight: 500 !important;
}

#root header h1,
[data-reactroot] header h1 {
  font-weight: 700 !important;
}

/* Ensure Tailwind classes work properly */
#root .font-medium,
[data-reactroot] .font-medium {
  font-weight: 500 !important;
}

#root .font-bold,
[data-reactroot] .font-bold {
  font-weight: 700 !important;
}
