/* CSS Variables for Global Theming */
:root {
  /* Colors */
  --primary-color: #588157;
  --primary-hover: #80af81;
  --secondary-color: #38b000;
  --secondary-hover: #008000;
  --accent-color: #3498db;
  --accent-hover: #2980b9;
  --success-color: #2ecc71;
  --success-hover: #27ae60;
  --danger-color: #f44336;
  --danger-hover: #d32f2f;
  --warning-color: #ff9800;
  --warning-hover: #f57c00;
  --info-color: #2196f3;
  --info-hover: #1976d2;
  --flash-error-color: #f17269;
  --flash-success-color: #D6EFD8;
  
  /* Background Colors */
  --page-bg: #f6fff8;
  --container-bg: #f8f9fa;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --dropdown-bg: #d6efd8;
  
  /* Text Colors */
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #6c757d;
  --text-light: #ffffff;
  --text-flash-error: #d32f2f;
  --text-flash-success: #1A5319;
  
  /* Border Colors */
  --border-color: #ddd;
  --border-hover: #ccc;
  
  /* Navigation */
  --navbar-bg: #588157;
  --navbar-text: #000000;
  --navbar-hover-bg: #80af81;
  --navbar-hover-text: #ffffff;
  
  /* Footer */
  --footer-bg: #588157;
  --footer-text: #ffffff;
  --footer-hover: #f4a261;
  
  /* Shadows */
  --shadow-light: 0 0 10px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-heavy: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  
  /* Font */
  --font-family: 'Noto Sans Mono', monospace;
}

/* Dark Theme Variables */
html.dark {
  /* Colors - keep primary/secondary consistent but adjust for dark theme */
  --primary-color: #343a40;
  --primary-hover: #495057;
  --secondary-color: #38b000;
  --secondary-hover: #008000;
  --accent-color: #ff9800;
  --accent-hover: #f57c00;
  
  /* Background Colors */
  --page-bg: #1a1a1a;
  --container-bg: #2d2d2d;
  --card-bg: #3a3a3a;
  --input-bg: #4a4a4a;
  --dropdown-bg: #343a40;
  
/* Tool-specific Colors */
--tool-form-bg: #0e1722;



  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #e8e8e8;
  --text-muted: #b8b8b8;
  --text-light: #ffffff;
  
  /* Border Colors */
  --border-color: #666666;
  --border-hover: #888888;
  
  /* Navigation */
  --navbar-bg: #343a40;
  --navbar-text: #ffffff;
  --navbar-hover-bg: #495057;
  --navbar-hover-text: #ffffff;
  
  /* Footer */
  --footer-bg: #343a40;
  --footer-text: #d3d3d3;
  --footer-hover: #a9d9b7;
}

/* Ensure the body and html take full height and apply theme variables */
html,
body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-family);
  background-color: var(--page-bg);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* The main content container should flex to take available space */
.container {
  flex: 1; /* Makes the container take up remaining space between the header and footer */
  background-color: var(--container-bg);
}

.main-content ul {
  list-style-type: disc;
  padding-left: 20px;
}

/* Navbar styles */
.navbar {
  background-color: var(--navbar-bg);
  color: var(--navbar-text);
  padding: 0.3rem 1rem; /* Reduce padding to reduce thickness */
  position: relative;
}

/* Logo styles */
.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: 1rem;
}

.navbar-logo {
  height: 50px;
  width: 50px;
  object-fit: contain;
  transition: filter 0.3s ease;
}

/* Theme-specific logo display */
.navbar-logo.light-logo {
  display: block;
}

.navbar-logo.dark-logo {
  display: none;
}

html.dark .navbar-logo.light-logo {
  display: none;
}

