/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --border: #e5e5e5;
  --accent: #0f766e;
  --accent-hover: #0d5f58;
  --light-bg: #f8f9f9;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  /* Increase touch target size */
  min-height: 44px;
  min-width: 44px;
}

.logo img {
  height: auto;
  width: 180px;
  max-width: 100%;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  /* Minimum touch target size for mobile */
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav a:hover {
  color: var(--text);
  background: var(--light-bg);
}

.nav a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown-toggle:hover {
  color: var(--text);
  background: var(--light-bg);
}

.nav-dropdown-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
  display: inline-block;
}

.nav-dropdown:hover .dropdown-arrow,
.nav-dropdown-toggle:focus .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1000;
  margin-top: 0.25rem;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-toggle:focus + .nav-dropdown-menu,
.nav-dropdown-menu:hover,
.nav-dropdown.active .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.nav-dropdown-menu a:first-child {
  border-radius: 4px 4px 0 0;
}

.nav-dropdown-menu a:last-child {
  border-radius: 0 0 4px 4px;
}

.nav-dropdown-menu a:hover {
  background: var(--light-bg);
}

.nav-dropdown-menu a:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Language Selector */
.language-selector {
  position: relative;
  display: inline-block;
}

.language-toggle {
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.language-toggle:hover {
  color: var(--text);
  background: var(--light-bg);
}

.language-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-flag {
  font-size: 1.2rem;
  line-height: 1;
}

.lang-code {
  font-weight: 600;
  font-size: 0.85rem;
}

.language-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1000;
  margin-top: 0.25rem;
}

.language-selector:hover .language-menu,
.language-selector.active .language-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s;
}

.language-option:first-child {
  border-radius: 4px 4px 0 0;
}

.language-option:last-child {
  border-radius: 0 0 4px 4px;
}

.language-option:hover {
  background: var(--light-bg);
}

.language-option.active {
  background: var(--light-bg);
  font-weight: 600;
}

.language-option .lang-flag {
  font-size: 1.3rem;
}

.language-option .lang-name {
  flex: 1;
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-dropdown-menu,
[dir="rtl"] .language-menu {
  left: 0;
  right: auto;
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--light-bg);
  margin-top: auto;
  padding: 2rem 1rem 1.5rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  padding: 0.5rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-links a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.footer-social a:hover {
  color: var(--accent);
}

.footer-copyright {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-copyright p {
  margin: 0;
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background-color 0.2s;
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--accent-hover);
}

.scroll-to-top:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scroll-arrow {
  font-size: 1.2rem;
  line-height: 1;
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.container {
  max-width: 950px;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
}

main {
  flex: 1;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
}

h2 {
  font-size: 1.3rem;
  margin: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  color: var(--text);
}

h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

p {
  margin: 0 0 1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.intro {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 2rem;
}

/* ==========================================================================
   Notice & Alert Boxes
   ========================================================================== */

.notice {
  background: var(--light-bg);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Cookie notice - hidden by default, can be shown with JS */
.cookie-notice {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--text);
  color: var(--bg);
  padding: 1rem;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.cookie-notice p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.cookie-notice button {
  background: var(--accent);
  color: white;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Checklist Styles
   ========================================================================== */

ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
}

li {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  min-height: 44px; /* Touch target size */
}

li:last-child {
  border-bottom: none;
}

label {
  cursor: pointer;
  flex: 1;
  /* Increase clickable area */
  padding: 0.25rem 0;
}

input[type="checkbox"] {
  /* Larger touch target for mobile */
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--accent);
}

input[type="checkbox"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Buttons & Actions
   ========================================================================== */

.actions {
  margin-top: 2.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  /* Minimum touch target */
  min-height: 44px;
  min-width: 44px;
}

button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:active {
  transform: scale(0.98);
}

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

.print:hover {
  background: var(--accent-hover);
}

.clear {
  background: #e5e7eb;
  color: #111;
}

.clear:hover {
  background: #d1d5db;
}

.print-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ==========================================================================
   Homepage Styles
   ========================================================================== */

.category-section {
  margin-bottom: 3rem;
}

.category-section h2 {
  margin-top: 2.5rem;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.checklist-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
  min-height: 44px;
}

.checklist-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.1);
}

.checklist-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.checklist-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.checklist-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Related checklists section */
.related-checklists {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-checklists h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list li {
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.related-list a {
  display: block;
  padding: 0.75rem 0;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.related-list a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Content Pages (About, Privacy)
   ========================================================================== */

.content-page {
  max-width: 950px;
}

.content-page h1 {
  margin-bottom: 1rem;
}

.content-page h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
}

.content-page ul,
.content-page ol {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.content-page li {
  padding: 0.25rem 0;
  border-bottom: none;
  display: list-item;
}

/* ==========================================================================
   Accordion Styles
   ========================================================================== */

.accordion-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 2rem 0;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  background: var(--bg);
  transition: background-color 0.2s;
  min-height: 44px;
  user-select: none;
}

.accordion-header:hover {
  background: var(--light-bg);
}

.accordion-header:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.accordion-header h2 {
  font-size: 1.3rem;
  flex: 1;
}

.accordion-chevron {
  color: var(--accent);
  font-size: 0.75rem;
  transition: transform 0.3s ease;
  margin-left: 1rem;
  flex-shrink: 0;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--bg);
}

.accordion-content ul,
.accordion-content ol {
  margin: 0 0 1rem 0;
  padding: 0.5rem 1.25rem 0.5rem 2.75rem;
}

.accordion-content p {
  padding: 0 1.25rem 1rem 1.25rem;
  margin: 0;
  line-height: 1.6;
}

.accordion-content li {
  padding: 0.5rem 0;
  border-bottom: none;
  display: list-item;
}

.accordion-item.active .accordion-header {
  background: var(--light-bg);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 640px) {
  .header-inner {
    /*flex-direction: column;
    gap: 1rem;
    align-items: flex-start;*/
  }

  .logo img {
    width: 150px;
  }

  .nav {
    /*width: 100%;
    justify-content: flex-start;*/
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.2rem;
  }

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

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .footer-inner {
    gap: 1rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }
}

/* Improve touch targets on very small screens */
@media (max-width: 375px) {
  input[type="checkbox"] {
    width: 1.75rem;
    height: 1.75rem;
  }

  li {
    padding: 1rem 0;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  /* Hide interactive elements */
  .site-header,
  .site-footer,
  .notice,
  .actions,
  .print-note,
  .related-checklists,
  .nav {
    display: none !important;
  }

  body {
    padding: 0;
    background: white;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  /* Show empty checkboxes for print */
  input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid #000;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    background: white;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Don't show checked state in print */
  input[type="checkbox"]:checked {
    background: white;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  h2 {
    font-size: 1.2rem;
    page-break-after: avoid;
  }

  li {
    page-break-inside: avoid;
    padding: 0.5rem 0;
  }

  ul {
    page-break-before: avoid;
  }

  /* Ensure good contrast for print */
  body {
    color: #000;
  }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

/* Skip to main content link (hidden unless focused) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Improve focus visibility for keyboard navigation */
a:focus,
button:focus,
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #000;
    --muted: #000;
  }
}

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