/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  /* Background image setup */
  background-image: url('/images/background.png'); /* Replace with your image filename */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* Keeps image static while scrolling */
  min-height: 100vh;
}

/* Header styles */
header {
  background-color: rgba(44, 62, 80, 0.9) !important; /* Semi-transparent header */
  backdrop-filter: blur(5px); /* Blur effect behind header */
  color: white;
  padding: 40px 20px;
  text-align: center;
}

header h1 {
  font-size: 3em;
  font-weight: 700;
  margin-bottom: 10px;
  color: white;
}

header p {
  font-size: 1.2em;
  margin: 0;
  opacity: 0.9;
}

/* Navigation */
nav {
  background-color: rgba(44, 62, 80, 0.95); /* Semi-transparent navigation */
  backdrop-filter: blur(5px); /* Blur effect behind navigation */
  padding: 0;
  text-align: center;
  position: relative;
  z-index: 1000; /* Ensure nav is above main content */
}

.nav {
  list-style: none;
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

.nav > li {
  position: relative;
}

.nav > li > a,
.nav > li > span {
  display: block;
  padding: 15px 20px;
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s;
}

.nav > li > a:hover,
.nav > li > span:hover {
  background-color: #34495e;
}

.nav > li > span {
  cursor: pointer;
}

/* Submenu styles */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #34495e;
  min-width: 250px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 9999; /* Very high z-index to appear above everything */
  list-style: none;
  padding-top: 0;
  margin-top: 0;
}

/* Create a hover area that includes both the parent and submenu */
.nav > li:hover > .submenu {
  display: block;
}

/* Keep the submenu visible when hovering over the submenu itself */
.nav > li:hover .submenu:hover {
  display: block;
}

/* Alternative approach: use a wrapper div for better hover control */
.nav > li {
  position: relative;
}

/* Extend the hover area slightly to bridge any gaps */
.nav > li:hover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 1001;
}

.submenu li a {
  display: block;
  padding: 12px 20px;
  color: white;
  text-decoration: none;
  border-bottom: 1px solid #2c3e50;
  transition: background-color 0.3s;
}

.submenu li a:hover {
  background-color: #2c3e50;
}

.submenu li:last-child a {
  border-bottom: none;
}

/* Ensure smooth hover transition */
.nav > li,
.nav > li .submenu {
  transition: all 0.2s ease;
}

/* Make sure the submenu stays connected */
.nav > li:hover {
  position: relative;
}

.nav > li:hover .submenu {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  background-color: rgba(255, 255, 255, 0.7); /* 70% opaque for better text readability */
  backdrop-filter: blur(2px); /* Optional: adds subtle blur effect behind content */
  min-height: calc(100vh - 200px);
  border-radius: 8px; /* Optional: rounded corners for the content area */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Optional: subtle shadow */
  margin-top: 20px;
  margin-bottom: 20px;
  position: relative;
  z-index: 10; /* Lower z-index than navigation dropdowns */
}

/* Homepage specific centering */
body:has([title="My Digital Echo"]) main {
  text-align: center;
}

body:has([title="My Digital Echo"]) main h1 {
  text-align: center;
}

body:has([title="My Digital Echo"]) main h2 {
  text-align: center;
}

body:has([title="My Digital Echo"]) main p {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 15px auto;
}

/* Typography */
h1 {
  color: #2c3e50;
  font-size: 2.5em;
  margin-bottom: 20px;
  font-weight: 700;
}

h2 {
  color: #34495e;
  font-size: 1.8em;
  margin: 30px 0 15px 0;
  font-weight: 600;
}

h3 {
  color: #34495e;
  font-size: 1.4em;
  margin: 25px 0 10px 0;
  font-weight: 600;
}

p {
  margin-bottom: 15px;
  font-size: 1.1em;
}

/* Links */
a {
  color: #3498db;
  text-decoration: none;
}

a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin: 15px 0 15px 30px;
}

li {
  margin-bottom: 8px;
}

/* Form styles */
.form-container {
  max-width: 800px;
  margin: 20px 0;
}

.form-container h3 {
  color: #2c3e50;
  margin-top: 30px;
  margin-bottom: 10px;
}

.form-container textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 20px;
}

.form-container input[type="text"],
.form-container input[type="date"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 20px;
}

.form-container button {
  background-color: #3498db;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.form-container button:hover {
  background-color: #2980b9;
}

/* Checkmarks and X marks */
.form-container p:has-text("✅") {
  color: #27ae60;
  font-weight: 500;
}