html.dark .navbar-logo.dark-logo {
  display: block;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-toggler {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.navbar-collapse {
  display: flex;
  align-items: center;
  width: 100%;
}

/* Align navbar items to the left */
.navbar-nav {
  list-style: none;
  display: flex;
  align-items: center;
  flex-grow: 1;
  font-size: 1.5em;
  margin-left: 1rem; /* Adjust to align with footer links */
}

.nav-item {
  position: relative;
}

.nav-link {
  display: block;
  padding: 0.3rem 1rem; /* Reduce padding to reduce thickness */
  color: var(--navbar-text);
  text-decoration: none;
}

.nav-link:hover {
  background-color: var(--navbar-hover-bg);
  color: var(--navbar-hover-text);
}

.dropdown {
  position: relative;
}

.dropdown-toggle::after {
  content: ' ▼';
  font-size: 0.6em;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--dropdown-bg);
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 150px;
  border: 1px solid var(--border-color);
  z-index: 1000;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
}

.dropdown-item:hover {
  background-color: var(--navbar-hover-bg);
  color: var(--navbar-hover-text);
}

.dropdown:hover > .dropdown-menu,
.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
}

.dropdown-submenu > .dropdown-item::after {
  /*content: ' ▶'; */
  float: right;
  font-size: 0.6em;
}

.navbar-right {
  display: flex;
  align-items: center;
  font-size: 1.1em;
}


.base-toggle-btn {
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border: none;
  background-color: #38b000;
  color: #fff;
  border-radius: 0.25rem;
  font-size: 1em;
}

.base-toggle-btn:hover {
  background-color: #008000;
}

@media (max-width: 768px) {
  .navbar-toggler {
    display: block;
  }

  .navbar-collapse {
    display: none;
    flex-direction: column;
  }

  .navbar-collapse.show {
    display: flex;
  }

  .navbar-nav {
    flex-direction: column;
  }

  .navbar-right {
    flex-direction: column;
  }

  .nav-link {
    padding: 0.5rem 1rem;
  }
  
  /* Add vertical spacing between buttons in mobile view */
  .navbar-right .btn {
    margin: 0.5rem 0.5rem;
    display: block;
  }
  
  /* Responsive logo styles */
  .navbar-logo {
    height: 40px; /* Slightly smaller logo on mobile */
    width: 40px;
  }
  
  .navbar-container {
    flex-wrap: wrap;
  }
}

/* Profile Nav */

.user-dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn {
  background-color: #4caf50;
  color: white;
  padding: 10px;
  font-size: 16px;
  border: none;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}

.user-dropdown {
  margin-right: 1rem;
}

.dropbtn {
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border: none;
  background-color: #38b000;
  color: #fff;
  border-radius: 0.25rem;
  font-size: 1em;
}

.user-dropdown:hover .dropdown-content {
  display: block;
}

.user-dropdown:hover .dropbtn {
  background-color: #3e8e41;
}

/* Legacy dark theme styles - removed in favor of CSS variables */

/* Style for main content */
.main-content {
  padding: 2rem;
  text-align: center;
}

.main-content h1 {
  margin-bottom: 1rem;
}

.main-content ul {
  list-style: disc;
  margin: 0 auto;
  padding: 0;
  display: inline-block;
  text-align: left;
}

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

