/* styles.css - Shared website styles with dark mode */

/* CSS Custom Properties for theming */
:root {
  /* Dark mode (default) */
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --header-bg: #2d2d2d;
  --header-text: #ffffff;
  --nav-bg: #3d3d3d;
  --nav-text: #e0e0e0;
  --nav-hover-bg: #4d4d4d;
  --nav-active-bg: #4a90c2;
  --main-bg: #2d2d2d;
  --border-color: #555;
  --shadow-color: rgba(0,0,0,0.3);
  --link-color: #66b3ff;
  --link-hover-color: #4da6ff;
  --footer-bg: #2d2d2d;
  --footer-text: #e0e0e0;
  --card-bg: #3d3d3d;
  --category-bg: #4a4a4a;
}

/* Light mode */
[data-theme="light"] {
  --bg-color: #ffffff;
  --text-color: #333333;
  --header-bg: #f8f9fa;
  --header-text: #333333;
  --nav-bg: #e9ecef;
  --nav-text: #333333;
  --nav-hover-bg: #dee2e6;
  --nav-active-bg: #007bff;
  --main-bg: #ffffff;
  --border-color: #dee2e6;
  --shadow-color: rgba(0,0,0,0.1);
  --link-color: #007bff;
  --link-hover-color: #0056b3;
  --footer-bg: #f8f9fa;
  --footer-text: #333333;
  --card-bg: #f8f9fa;
  --category-bg: #e9ecef;
}

/* Base styles */
* {
  box-sizing: border-box;
}

/* Initial page background - set before theme loads to prevent flash */
html {
  background-color: #1a1a1a; /* Dark by default */
}

html[data-theme="light"] {
  background-color: #ffffff; /* White for light mode */
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header styles */
header {
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 1rem;
  text-align: center;
  position: relative;
  transition: background-color 0.3s ease;
}

header h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.2;
}

/* Theme toggle button */
.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 2px solid var(--header-text);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--header-text);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: var(--nav-hover-bg);
  transform: scale(1.1);
}

.theme-toggle:focus {
  outline: 2px solid var(--nav-active-bg);
  outline-offset: 2px;
}

/* Navigation styles */
nav {
  background-color: var(--nav-bg);
  padding: 0.5rem;
  text-align: center;
  transition: background-color 0.3s ease;
}

nav a {
  color: var(--nav-text);
  margin: 0 1rem;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  display: inline-block;
}

nav a:hover {
  background-color: var(--nav-hover-bg);
  text-decoration: none;
}

nav a.active {
  background-color: var(--nav-active-bg);
}

/* Main content styles */
main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  flex: 1;
}

main h2 {
  color: var(--text-color);
  border-bottom: 2px solid var(--link-color);
  padding-bottom: 0.5rem;
  font-size: 32px;
  line-height: 1.3;
  margin: 2rem 0 1.5rem 0;
}

main h3 {
  color: var(--text-color);
  font-size: 28px;
  line-height: 1.3;
  margin: 1.5rem 0 1rem 0;
}

main p {
  margin-bottom: 1.5rem;
  color: var(--text-color);
  line-height: 1.7;
}

main a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

main a:hover {
  text-decoration: underline;
  color: var(--link-hover-color);
}

.page-intro {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

main ul li {
  color: var(--text-color);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

/* Footer styles */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 1rem;
  transition: background-color 0.3s ease;
  margin-top: auto;
}

footer p {
  margin: 0;
}

/* Card and component styles */
.page-intro {
  background-color: var(--card-bg);
  color: var(--text-color);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.category {
  background-color: var(--card-bg);
  color: var(--text-color);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow-color);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.category:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

.category h3 {
  color: var(--link-color);
  margin-top: 0;
  border-bottom: 2px solid var(--link-color);
  padding-bottom: 0.5rem;
}

.category ul {
  list-style: none;
  padding: 0;
}

.category li {
  margin: 0.8rem 0;
  padding: 0.5rem;
  background-color: var(--category-bg);
  border-radius: 4px;
  border-left: 3px solid var(--link-color);
  transition: background-color 0.3s ease;
}

.category a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: bold;
}

.category a:hover {
  text-decoration: underline;
  color: var(--link-hover-color);
}

.description {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
  margin-top: 0.3rem;
}

/* Categories grid layout */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Responsive design */
@media (max-width: 768px) {
  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  nav a {
    display: block;
    margin: 0.2rem 0;
    padding: 0.5rem;
  }
  
  main {
    padding: 1rem;
  }
  
  header h1 {
    font-size: 1.5rem;
    padding-right: 50px; /* Make space for theme toggle */
  }

  .categories {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Utility classes */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  text-align: left;
}

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

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

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

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus styles for accessibility */
button:focus,
a:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

/* Selection colors */
::selection {
  background-color: var(--link-color);
  color: white;
}
