/* CSS Variables for theming */
:root {
  --primary-color: #3C2415;
  --secondary-color: #6F4E37;
  --accent-color: #A67B5B;
  --light-accent: #C4915C;
  --background-color: #E6D5AA;
  --text-color: #3C2415;
  --text-secondary: #6F4E37;
  --white: #FFFFFF;
  --shadow: rgba(60, 36, 21, 0.1);
  --shadow-strong: rgba(60, 36, 21, 0.2);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Dark theme variables */
[data-theme="dark"] {
  --primary-color: #E6D5AA;
  --secondary-color: #C4915C;
  --accent-color: #A67B5B;
  --light-accent: #6F4E37;
  --background-color: #1a1a1a;
  --text-color: #E6D5AA;
  --text-secondary: #C4915C;
  --white: #2d2d2d;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-strong: rgba(0, 0, 0, 0.5);
}

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

*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Header */
.header {
  background: var(--white);
  box-shadow: 0 2px 20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.header__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header__logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  transition: var(--transition);
}

.header__logo:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

/* Navigation */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
  z-index: 1001;
  position: relative;
}

.nav__toggle-line {
  width: 25px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.nav__toggle.active .nav__toggle-line:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.nav__toggle.active .nav__toggle-line:nth-child(2) {
  opacity: 0;
}

.nav__toggle.active .nav__toggle-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.nav__overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav__overlay.show {
  opacity: 1;
  visibility: visible;
}

.nav__list {
  display: flex;
  list-style: none;
  gap: 30px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.nav__item {
  list-style: none;
}

.nav__link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 10px 15px;
  border-radius: var(--border-radius);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__link:hover,
.nav__link.active {
  background: var(--accent-color);
  color: var(--white);
}

.nav__icon {
  font-size: 1.2rem;
}

.nav__controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.theme-toggle,
.language-toggle {
  background: var(--accent-color);
  border: none;
  color: var(--white);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.theme-toggle:hover,
.language-toggle:hover {
  background: var(--secondary-color);
}

.theme-toggle__icon {
  font-size: 1.1rem;
}

.theme-toggle,
.language-toggle {
  background: var(--accent-color);
  background-color: var(--accent-color);
  border: none;
  color: var(--white);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  position: relative;
  z-index: 2;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.theme-toggle:hover,
.language-toggle:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.theme-toggle__icon {
  font-size: 1.1rem;
  display: inline-block;
}

/* Main content */
.main {
  min-height: calc(100vh - 200px);
  padding: 40px 0;
}

/* Sections */
.section {
  display: none;
  animation: fadeIn 0.5s ease-in-out;
}

.section--active {
  display: block;
}

.section__header {
  text-align: center;
  margin-bottom: 40px;
}

.section__title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.section__description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Calculator */
.calculator {
  max-width: 600px;
  margin: 0 auto;
}

.calculator__form {
  background: var(--white);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px var(--shadow);
  margin-bottom: 30px;
}

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

.form-group__label {
  display: block;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
  font-size: 1rem;
}

.form-group__input,
.form-group__select {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--accent-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--white);
  color: var(--text-color);
}

.form-group__input:focus,
.form-group__select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(60, 36, 21, 0.1);
}

/* Buttons */
.btn {
  padding: 15px 30px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn--primary {
  background: var(--primary-color);
  color: var(--white);
  width: 100%;
}

.btn--primary:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px var(--shadow-strong);
}

.btn--secondary {
  background: var(--accent-color);
  color: var(--white);
}

.btn--secondary:hover {
  background: var(--light-accent);
  transform: translateY(-2px);
}

/* Results */
.calculator__result {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px var(--shadow);
  display: none;
}

.calculator__result.show {
  display: block;
  animation: slideUp 0.5s ease-out;
}

.result-card {
  background: linear-gradient(135deg, var(--accent-color), var(--light-accent));
  padding: 25px;
  border-radius: var(--border-radius);
  color: var(--white);
  margin-bottom: 20px;
}

.result-card__title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.result-card__content {
  font-size: 1rem;
  line-height: 1.6;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.result-item {
  background: var(--background-color);
  padding: 20px;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--accent-color);
}

.result-item__label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.result-item__value {
  font-size: 1.1rem;
  color: var(--primary-color);
  font-weight: 700;
}

/* Timeline */
.timeline-container {
  max-width: 800px;
  margin: 0 auto;
}

.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-color);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  margin: 30px 0;
  width: 50%;
  padding: 20px;
}

