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

html {
  overflow-x: hidden; /* Prevent horizontal scroll */
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif; /* Ensure Inter font is used */
  line-height: 1.6;
  color: #333;
  background-color: #fafafa;
  overflow-x: hidden; /* Prevent horizontal scroll */
  width: 100%;
  max-width: 100vw; /* Ensure body doesn't exceed viewport width */
}

/* Terms and Conditions Main Section */
.terms-main {
  min-height: 70vh;
  /* Padding for Navbar and Footer integration */
  /* Adjust padding-top based on your navbar's height */
  padding-top: 120px; /* Example: If navbar is ~80px tall, add 40px extra space */
  /* Adjust padding-bottom based on your footer's height */
  padding-bottom: 80px; /* Example: If footer is ~50px tall, add 30px extra space */
  padding-left: 20px;
  padding-right: 20px;
  width: 100%;
  max-width: 100vw; /* Prevent overflow */
  overflow-x: hidden;
}

/* Main Container for Terms Content (the white card) */
.terms-container {
  max-width: 900px; /* Max width for the content card */
  margin: 0 auto; /* Centers the container horizontally */
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden; /* Ensures content stays within rounded corners */
  width: 100%;
  position: relative; /* Establishes a stacking context for z-index */
  z-index: 1; /* Low z-index for the content container */
  /* IMPORTANT: For your navbar's dropdown to appear on top,
     its CSS must have a higher z-index (e.g., z-index: 9999)
     and appropriate positioning (e.g., position: absolute/fixed). */
}

/* Header Section (the yellow part) */
.terms-header {
  background: linear-gradient(135deg, #ffde59 0%, #f0c842 100%);
  padding: 40px;
  text-align: center;
  color: #333;
  width: 100%;
  word-wrap: break-word; /* Prevents text overflow */
}

.terms-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  word-wrap: break-word;
  hyphens: auto;
}

.terms-effective-date {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 24px;
  opacity: 0.8;
  word-wrap: break-word;
}

.terms-intro {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 700px;
  margin: 0 auto; /* Centers the intro text within the header */
  opacity: 0.9;
  word-wrap: break-word;
  hyphens: auto;
}

/* Content Area (the white part below the header) */
.terms-content {
  /* Increased horizontal padding for more gaps on the sides, like the refund page */
  padding: 40px 60px; /* Top/Bottom 40px, Left/Right 60px */
  width: 100%;
  overflow-x: hidden;
}

/* Individual Sections */
.terms-section {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid #eee;
  width: 100%;
  overflow-x: hidden;
}

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

