/* Theme CSS Variables */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border-color: #334155;
  --nav-bg-from: rgba(30, 41, 59, 0.7);
  --nav-bg-to: rgba(15, 23, 42, 0.7);
  --mobile-menu-bg: #0f172a;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #e2e8f0;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --border-color: #cbd5e1;
  --nav-bg-from: rgba(241, 245, 249, 0.9);
  --nav-bg-to: rgba(226, 232, 240, 0.9);
  --mobile-menu-bg: #f1f5f9;
}

/* Utility classes for theme colors */
.theme-bg-primary {
  background-color: var(--bg-primary) !important;
}

.theme-bg-secondary {
  background-color: var(--bg-secondary) !important;
}

.theme-bg-card {
  background-color: var(--bg-card) !important;
}

.theme-text-primary {
  color: var(--text-primary) !important;
}

.theme-text-secondary {
  color: var(--text-secondary) !important;
}

.theme-border {
  border-color: var(--border-color) !important;
}

/* Navbar theming */
nav {
  background: linear-gradient(to bottom, var(--nav-bg-from), var(--nav-bg-to)) !important;
  border-bottom-color: var(--border-color) !important;
}

nav .nav-text {
  color: var(--text-primary) !important;
}

nav a:not(.text-primary):not(.bg-primary) {
  color: var(--text-secondary) !important;
}

nav #menuBtn {
  color: var(--text-primary) !important;
  display: block !important;
  opacity: 1 !important;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.5rem;
}

@media (min-width: 768px) {
  nav #menuBtn {
    display: none !important;
  }
}

[data-theme="light"] nav #menuBtn {
  color: #1e293b !important;
}

#mobileMenu {
  background-color: var(--mobile-menu-bg) !important;
  border-top-color: var(--border-color) !important;
}

#mobileMenu.hidden {
  display: none;
}

#mobileMenu:not(.hidden) {
  display: block;
}

@media (min-width: 768px) {
  #mobileMenu {
    display: none !important;
  }
}

/* Theme toggle button */
#themeToggle {
  position: relative;
  transition: all 0.3s ease;
  color: var(--text-primary);
  background-color: transparent;
  border: none;
  outline: none;
}

#themeToggle:focus {
  outline: none;
  box-shadow: none;
}

#themeToggle:hover {
  transform: rotate(20deg);
  background-color: transparent;
}

/* Default (dark theme): show sun icon to switch to light */
.theme-icon-sun {
  display: block;
}

.theme-icon-moon {
  display: none;
}

/* Light theme: show moon icon to switch to dark */
[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-icon-moon {
  display: block;
}

/* Mobile theme toggle */
#mobileThemeToggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#mobileThemeToggle:hover {
  color: var(--text-primary);
}

#mobileMenu a {
  color: var(--text-primary) !important;
}

/* Light theme Tailwind overrides */
[data-theme="light"] .text-primary {
  color: #0369a1 !important; /* Darker cyan for better readability in light theme */
}

[data-theme="light"] .text-slate-100 {
  color: #1e293b !important;
}

[data-theme="light"] .text-slate-200 {
  color: #334155 !important;
}

[data-theme="light"] .text-slate-300 {
  color: #475569 !important;
}

[data-theme="light"] .text-slate-400 {
  color: #64748b !important;
}

[data-theme="light"] .text-white {
  color: #0f172a !important;
}

[data-theme="light"] .bg-slate-700 {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
[data-theme="light"] .bg-slate-700\/50 {
  background-color: #f1f5f9 !important;
}
[data-theme="light"] .bg-slate-800 {
  background-color: #f8fafc !important;
}

[data-theme="light"] .bg-slate-900 {
  background-color: #f1f5f9 !important;
}

[data-theme="light"] .bg-slate-800\/60 {
  background-color: rgba(248, 250, 252, 0.8) !important;
}

[data-theme="light"] .border-slate-700 {
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .hover\:bg-slate-700:hover {
  background-color: #e2e8f0 !important;
}

[data-theme="light"] .text-amber-200 {
  color: #92400e !important;
}

[data-theme="light"] .text-yellow-400 {
  color: #ca8a04 !important;
}

/* Light theme for sections */
[data-theme="light"] section {
  background-color: var(--bg-primary) !important;
}

[data-theme="light"] .min-h-screen {
  background-color: var(--bg-primary) !important;
}

/* Footer theming */
footer {
  background-color: var(--bg-card) !important;
  border-top-color: var(--border-color) !important;
}

footer a {
  color: var(--text-secondary) !important;
}

footer a:hover {
  color: #38bdf8 !important;
}

footer p {
  color: var(--text-secondary) !important;
}

[data-theme="light"] footer {
  background-color: #e2e8f0 !important;
}

/* Theme toggle button */
.theme-icon-sun,
.theme-icon-moon {
  transition: opacity 0.3s ease;
}

[data-theme="light"] .theme-icon-sun {
  display: block !important;
}

[data-theme="light"] .theme-icon-moon {
  display: none !important;
}

[data-theme="dark"] .theme-icon-sun {
  display: none !important;
}

[data-theme="dark"] .theme-icon-moon {
  display: block !important;
}

/* Table row striping */
tbody tr:nth-child(even) {
  background-color: rgba(51, 65, 85, 0.3) !important;
}

[data-theme="light"] tbody tr:nth-child(even) {
  background-color: rgba(226, 232, 240, 0.5) !important;
}