/* Style buttons for "Login" and "No Account? Register Here" */
.btn {
  padding: 0.5rem 1rem;
  margin: 0 0.5rem;
  text-decoration: none;
  color: #fff;
  background-color: #38b000;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

.btn:hover {
  background-color: #008000;
}

/* Theme Toggle Switch - Modern Design */
.theme-toggle-btn {
  --toggle-width: 56px;
  --toggle-height: 28px;
  --toggle-padding: 2px;
  --thumb-size: 24px;
  --thumb-offset: 28px;

  background: transparent !important;
  border: none;
  padding: 0;
  margin: 0 0.5rem;
  cursor: pointer;
  width: var(--toggle-width);
  height: var(--toggle-height);
  position: relative;
  overflow: visible;
  outline: none;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn:hover {
  background: transparent !important;
  transform: scale(1.05);
}

.theme-toggle-btn:active {
  transform: scale(0.98);
}

.theme-toggle-track {
  display: block;
  width: 100%;
  height: 100%;
  background: #e2e8f0;
  border-radius: 9999px;
  position: relative;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1),
              0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

html.dark .theme-toggle-track {
  background: #1e293b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
              0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle-track::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 9999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.theme-toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.theme-toggle-icon.sun {
  left: 5px;
  opacity: 0.5;
  transform: translateY(-50%) scale(0.85);
}

.theme-toggle-icon.moon {
  right: 4px;
  opacity: 1;
  transform: translateY(-50%) scale(1.4);
  width: 20px;
  height: 20px;
  filter: brightness(1) saturate(1);
}

html.dark .theme-toggle-icon.sun {
  opacity: 0.3;
  transform: translateY(-50%) scale(0.7);
}

html.dark .theme-toggle-icon.moon {
  opacity: 1;
  transform: translateY(-50%) scale(1.6);
  width: 22px;
  height: 22px;
}

/* Light mode - sun is active */
:not(html.dark) .theme-toggle-icon.sun {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

:not(html.dark) .theme-toggle-icon.moon {
  opacity: 1;
  transform: translateY(-50%) scale(0.9);
  filter: brightness(1) saturate(1.2);
}

.theme-toggle-thumb {
  position: absolute;
  left: var(--toggle-padding);
  top: var(--toggle-padding);
  width: var(--thumb-size);
  height: var(--thumb-size);
  background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4),
              0 1px 3px rgba(0, 0, 0, 0.2),
              inset 0 1px 1px rgba(255, 255, 255, 0.5);
  z-index: 2;
  will-change: transform;
}

html.dark .theme-toggle-thumb {
  transform: translateX(var(--thumb-offset));
  background: linear-gradient(145deg, #cbd5e1 0%, #94a3b8 100%);
  box-shadow: 0 2px 8px rgba(203, 213, 225, 0.3),
              0 1px 3px rgba(0, 0, 0, 0.2),
              inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.theme-toggle-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.theme-toggle-text.light {
  left: calc(var(--thumb-size) + var(--toggle-padding) + 4px);
  color: rgba(255, 255, 255, 0.9);
}

.theme-toggle-text.dark {
  right: calc(var(--thumb-size) + var(--toggle-padding) + 4px);
  color: rgba(255, 255, 255, 0.9);
}

/* Show only the active theme text */
.theme-toggle-text.light {
  opacity: 0;
}

.theme-toggle-text.dark {
  opacity: 0;
}

html.dark .theme-toggle-text.light {
  opacity: 0;
}

html.dark .theme-toggle-text.dark {
  opacity: 0;
}

/* Hover and Focus States */
.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  border-radius: 9999px;
}

.theme-toggle-btn:focus-visible .theme-toggle-track {
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15);
}

html.dark .theme-toggle-btn:focus-visible .theme-toggle-track {
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .theme-toggle-btn {
    margin: 0.5rem 0;
  }
}

/* Add smooth transition for theme change */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Adjust navbar items alignment */
.navbar-nav {
  justify-content: flex-start; /* Align items to the left */
}

.navbar-right {
  justify-content: flex-end;
}

/* Footer Styling */
.site-footer {
  background-color: var(--footer-bg);
  font-family: var(--font-family);
  padding: 20px;
  text-align: center;
}

.footer-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--footer-text);
}

.version {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  font-family: monospace;
  font-size: 0.9em;
  letter-spacing: 0.5px;
}

.footer-nav ul {
  list-style-type: none;
  padding: 0;
  margin: 10px 0 0;
}

.footer-nav ul li {
  display: inline;
  margin: 0 10px;
}

.footer-nav ul li a {
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav ul li a:hover {
  color: var(--footer-hover);
}

@media (min-width: 768px) {
  .footer-container {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Form Elements Styling */
input, select, textarea {
  background-color: var(--input-bg);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-family);
  font-size: 14px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Select dropdown options styling */
select option {
  background-color: var(--input-bg);
  color: var(--text-primary);
  padding: 8px 12px;
}

/* Ensure dropdown options are visible in dark mode */
html.dark select option {
  background-color: var(--input-bg);
  color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

label {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

/* Button Styling */
button, .btn {
  background-color: var(--secondary-color);
  color: var(--text-light);
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

button:hover, .btn:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-1px);
}

/* Legacy dark theme footer styles - removed in favor of CSS variables */

.flash-message {
  padding: 10px;
  margin: 10px 0;
  border-radius: 5px;
  text-align: center;
}

.flash-message.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.flash-message.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.flash-message.info {
  background-color: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.flash-message.warning {
  background-color: #fff3e0;
  color: #ef6c00;
  border: 1px solid #ffcc80;
}