.timeline-item:nth-child(odd) {
  left: 0;
  text-align: right;
  padding-right: 40px;
}

.timeline-item:nth-child(even) {
  left: 50%;
  text-align: left;
  padding-left: 40px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 25px;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 4px solid var(--white);
  box-shadow: 0 0 0 4px var(--accent-color);
}

.timeline-item:nth-child(odd)::before {
  right: -10px;
}

.timeline-item:nth-child(even)::before {
  left: -10px;
}

.timeline-card {
  background: var(--white);
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 20px var(--shadow);
  position: relative;
}

.timeline-card::before {
  content: '';
  position: absolute;
  top: 25px;
  width: 0;
  height: 0;
  border: 10px solid transparent;
}

.timeline-item:nth-child(odd) .timeline-card::before {
  right: -20px;
  border-left-color: var(--white);
}

.timeline-item:nth-child(even) .timeline-card::before {
  left: -20px;
  border-right-color: var(--white);
}

.timeline-card__week {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 10px;
}

.timeline-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.timeline-card__description {
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-card__date {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 10px;
}

/* Care sections */
.care-container {
  max-width: 1000px;
  margin: 0 auto;
}

.care-phase {
  background: var(--white);
  margin-bottom: 30px;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 20px var(--shadow);
  overflow: hidden;
}

.care-phase__header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  padding: 25px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.care-phase__header:hover {
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
}

.care-phase__title {
  font-size: 1.3rem;
  font-weight: 700;
}

.care-phase__toggle {
  font-size: 1.5rem;
  transition: var(--transition);
  display: inline-block;
}

.care-phase__content {
  padding: 30px;
  display: none;
}

.care-phase__content.show {
  display: block;
  animation: slideDown 0.3s ease-out;
}

.care-phase__intro {
  font-size: 1.05rem;
  color: var(--text-color);
  line-height: 1.7;
  margin-bottom: 25px;
  padding: 20px;
  background: var(--background-color);
  border-left: 4px solid var(--accent-color);
  border-radius: var(--border-radius);
  font-style: italic;
}

.care-list {
  list-style: none;
}

.care-list__item {
  padding: 15px 0;
  border-bottom: 1px solid var(--background-color);
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.care-list__item:last-child {
  border-bottom: none;
}

.care-list__icon {
  font-size: 1.5rem;
  margin-top: 5px;
  color: var(--accent-color);
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.care-list__content {
  flex: 1;
}

.care-list__title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.care-list__description {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Placeholders */
.timeline-placeholder,
.care-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 5px 20px var(--shadow);
}

/* Footer */
.footer {
  background: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 30px 0;
  margin-top: 60px;
}

.footer__content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.footer__logo {
  height: 35px;
  width: auto;
  opacity: 0.9;
  transition: var(--transition);
  filter: brightness(0) invert(1);
}

.footer__logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

.footer__text {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0;
}

.footer__links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.footer__link {
  color: var(--white);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.9;
  transition: var(--transition);
}

.footer__link:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer__separator {
  opacity: 0.5;
  margin: 0 5px;
}

.header__link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(60, 36, 21, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(230, 213, 170, 0.3);
  border-top: 4px solid var(--background-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loading-text {
  color: var(--background-color);
  font-size: 1.1rem;
  font-weight: 600;
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .header {
    overflow: visible;
    position: relative;
    padding: 0;
  }

  .header .container {
    overflow: visible;
    padding: 12px 15px;
  }

  .header__top {
    display: flex;
  }

  .header__title-text {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 120px);
  }

  .header__logo {
    height: 32px;
    width: auto;
    flex-shrink: 0;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    background: var(--white);
    box-shadow: 0 4px 10px var(--shadow);
    transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  }

  .header.menu-active .nav {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
  }

  .nav__toggle {
    display: flex;
    position: relative;
    top: 0;
    right: 0;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 6px;
  }

  .nav__list {
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 10px 0;
  }

  .nav__list.show {
    display: flex;
  }

  .nav__item {
    width: 100%;
    display: block !important;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .nav__link {
    width: 100%;
    padding: 15px 20px;
    justify-content: flex-start;
    border-radius: 0;
    border-bottom: 1px solid rgba(60, 36, 21, 0.1);
    transition: background-color 0.2s ease, transform 0.1s ease;
    color: var(--text-color);
    background: transparent;
  }

  .nav__link:hover {
    background-color: var(--accent-color);
    color: var(--white);
  }

  .nav__link:active {
    transform: scale(0.98);
    background-color: var(--accent-color);
  }


  .nav__controls {
    width: 100%;
    padding: 10px 20px;
    border-top: 1px solid rgba(60, 36, 21, 0.1);
    display: none;
  }

  .nav__list.show ~ .nav__controls {
    display: flex;
  }

  .section__title {
    font-size: 2rem;
  }

  .calculator__form {
    padding: 25px;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    width: 100%;
    left: 0 !important;
    padding-left: 50px !important;
    padding-right: 20px !important;
    text-align: left !important;
  }

  .timeline-item::before {
    left: 10px !important;
  }

  .timeline-card::before {
    left: -20px !important;
    border-right-color: var(--white) !important;
    border-left-color: transparent !important;
  }


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

@media (max-width: 480px) {
  .section__title {
    font-size: 1.8rem;
  }

  .calculator__form {
    padding: 20px;
  }

  .timeline-item {
    padding-left: 40px !important;
  }

  .milestone-card__header {
    padding: 20px;
  }

  .milestone-card__content {
    padding: 20px;
  }
}

/* FAQ Styles */
.faq-container {
  max-width: 900px;
  margin: 0 auto;
}

.faq-category {
  margin-bottom: 50px;
}

.faq-category__title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 3px solid var(--accent-color);
}

.faq-item {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 5px 20px var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.faq-item__question {
  width: 100%;
  background: none;
  border: none;
  padding: 25px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  transition: var(--transition);
}

.faq-item__question:hover {
  background: var(--background-color);
}

.faq-item__question[aria-expanded="true"] {
  background: var(--accent-color);
  color: var(--white);
}

.faq-item__question[aria-expanded="true"] .faq-item__icon {
  transform: rotate(180deg);
}

.faq-item__icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.faq-item__answer {
  padding: 0 25px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item__answer.active {
  max-height: 1000px;
  padding: 0 25px 25px 25px;
}

.faq-item__answer p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 15px;
}

.faq-item__answer p:last-child {
  margin-bottom: 0;
}

.faq-item__answer ul {
  margin: 15px 0;
  padding-left: 25px;
}

.faq-item__answer li {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 10px;
}

/* Privacy Styles */
.privacy-container {
  max-width: 900px;
  margin: 0 auto;
}

.privacy-header {
  margin-bottom: 40px;
  text-align: center;
}

.privacy-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin: 20px 0;
}

.privacy-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 15px;
}

.privacy-content {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 5px 20px var(--shadow);
  padding: 40px;
}

.privacy-section {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--background-color);
}

.privacy-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.privacy-section__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.privacy-section__content {
  color: var(--text-secondary);
  line-height: 1.8;
}

.privacy-section__content p {
  margin-bottom: 15px;
}

.privacy-section__content p:last-child {
  margin-bottom: 0;
}

.privacy-section__content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 20px 0 10px 0;
}

.privacy-section__content ul {
  margin: 15px 0;
  padding-left: 25px;
}

.privacy-section__content li {
  margin-bottom: 10px;
}

.privacy-section__content a {
  color: var(--accent-color);
  text-decoration: underline;
  transition: var(--transition);
}

.privacy-section__content a:hover {
  color: var(--secondary-color);
}

.privacy-contact {
  background: var(--background-color);
  padding: 30px;
  border-radius: var(--border-radius);
  margin-top: 40px;
}

.privacy-contact .privacy-section__title {
  margin-bottom: 15px;
}

/* Responsive adjustments for FAQ and Privacy */
@media (max-width: 768px) {
  .faq-item__question {
    font-size: 1rem;
    padding: 20px;
  }

  .faq-item__answer {
    padding: 0 20px;
  }

  .faq-item__answer.active {
    padding: 0 20px 20px 20px;
  }

  .privacy-content {
    padding: 25px;
  }

  .privacy-section__title {
    font-size: 1.3rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-strong: rgba(0, 0, 0, 0.7);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .nav,
  .footer,
  .loading-overlay {
    display: none !important;
  }

  .section {
    display: block !important;
  }

  .calculator__result {
    display: block !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
