/* Reset and Variables */
:root {
  --bg-body: #ffffff;
  --bg-sidebar: #f8f9fa;
  --bg-input: #ffffff;
  --text-main: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --accent-color: #000000;
  --accent-hover: #333333;
  --spacing-unit: 1rem;
  --sidebar-width: 260px;
  --radius: 8px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden; /* App-like feel */
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease;
  z-index: 100;
  transform: translateX(0); /* Visible by default on desktop */
}

.logo {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.icon-logo {
  width: 24px;
  height: 24px;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

/* Navigation Items */
.nav-category {
  margin-bottom: 0.5rem;
}

.nav-category-header {
  padding: 0.75rem 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-category-header .icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1.5rem 0.6rem 2.5rem; /* Indented */
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  padding-left: 2.75rem; /* Subtle shift */
}

.nav-item.active {
  background-color: var(--border-color);
  font-weight: 600;
  border-right: 3px solid var(--accent-color);
}

/* Main Content */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background-color: var(--bg-body);
}

.top-bar {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

#page-title {
  font-size: 1.25rem;
  font-weight: 600;
}

#mobile-menu-btn {
  display: none; /* Hidden on desktop */
  background: white;
  border: none;
  cursor: grab;
  padding: 0.75rem;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1000;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  touch-action: none; /* Prevent scrolling while dragging */
}

#mobile-menu-btn:active {
  cursor: grabbing;
}

#mobile-menu-btn .icon {
  width: 24px;
  height: 24px;
}

/* Calculator Display Area */
#calculator-display {
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Calculator Grid Layout */
.calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 Columns: Input | Result */
  gap: 2rem;
  align-items: start;
}

.calculator-inputs {
  background: var(--bg-sidebar); /* Subtle background for inputs */
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.calculator-results {
  background: var(--text-main); /* Dark background for results */
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}

.calculator-results h3 {
  color: #fff;
  opacity: 0.8;
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.result-content {
  font-size: 1.5rem;
  font-weight: 300;
  word-break: break-word;
}

.result-content strong {
  font-weight: 600;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-input);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-color);
}

button.calculate-btn {
  width: 100%;
  padding: 1rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
}

button.calculate-btn:hover {
  background-color: var(--accent-hover);
}

/* Info/Description Text */
.calculator-description {
  grid-column: 1 / -1;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Welcome Screen */
.welcome-screen {
  text-align: center;
  color: var(--text-secondary);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.welcome-screen h2 {
  color: var(--text-main);
  margin-bottom: 1rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.calculator-wrapper {
  animation: fadeIn 0.4s ease-out;
}

/* Responsive */
@media (max-width: 900px) {
  .calculator-wrapper {
    grid-template-columns: 1fr; /* Stack on smaller screens */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%); /* Hidden by default on mobile */
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }

  .sidebar.active {
    transform: translateX(0); /* Slide in */
  }

  #mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Utility to hide elements */
.hidden {
  display: none !important;
}

/* Custom Radio Buttons */
.formula-radio-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.custom-radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  position: relative;
  user-select: none;
  font-weight: normal;
}

/* Hide default radio */
.custom-radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* Custom indicator */
.radio-mark {
  height: 20px;
  width: 20px;
  background-color: transparent;
  border: 2px solid #3B82F6; /* Blue border */
  border-radius: 50%;
  margin-right: 1rem; /* Spacing between radio and text */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* Inner dot */
.radio-mark::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #3B82F6; /* Blue fill */
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
}

/* Checked state */
.custom-radio-label input:checked ~ .radio-mark::after {
  opacity: 1;
  transform: scale(1);
}

/* Focus state */
.custom-radio-label input:focus ~ .radio-mark {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.radio-text {
  color: var(--text-main);
  font-size: 1.05rem;
}

/* What is this? Button */
.what-is-this-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 20px; /* Round pill shape */
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.what-is-this-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.what-is-this-btn:active {
  transform: translateY(1px);
}

/* Search Bar */
.search-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.95rem;
    background-color: var(--bg-body);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    opacity: 0.5;
    pointer-events: none;
}
