/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Remove padding/margin so toolbar won't shift content */
}

/* === Night Mode Body === */
body.night-mode {
  background-color: #121212;
  color: #eee;
}

/* Navbar */
/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #1b2a4e;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  color: white;
  z-index: 1000; /* Make sure navbar is on top */
}

/* Night mode navbar shadow fix */
body.night-mode .navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Push down page content so it’s not under navbar */
body, main {
  padding-top: 72px; /* Adjust this height to navbar height */
}

.logo {
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 1px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center; /* vertically center nav items */
  margin: 0; /* remove margin */
  padding: 0; /* remove padding */
}

.nav-links li {
  margin: 0;
}

.navbar .nav-links li a {
  color: #fff !important; /* Force white */
  text-decoration: none !important; /* Remove underline */
}

.navbar .nav-links li a:hover {
  color: #90caf9 !important; /* Light blue hover */
  text-decoration: none !important;
}


/* Tool Menu (adjusted for new toolbar) */
.tools-menu {
  position: absolute;
  top: 1rem;
  right: 2rem;
  display: flex;
  gap: 0.5rem;
}

.tools-menu button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.tools-menu button:hover,
.tools-menu button:focus {
  color: #90caf9;
  outline: none;
}

/* Main Content */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem 1rem 3rem; /* reduced top padding from 3rem to 1.5rem */
}


body.night-mode main {
  background: #121212;
}

/* === Content Card === */
.content-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 3rem 4rem;
  max-width: 900px;
  width: 95%;
  margin: 0 auto 2rem; /* remove top margin, keep bottom */
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  transition: background-color 0.4s ease, color 0.4s ease;
  font-size: 1.1rem;
  line-height: 1.6;
}

body.night-mode .content-card {
  background-color: rgba(30, 30, 30, 0.9);
  color: #ddd;
}

/* Remove card background on large screens for cleaner look */
@media (min-width: 1024px) {
  .content-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    padding: 2rem 3rem;
  }
}

/* Typography */
h1 {
  font-weight: 700;
  color: #0d47a1;
  text-align: center;
  font-size: 2.4rem;
  letter-spacing: 0.03em;
}

.subtitle {
  font-weight: 600;
  font-size: 1.25rem;
  color: #555;
  text-align: center;
  margin-bottom: 1.2rem;
}

h2, h3 {
  font-size: 1.5rem;
  color: #0d47a1;
  margin-bottom: 1rem;
  border-bottom: 3px solid #90caf9;
  padding-bottom: 0.4rem;
  position: relative;
}

body.color-mode h2,
body.color-mode h3 {
  color: #1e88e5;
}

ul {
  list-style-type: disc;
  padding-left: 1.8rem;
  color: #333;
  line-height: 1.7;
}

ul li {
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
}

/* Highlight strong text in color mode */
body.color-mode ul li strong {
  background-color: #ffebee; /* soft red/pink highlight */
  padding: 2px 6px;
  border-radius: 5px;
}

/* Buttons */
.btn {
  align-self: center;
  background-color: #0d47a1;
  color: white;
  padding: 0.9rem 3rem;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(13, 71, 161, 0.55);
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  user-select: none;
}

.btn:hover,
.btn:focus {
  background-color: #1565c0;
  transform: translateY(-3px);
  outline: none;
}

/* Tooltip */
.tooltip {
  font-size: 1.1rem;
  margin-left: 0.35rem;
  cursor: help;
  color: #666;
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  background: #222;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 8px;
  white-space: nowrap;
  top: -2rem;
  left: 1.5rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

/* === Toolbar (Minimal + Clean) === */
.toolbar-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 1rem 2rem 0;
  z-index: 200;
}

.toolbar-btn .material-symbols-outlined {
  background-color: #fff;
  color: #0d47a1;
  padding: 3px;               /* Equal padding all around for square shape */
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-variation-settings: 'wght' 400, 'FILL' 0, 'GRAD' 0, 'opsz' 24;
  font-size: 24px;
  width: 36px;               /* Fix width and height for square */
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  user-select: none;
  transition: background-color 0.3s ease;
}


.toolbar-btn:hover .material-symbols-outlined {
  background-color: #e3f2fd; /* Light blue on hover */
  color: #1565c0;
}


