/* Material Design 3 - Policy Pages Styles */

/* Policy Page Layout */
.policy-page {
  background-color: var(--md-sys-color-surface);
  min-height: 100vh;
  padding-top: 72px; /* Account for fixed header */
}

.policy-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (max-width: 1024px) {
  .policy-wrapper {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Table of Contents */
.policy-toc {
  position: sticky;
  top: 96px; /* 72px header + 24px padding */
  height: fit-content;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 24px;
}

@media (max-width: 1024px) {
  .policy-toc {
    position: static;
    max-height: none;
  }
}

.policy-toc-title {
  font-size: var(--md-sys-typescale-title-medium-font-size);
  font-weight: var(--md-sys-typescale-title-medium-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 16px 0;
}

.policy-reading-time {
  font-size: var(--md-sys-typescale-body-small-font-size);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}

.policy-toc nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.policy-toc nav li {
  margin-bottom: 8px;
}

.policy-toc-link {
  display: block;
  padding: 8px 12px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: var(--md-sys-typescale-body-medium-font-size);
  border-radius: var(--md-sys-shape-corner-small);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.policy-toc-link:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.policy-toc-link.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 500;
}

/* Main Content */
.policy-container {
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 48px;
  max-width: 100%;
  box-sizing: border-box;
}

.policy-content {
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 599px) {
  .policy-container {
    padding: 24px;
  }
}

.policy-header {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.policy-title {
  font-size: var(--md-sys-typescale-headline-large-font-size);
  font-weight: var(--md-sys-typescale-headline-large-font-weight);
  line-height: var(--md-sys-typescale-headline-large-line-height);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

/* Policy Sections */
.policy-section {
  margin-bottom: 48px;
  scroll-margin-top: 88px; /* Account for fixed header */
}

.policy-section h2 {
  font-size: var(--md-sys-typescale-title-large-font-size);
  font-weight: var(--md-sys-typescale-title-large-font-weight);
  line-height: var(--md-sys-typescale-title-large-line-height);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-medium-font-size);
  font-weight: var(--md-sys-typescale-label-medium-font-weight);
  flex-shrink: 0;
}

.policy-section h3 {
  font-size: var(--md-sys-typescale-title-medium-font-size);
  font-weight: var(--md-sys-typescale-title-medium-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 32px 0 16px 0;
}

.policy-section p {
  font-size: var(--md-sys-typescale-body-large-font-size);
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 16px 0;
}

.policy-section ul,
.policy-section ol {
  margin: 0 0 16px 0;
  padding-left: 24px;
}

.policy-section li {
  font-size: var(--md-sys-typescale-body-large-font-size);
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

/* Tables */
.cookie-table,
.storage-table,
.policy-table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  table-layout: fixed;
  word-wrap: break-word;
}

.cookie-table th,
.storage-table th,
.policy-table th {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-label-large-font-size);
  font-weight: var(--md-sys-typescale-label-large-font-weight);
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.cookie-table td,
.storage-table td,
.policy-table td {
  padding: 16px;
  font-size: var(--md-sys-typescale-body-medium-font-size);
  color: var(--md-sys-color-on-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cookie-table tr:last-child td,
.storage-table tr:last-child td,
.policy-table tr:last-child td {
  border-bottom: none;
}

.cookie-table strong,
.storage-table strong {
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
}

/* Cookie Notice */
.cookie-notice {
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  padding: 24px;
  border-radius: var(--md-sys-shape-corner-medium);
  margin: 24px 0;
}

.cookie-notice p {
  margin: 0;
}

.cookie-notice p:first-child {
  font-weight: 500;
  margin-bottom: 8px;
}

/* Policy Date */
.policy-date {
  background-color: var(--md-sys-color-surface);
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-small);
  margin-top: 24px;
}

.policy-date p {
  font-size: var(--md-sys-typescale-body-medium-font-size);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

.policy-date p:last-child {
  margin-top: 4px;
}

/* Contact Section */
.policy-contact {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 32px;
  border-radius: var(--md-sys-shape-corner-large);
  margin-top: 48px;
}

.policy-contact h3 {
  font-size: var(--md-sys-typescale-headline-small-font-size);
  font-weight: var(--md-sys-typescale-headline-small-font-weight);
  margin: 0 0 16px 0;
}

.policy-contact p {
  font-size: var(--md-sys-typescale-body-large-font-size);
  margin: 0 0 16px 0;
}

.policy-contact p:last-child {
  margin-bottom: 0;
}

/* Responsive Tables - カード形式 */
@media (max-width: 599px) {
  .cookie-table,
  .storage-table,
  .policy-table {
    display: block;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    table-layout: auto;
  }

  .cookie-table thead,
  .storage-table thead,
  .policy-table thead {
    display: none;
  }

  .cookie-table tbody,
  .storage-table tbody,
  .policy-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .cookie-table tr,
  .storage-table tr,
  .policy-table tr {
    display: flex;
    flex-direction: column;
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .cookie-table td,
  .storage-table td,
  .policy-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: var(--md-sys-typescale-body-medium-font-size);
  }

  .cookie-table td:last-child,
  .storage-table td:last-child,
  .policy-table td:last-child {
    border-bottom: none;
  }

  /* data-label属性でヘッダーを表示 */
  .cookie-table td::before,
  .storage-table td::before,
  .policy-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-right: 16px;
    flex-shrink: 0;
    min-width: 80px;
  }

  .cookie-table td strong,
  .storage-table td strong,
  .policy-table td strong {
    color: var(--md-sys-color-primary);
  }
}

/* Print Styles */
@media print {
  .policy-toc {
    display: none;
  }
  
  .policy-wrapper {
    grid-template-columns: 1fr;
  }
  
  .policy-container {
    box-shadow: none;
    padding: 0;
  }
  
  .policy-section {
    page-break-inside: avoid;
  }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .cookie-table,
[data-theme="dark"] .storage-table {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .policy-date {
  background-color: var(--md-sys-color-surface-container);
}

/* ========================================
   Sitemap Page Styles
   ======================================== */
.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  margin-top: 32px;
}

@media (max-width: 768px) {
  .sitemap-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.sitemap-section {
  margin-bottom: 16px;
}

.sitemap-heading {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant, #666);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant, #e0e0e0);
}

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

.sitemap-list > li {
  margin-bottom: 8px;
}

.sitemap-list a {
  color: var(--md-sys-color-on-surface, #1a1a1a);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.6;
  transition: color 0.2s ease;
}

.sitemap-list a:hover {
  color: var(--md-sys-color-primary, #0066cc);
}

.sitemap-sublist {
  list-style: none;
  padding-left: 20px;
  margin-top: 8px;
}

.sitemap-sublist li {
  margin-bottom: 6px;
}

.sitemap-sublist a {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant, #666);
}

.sitemap-sublist a:hover {
  color: var(--md-sys-color-primary, #0066cc);
}

/* Dark mode */
[data-theme="dark"] .sitemap-heading {
  color: var(--md-sys-color-on-surface-variant, #999);
  border-bottom-color: var(--md-sys-color-outline-variant, #333);
}

[data-theme="dark"] .sitemap-list a {
  color: var(--md-sys-color-on-surface, #e0e0e0);
}

[data-theme="dark"] .sitemap-list a:hover {
  color: var(--md-sys-color-primary, #4da6ff);
}

[data-theme="dark"] .sitemap-sublist a {
  color: var(--md-sys-color-on-surface-variant, #999);
}

[data-theme="dark"] .sitemap-sublist a:hover {
  color: var(--md-sys-color-primary, #4da6ff);
}