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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header and Navigation */
.main-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  padding: 1rem 0;
}

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

.nav-brand a {
  text-decoration: none;
  color: #2563eb;
}

.nav-brand h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.nav-menu {
  display: flex;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
}

.nav-link {
  text-decoration: none;
  color: #374151;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  background: #2563eb;
  color: white;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 4px;
}

.nav-toggle span {
  width: 25px;
  height: 3px;
  background: #374151;
  transition: all 0.3s ease;
}

/* Hero Section */
.hero {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 3rem 0;
  text-align: center;
  color: white;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero-content h2 {
  font-size: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  opacity: 0.95;
}

.hero-description {
  font-size: 1.1rem;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto;
}

/* Main Content */
.main-content {
  padding-bottom: 4rem;
}

.calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  background: white;
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  margin-bottom: 4rem;
}

.calculator-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.triangle-container {
  background: #f8fafc;
  border-radius: 20px;
  padding: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.side-label {
  font-size: 20px;
  font-weight: bold;
  fill: #2563eb;
}

/* Form Styles */
.form-header {
  margin-bottom: 2rem;
  text-align: center;
}

.form-header h3 {
  color: #1e293b;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.form-header p {
  color: #6b7280;
  font-size: 1.1rem;
}

.unit-selector {
  margin-bottom: 2rem;
}

.unit-selector label {
  display: block;
  margin-bottom: 0.8rem;
  font-weight: 600;
  color: #374151;
  font-size: 1.1rem;
}

.unit-selector select {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.unit-selector select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.unit-selector-inline {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Input Group and Unit Styles */
.input-group {
  margin-bottom: 2rem;
  position: relative;
}

.input-group label {
  display: block;
  margin-bottom: 0.8rem;
  font-weight: 600;
  color: #374151;
  font-size: 1.1rem;
}

.input-container {
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 15px 80px 15px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.unit {
  position: absolute;
  right: 20px;
  top: 70%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
  background: white;
  padding: 2px 4px;
  border-radius: 4px;
}

/* Feet/Inches Input */
.feet-inches-input {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 15px;
}

.feet-inches-input input {
  width: 100px;
  padding: 12px 15px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 16px;
}

.feet-inches-input span {
  font-size: 16px;
  color: #6b7280;
  font-weight: 600;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 1.5rem;
  margin: 3rem 0 2rem 0;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 18px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

/* Results */
.result-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 15px;
  padding: 2rem;
  margin-top: 2rem;
  display: none;
  border-left: 5px solid #2563eb;
}

.result-section.show {
  display: block;
  animation: slideIn 0.4s ease-out;
}

.result-section h4 {
  color: #0369a1;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

#resultContent {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
}

.steps {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.steps h4 {
  color: #374151;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.step {
  margin: 0.8rem 0;
  padding: 0.8rem;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 3px solid #2563eb;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

.formula-card,
.examples-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.formula-card h3,
.examples-card h3 {
  color: #1e293b;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.formula-display {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 1.5rem 0;
  box-shadow: 0 8px 25px rgba(30, 41, 59, 0.3);
}

.formula-explanation ul {
  margin-left: 1.5rem;
}

.formula-explanation li {
  margin: 0.8rem 0;
  font-size: 1.1rem;
}

.example {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 1.5rem;
  border-radius: 12px;
  margin: 1.5rem 0;
  border-left: 4px solid #2563eb;
  position: relative;
}

/* Style for textbook-like square root overline */
.overline {
  border-top: 1px solid currentColor;
  padding: 0 2px;
}

.example-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s ease;
}

.example-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* Features Section */
.features-section {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  margin-bottom: 4rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.features-section h3 {
  text-align: center;
  color: #1e293b;
  margin-bottom: 3rem;
  font-size: 2.2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2.5rem;
}

.feature-item {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 15px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transition: all 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-item h4 {
  color: #2563eb;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.feature-item p {
  color: #6b7280;
  line-height: 1.6;
}

/* Tools Section */
.tools-section {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  margin-bottom: 4rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.tools-section h3 {
  text-align: center;
  color: #1e293b;
  margin-bottom: 3rem;
  font-size: 2.2rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.tool-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 15px;
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.tool-card:hover {
  border-color: #2563eb;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
}

.tool-card h4 {
  color: #2563eb;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.tool-card p {
  color: #6b7280;
  line-height: 1.6;
}

/* Footer */
.main-footer {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 4rem 0 2rem 0;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-section h4 {
  color: #f1f5f9;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}

.footer-section p {
  line-height: 1.7;
  opacity: 0.9;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin: 0.8rem 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

.footer-section a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: #e2e8f0;
}

.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 2rem;
  text-align: center;
}

.footer-bottom p {
  margin: 0.5rem 0;
  opacity: 0.7;
}

.seo-text {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Method Selector Styles */
.angle-method-selector {
  margin-bottom: 2rem;
}

.angle-method-selector label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  color: #374151;
  font-size: 1.1rem;
}

.method-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.method-btn {
  flex: 1;
  padding: 12px 20px;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.method-btn:hover {
  border-color: #2563eb;
  background: #f0f9ff;
}

.method-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.method-section {
  display: none;
}

.method-section.active {
  display: block;
}

/* Angle Labels in SVG */
.angle-label {
  font-size: 16px;
  font-weight: bold;
  fill: #e11d48;
}

/* Trigonometric Formulas */
.trig-formulas {
  background: #f8fafc;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.formula-item {
  margin: 1rem 0;
  padding: 0.8rem;
  background: white;
  border-radius: 8px;
  border-left: 3px solid #2563eb;
  font-family: "Courier New", monospace;
}

/* Angle Results Display */
.angle-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.angle-result-item {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 1.2rem;
  border-radius: 10px;
  border-left: 4px solid #2563eb;
}

.angle-result-item strong {
  display: block;
  font-size: 1.2rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.angle-result-item small {
  color: #6b7280;
  font-size: 0.9rem;
  font-family: "Courier New", monospace;
}

/* Application Cards */
.application-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.application-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 15px;
  padding: 2rem;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.application-card:hover {
  border-color: #2563eb;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
}

.application-card h4 {
  color: #2563eb;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.application-card p {
  color: #6b7280;
  line-height: 1.6;
}

/* Mobile Responsive for Method Buttons */
@media (max-width: 480px) {
  .method-buttons {
    flex-direction: column;
  }

  .angle-results {
    gap: 0.8rem;
  }

  .angle-result-item {
    padding: 1rem;
  }

  .application-grid {
    grid-template-columns: 1fr;
  }

  .trig-formulas {
    padding: 1rem;
  }

  .formula-item {
    font-size: 0.9rem;
  }
}

/* Distance Calculator Specific Styles */
.coordinate-plane {
  background: #f8fafc;
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.axis-label {
  font-size: 16px;
  font-weight: bold;
  fill: #374151;
}

.point-label {
  font-size: 12px;
  font-weight: 600;
  fill: #374151;
}

.distance-label {
  font-size: 14px;
  font-weight: bold;
  fill: #10b981;
}

.side-label {
  font-size: 11px;
  font-weight: 500;
  fill: #6b7280;
}

/* Points Input Layout */
.points-input {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.point-group {
  background: #f8fafc;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.point-group h4 {
  color: #2563eb;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  text-align: center;
}

.coordinate-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.coordinate-inputs .input-group {
  margin-bottom: 0;
}

.coordinate-inputs label {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.coordinate-inputs input {
  padding: 12px 15px;
  font-size: 16px;
}

/* Coordinate Summary */
.coordinate-summary {
  background: #f0f9ff;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  border-left: 3px solid #2563eb;
}

.coordinate-summary small {
  display: block;
  margin: 0.3rem 0;
  color: #374151;
}

/* Mobile Responsive for Distance Calculator */
@media (max-width: 768px) {
  .points-input {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .coordinate-plane {
    padding: 1.5rem;
  }

  .coordinate-plane svg {
    width: 250px;
    height: 200px;
  }
}

@media (max-width: 480px) {
  .point-group {
    padding: 1rem;
  }

  .coordinate-inputs {
    gap: 0.8rem;
  }

  .coordinate-plane svg {
    width: 200px;
    height: 160px;
  }
}

/* SEO Content Section */
.seo-content-section {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  margin-bottom: 4rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
}

.seo-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 15px;
  padding: 2rem;
  border-left: 4px solid #2563eb;
  transition: all 0.3s ease;
}

.seo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
}

.seo-card h3 {
  color: #1e293b;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.seo-card p {
  color: #374151;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.seo-card ul,
.seo-card ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.seo-card li {
  margin: 0.5rem 0;
  color: #374151;
  line-height: 1.6;
}

.seo-card strong {
  color: #2563eb;
  font-weight: 600;
}

.section-title {
  text-align: center;
  color: #1e293b;
  margin-bottom: 3rem;
  font-size: 2.2rem;
}

/* Additional SEO Keywords */
.additional-seo-keywords {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #374151;
  opacity: 0.7;
}

.additional-seo-keywords small {
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Mobile Responsive for SEO Content */
@media (max-width: 768px) {
  .seo-content-section {
    padding: 2rem;
  }

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

  .seo-card {
    padding: 1.5rem;
  }

  .seo-card h3 {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .seo-content-section {
    padding: 1.5rem;
  }

  .seo-card {
    padding: 1rem;
  }

  .seo-card ul,
  .seo-card ol {
    margin-left: 1rem;
  }
}

/* Error states */
.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
  color: #ef4444;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background: white;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transition: left 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 2rem 0;
  }

  .nav-link {
    padding: 1rem 2rem;
    width: 100%;
    text-align: center;
    border-radius: 0;
    display: block; /* Ensure link takes full block space */
  }

  .calculator-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }

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

  .features-grid {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .hero-content h2 {
    font-size: 2.2rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .button-group {
    flex-direction: column;
  }

  .feet-inches-input {
    flex-wrap: wrap;
    gap: 10px;
  }

  .triangle-container {
    padding: 2rem;
  }

  .triangle-container svg {
    width: 250px;
    height: 160px;
  }

  .unit {
    right: 15px;
    font-size: 13px;
    padding: 1px 3px;
  }
}

/* Accessibility helper class */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Legal Content Pages (Terms, Privacy) */
.legal-content {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  margin: 0 auto 4rem auto;
  max-width: 900px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  margin-top: 100px;
}

.legal-content h1 {
  font-size: 2.5rem;
  color: #1e293b;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 1rem;
}

.legal-content h3 {
  font-size: 1.5rem;
  color: #2563eb;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.legal-content p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: #374151;
}

/* Small Mobile */
@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .calculator-wrapper,
  .features-section,
  .tools-section {
    padding: 1.5rem;
  }

  .formula-card,
  .examples-card {
    padding: 2rem;
  }

  .hero {
    padding: 2rem 0;
  }

  .hero-content h2 {
    font-size: 1.8rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .nav-brand h1 {
    font-size: 1.5rem;
  }

  .feet-inches-input input {
    width: 80px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .input-group input,
  .unit-selector select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .unit {
    right: 12px;
    font-size: 12px;
    padding: 1px 2px;
  }

  .formula-display {
    font-size: 1.5rem;
    padding: 1.5rem;
  }
}