.toolbar-btn {
  background-color: #666;
  color: #f1f1f1;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background-color 0.2s ease;
}

.toolbar-btn:hover {
  background-color: #888;
}

/* Hide label by default */
.toolbar-btn .btn-label {
  display: none;
}

/* When active, hide icon and show label */
.toolbar-btn.active .material-symbols-outlined {
  display: none;
}

.toolbar-btn.active .btn-label {
  display: inline;
}


/* Toolbar toggle stays as is */
@media (min-width: 1024px) {
  .content-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    padding: 2rem 3rem;
  }
}

/* Toolbar Container - fixed to the right, floating over content */
.toolbar-container {
  position: fixed;
  right: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 48px;
  z-index: 10000; /* Always on top */
  pointer-events: auto;
}

/* Toolbar Toggle Button - white square with shadow */
.toolbar-toggle {
  background-color: #fff;
  color: #0d47a1;     /* Deep blue icon */
  border: none;
  font-size: 1.4rem;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: background-color 0.3s ease, color 0.3s ease;
  pointer-events: auto;
}

.toolbar-toggle:hover {
  background-color: #f0f4f8;
  color: #084298;
}

/* Toolbar Menu */
.toolbar-menu {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  max-width: 48px;
  margin-top: 0.5rem;
  pointer-events: auto;
}

/* Show toolbar menu when active */
.toolbar-container.active .toolbar-menu {
  display: flex;
}

/* Toolbar buttons */
.toolbar-menu button {
  background-color: #fff;
  color: #0d47a1;
  border: none;
  padding: 6px;
  border-radius: 8px;
  font-size: 24px;
  width: 40px;
  height: 40px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background-color 0.2s ease;
  pointer-events: auto;
}

.toolbar-menu button:hover {
  background-color: #e3f2fd;
  color: #084298;
}

/* Material icon style inside buttons */
.toolbar-menu button span.material-symbols-outlined {
  font-variation-settings: 'wght' 400, 'FILL' 0, 'GRAD' 0, 'opsz' 24;
  font-size: 24px;
  line-height: 1;
  user-select: none;
}


/* When toolbar is open */
.toolbar-container.active .toolbar-menu {
  display: flex;
  /* keep narrow */
  max-width: 48px;
}


.toolbar-menu button:hover,
.toolbar-menu button:focus {
  background-color: #888;
  outline: none;
}

/* Night mode toolbar tweaks */
body.night-mode .toolbar-toggle,
body.night-mode .toolbar-menu button {
  background-color: #333;
  color: #eee;
}

body.night-mode .toolbar-menu {
  background-color: #444;
}

/* === Color Mode Styling Enhancements === */
body.color-mode {
  /* subtle background color for content */
  background-color: #f5f8fa;
  color: #222;
}

body.color-mode .content-card {
  background-color: #ffffffcc;
  box-shadow: 0 8px 30px rgba(30, 136, 229, 0.15);
}

body.color-mode .info-box {
  background-color: #f0f4c3; /* soft yellow */
  border-left-color: #cddc39;
}

body.color-mode .tips-box {
  background-color: #e1f5fe; /* light blue */
  border-left-color: #03a9f4;
}

/* === Night Mode === */
body.night-mode {
  background-color: #121821;
  color: #ddd;
}

body.night-mode a,
body.night-mode h2,
body.night-mode h3 {
  color: #90caf9;
}

body.night-mode .info-box,
body.night-mode .tips-box {
  background-color: #263238;
  border-left-color: #455a64;
}

/* Boxes */
.info-box, .tips-box {
  background-color: #bbdefb;
  padding: 1.5rem 1.8rem;
  border-left: 6px solid #0d47a1;
  border-radius: 10px;
  color: #222;
  font-size: 1rem;
  line-height: 1.5;
}

body.night-mode .info-box,
body.night-mode .tips-box {
  color: #eee;
}

/* Footer */
footer {
  background-color: #1b2a4e;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.95rem;
  color: #ccc;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .nav-links {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .content-card {
    padding: 2rem 1.5rem;
    font-size: 1rem;
  }

  .toolbar-container {
    margin: 1rem 1rem 0;
  }

  .toolbar-menu button {
    width: 100%;
  }
}