.terms-section-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  padding-left: 16px;
  border-left: 4px solid #ffde59; /* Yellow accent bar */
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.terms-section p {
  font-size: 1rem;
  line-height: 1.7;
  color: #555;
  margin-bottom: 16px;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.terms-definitions p {
  margin-bottom: 12px;
  padding-left: 20px; /* Indent for definitions */
  word-wrap: break-word;
  max-width: calc(100% - 20px);
}

.terms-list {
  list-style: none; /* Remove default list style */
  padding-left: 0;
  width: 100%;
}

.terms-list li {
  font-size: 1rem;
  line-height: 1.7;
  color: #555;
  margin-bottom: 12px;
  padding-left: 24px; /* Indent for list items */
  position: relative;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.terms-list li::before {
  content: "•"; /* Custom bullet point */
  color: #ffde59;
  font-weight: bold;
  position: absolute;
  left: 8px;
  font-size: 1.2rem;
}

/* Contact Information Blocks */
.terms-contact-info {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-top: 16px;
  border-left: 4px solid #ffde59;
  width: 100%;
  overflow-x: hidden;
}

.terms-contact-info p {
  margin-bottom: 8px;
  font-size: 0.95rem;
  word-wrap: break-word;
  max-width: 100%;
}

.terms-contact-info a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s ease;
  word-wrap: break-word;
}

.terms-contact-info a:hover {
  color: #ffde59;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #ffde59;
  color: #333;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: #e6c850;
  transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .terms-main {
    padding-top: 100px; /* Adjusted for smaller navbars on tablets */
    padding-left: 16px;
    padding-right: 16px;
  }
  .terms-title {
    font-size: 2rem;
  }
  .terms-header {
    padding: 30px 20px;
  }
  .terms-content {
    /* Adjusted horizontal padding for tablets */
    padding: 30px 40px; /* Top/Bottom 30px, Left/Right 40px */
  }
  .terms-section-title {
    font-size: 1.2rem;
  }
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .terms-main {
    padding-top: 80px; /* Adjusted for mobile navbars */
    padding-left: 12px;
    padding-right: 12px;
  }
  .terms-title {
    font-size: 1.8rem;
  }
  .terms-section-title {
    font-size: 1.1rem;
    padding-left: 12px;
  }
  .terms-section p,
  .terms-list li {
    font-size: 0.9rem;
  }
  .terms-header {
    padding: 24px 16px;
  }
  .terms-content {
    /* Adjusted horizontal padding for mobile phones */
    padding: 24px 20px; /* Top/Bottom 24px, Left/Right 20px */
  }
  .terms-contact-info {
    padding: 16px;
  }
  .terms-definitions p {
    padding-left: 16px;
    max-width: calc(100% - 16px);
  }
  .terms-list li {
    padding-left: 20px;
  }
  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* Extra small devices */
@media (max-width: 320px) {
  .terms-main {
    padding-top: 70px; /* Adjusted for very small mobile screens */
    padding-left: 8px;
    padding-right: 8px;
  }
  .terms-title {
    font-size: 1.6rem;
  }
  .terms-header {
    padding: 20px 12px;
  }
  .terms-content {
    padding: 20px 16px; /* Adjusted horizontal padding for extra small screens */
  }
  .terms-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
  }
  .terms-section-title {
    padding-left: 8px;
  }
  .terms-definitions p {
    padding-left: 12px;
    max-width: calc(100% - 12px);
  }
  .terms-list li {
    padding-left: 16px;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }
  .terms-main {
    padding: 0;
    background: white;
  }
  .terms-container {
    box-shadow: none;
    border-radius: 0;
  }
  .terms-header {
    background: white !important;
    color: black !important;
  }
  .terms-section-title {
    border-left-color: black !important;
  }
  .terms-list li::before {
    color: black !important;
  }
  .terms-contact-info {
    background: white !important;
    border-left-color: black !important;
  }
  .back-to-top {
    display: none !important;
  }
}

/* Loading animation */
.terms-container {
  animation: fadeInUp 0.6s ease-out;
}

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

/* Hover effects */
.terms-section {
  transition: all 0.3s ease;
}

.terms-section:hover {
  transform: translateX(5px);
}

.terms-section-title {
  transition: color 0.3s ease;
}

.terms-section:hover .terms-section-title {
  color: #ffde59;
}

/* Focus styles for accessibility */
a:focus,
button:focus {
  outline: 2px solid #ffde59;
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: #ffde59;
  color: #333;
}

::-moz-selection {
  background: #ffde59;
  color: #333;
}

/* Additional overflow prevention */
.terms-main *,
.terms-container *,
.terms-content *,
.terms-header * {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Ensure all text elements don't cause overflow */
h1,
h2,
h3,
h4,
h5,
h6,
p,
li,
span,
div {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Progress bar styling */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, #ffde59, #f0c842);
  z-index: 9999;
  transition: width 0.1s ease;
  max-width: 100vw;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 100px;
  right: 30px;
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  max-width: calc(100vw - 60px);
  word-wrap: break-word;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #ffde59;
  color: #333;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s ease;
  max-width: calc(100vw - 12px);
}

.skip-link:focus {
  top: 6px;
}

/* Active section highlighting */
.terms-section-title.active {
  color: #ffde59 !important;
  transform: translateX(5px);
  transition: all 0.3s ease;
}

/* Fix for very long URLs or email addresses */
a[href^="mailto:"],
a[href^="http://"],
a[href^="https://"] {
  word-break: break-all;
  overflow-wrap: break-word;
}