.form-container p:has-text("❌") {
  color: #e74c3c;
  font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
  /* Body adjustments for mobile */
  body {
    background-attachment: scroll; /* Fixed backgrounds can cause issues on mobile */
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Header mobile styles */
  header {
    padding: 20px 15px;
  }
  
  header h1 {
    font-size: 2.2em;
    line-height: 1.2;
  }
  
  header p {
    font-size: 1em;
  }
  
  /* Navigation mobile styles */
  nav {
    text-align: center;
    padding: 0;
  }
  
  .nav {
    flex-direction: column;
    display: flex;
    width: 100%;
  }
  
  .nav > li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .nav > li:last-child {
    border-bottom: none;
  }
  
  .nav > li > a,
  .nav > li > span {
    padding: 18px 20px;
    font-size: 16px;
    display: block;
    width: 100%;
  }
  
  /* Mobile submenu - make it expand inline instead of dropdown */
  .submenu {
    position: static;
    display: none;
    box-shadow: none;
    background-color: #2c3e50;
    width: 100%;
    min-width: auto;
  }
  
  .nav > li:hover .submenu,
  .nav > li:focus .submenu {
    display: block;
  }
  
  .submenu li a {
    padding: 15px 30px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  /* Main content mobile */
  main {
    padding: 20px 15px;
    margin: 10px;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.85);
  }
  
  /* Typography mobile adjustments */
  h1 {
    font-size: 1.8em;
    line-height: 1.3;
    margin-bottom: 15px;
  }
  
  h2 {
    font-size: 1.4em;
    line-height: 1.3;
    margin: 25px 0 12px 0;
  }
  
  h3 {
    font-size: 1.2em;
    line-height: 1.3;
    margin: 20px 0 8px 0;
  }
  
  p {
    font-size: 1em;
    line-height: 1.6;
    margin-bottom: 12px;
  }
  
  /* Lists mobile */
  ul, ol {
    margin: 12px 0 12px 20px;
    padding-left: 0;
  }
  
  li {
    margin-bottom: 6px;
    line-height: 1.5;
  }
  
  /* Contact form mobile */
  .contact-form {
    margin: 20px 0;
    padding: 20px 15px;
    border-radius: 6px;
  }
  
  .form-group {
    margin-bottom: 18px;
  }
  
  .form-group label {
    font-size: 15px;
    margin-bottom: 6px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 4px;
  }
  
  .form-group textarea {
    min-height: 100px;
  }
  
  .submit-btn {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 4px;
  }
  
  /* Tables responsive */
  table {
    width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  /* Code blocks mobile */
  pre {
    padding: 12px;
    font-size: 14px;
    overflow-x: auto;
  }
  
  code {
    font-size: 14px;
    padding: 1px 4px;
  }
  
  /* Highlight boxes mobile */
  .highlight-box,
  .warning-box,
  .success-box {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
  }
  
  /* Footer mobile */
  footer {
    padding: 15px;
    margin-top: 20px;
  }
}

/* Small mobile devices (phones in portrait) */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.8em;
  }
  
  header p {
    font-size: 0.9em;
  }
  
  main {
    margin: 5px;
    padding: 15px 10px;
  }
  
  h1 {
    font-size: 1.6em;
  }
  
  h2 {
    font-size: 1.3em;
  }
  
  h3 {
    font-size: 1.1em;
  }
  
  .nav > li > a,
  .nav > li > span {
    padding: 16px 15px;
    font-size: 15px;
  }
  
  .submenu li a {
    padding: 12px 25px;
    font-size: 14px;
  }
  
  .contact-form {
    padding: 15px 10px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px 10px;
  }
}

/* Large tablets and small desktops */
@media (min-width: 769px) and (max-width: 1024px) {
  main {
    padding: 30px 25px;
  }
  
  header h1 {
    font-size: 2.8em;
  }
  
  .nav > li > a,
  .nav > li > span {
    padding: 15px 18px;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

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

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

/* Footer */
footer {
  background-color: rgba(44, 62, 80, 0.9); /* Semi-transparent footer */
  backdrop-filter: blur(5px); /* Blur effect behind footer */
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: 40px;
}

/* Contact Form Styling */
.contact-form {
  max-width: 600px;
  margin: 30px auto;
  padding: 30px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  background-color: #3498db;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 100%;
}

.submit-btn:hover {
  background-color: #2980b9;
}

.submit-btn:active {
  transform: translateY(1px);
}

/* Special content styling */
blockquote {
  border-left: 4px solid #3498db;
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
  color: #555;
}

code {
  background-color: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Consolas', monospace;
}

pre {
  background-color: #f4f4f4;
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 15px 0;
}

/* Highlight important sections */
.highlight-box {
  background-color: #e8f4fd;
  border: 1px solid #3498db;
  border-radius: 6px;
  padding: 20px;
  margin: 20px 0;
}

.warning-box {
  background-color: #fdf2e8;
  border: 1px solid #e67e22;
  border-radius: 6px;
  padding: 20px;
  margin: 20px 0;
}

.success-box {
  background-color: #e8f5e8;
  border: 1px solid #27ae60;
  border-radius: 6px;
  padding: 20px;
  margin: 20px 0;
}