/* Online Tools Site - Shared Common Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --site-bg: #f4f6fb;
  --site-surface: #ffffff;
  --site-surface-alt: #f9faff;
  --site-border: #e1e4ec;
  --site-text: #1a1d29;
  --site-muted: #5f6675;
  --site-link: #3b5bfa;
  --site-link-hover: #324ee6;
  --site-success: #10b981;
  --site-radius: 12px;
  --site-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Theme Variables */
[data-theme="dark"] {
  --site-bg: #0b0f19;
  --site-surface: #131b2e;
  --site-surface-alt: #1a243d;
  --site-border: #233152;
  --site-text: #f1f5f9;
  --site-muted: #94a3b8;
  --site-link: #60a5fa;
  --site-link-hover: #93c5fd;
  --site-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Prevent horizontal scrollbars without breaking sticky positioning */
html, body {
  overflow-x: clip;
}

/* Base Body Font Normalization */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--site-bg);
  color: var(--site-text);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Accessible Focus States */
:focus-visible {
  outline: 2px solid var(--site-link, #3b5bfa);
  outline-offset: 2px;
}

/* Site Global Navigation Header (Sticky on Mobile & Desktop) */
header.site-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--site-border, #e1e4ec);
  padding: 10px 20px;
  z-index: 999;
  box-sizing: border-box;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] header.site-header {
  background: rgba(19, 27, 46, 0.95);
  border-color: var(--site-border);
}

.site-header .header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
}

.site-header .site-brand {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
}

.site-header .site-brand a {
  color: var(--site-text, #1a1d29);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.site-header .site-brand a:hover {
  color: var(--site-link, #3b5bfa);
}

.site-header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quick Search Button in Header */
.header-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--site-surface-alt, #f9faff);
  border: 1px solid var(--site-border, #e1e4ec);
  color: var(--site-muted, #5f6675);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  outline: none;
}

.header-search-btn:hover {
  border-color: var(--site-link, #3b5bfa);
  color: var(--site-link, #3b5bfa);
  background: #ffffff;
}

[data-theme="dark"] .header-search-btn:hover {
  background: var(--site-surface);
}

.search-shortcut {
  background: var(--site-surface, #ffffff);
  border: 1px solid var(--site-border, #e1e4ec);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--site-muted, #5f6675);
  font-family: inherit;
}

/* Theme Toggle Button */
.header-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--site-border, #e1e4ec);
  background: var(--site-surface, #ffffff);
  color: var(--site-text, #1a1d29);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  padding: 0;
}

.header-theme-toggle:hover {
  border-color: var(--site-link, #3b5bfa);
  color: var(--site-link, #3b5bfa);
  transform: rotate(15deg);
}

.site-header .header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-header .header-nav a {
  color: var(--site-muted, #5f6675);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--site-border, #e1e4ec);
  background: var(--site-surface, #ffffff);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.site-header .header-nav a:hover,
.site-header .header-nav a.active {
  color: var(--site-link, #3b5bfa);
  background: var(--site-surface-alt, #f9faff);
  border-color: rgba(76, 111, 255, 0.4);
}

/* Modal Search Palette */
.site-search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 16px 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.site-search-modal.active {
  opacity: 1;
  visibility: visible;
}

.search-modal-card {
  background: var(--site-surface, #ffffff);
  border: 1px solid var(--site-border, #e1e4ec);
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 80vh;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlide 0.2s ease;
}

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

.search-modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--site-border, #e1e4ec);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-modal-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--site-text, #1a1d29);
  font-size: 16px;
  outline: none;
  font-family: inherit;
}

.search-modal-close {
  background: transparent;
  border: none;
  color: var(--site-muted, #5f6675);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.search-modal-close:hover {
  color: var(--site-text, #1a1d29);
  background: var(--site-surface-alt, #f9faff);
}

.search-modal-results {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--site-text, #1a1d29);
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
}

.search-modal-item:hover,
.search-modal-item.selected {
  background: var(--site-surface-alt, #f9faff);
  color: var(--site-link, #3b5bfa);
}

[data-theme="dark"] .search-modal-item:hover,
[data-theme="dark"] .search-modal-item.selected {
  background: var(--site-surface-alt);
}

.search-item-cat {
  font-size: 11px;
  font-weight: 600;
  color: var(--site-muted, #5f6675);
  background: var(--site-surface, #ffffff);
  border: 1px solid var(--site-border, #e1e4ec);
  padding: 2px 8px;
  border-radius: 999px;
}

.search-modal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--site-border, #e1e4ec);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--site-muted, #5f6675);
  background: var(--site-surface-alt, #f9faff);
}

/* Breadcrumbs Navigation */
.tool-breadcrumbs {
  max-width: 1100px;
  margin: 14px auto 0 auto;
  padding: 0 16px;
  font-size: 13px;
  color: var(--site-muted, #5f6675);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  box-sizing: border-box;
}

.tool-breadcrumbs a {
  color: var(--site-muted, #5f6675);
  text-decoration: none;
  transition: color 0.15s ease;
}

.tool-breadcrumbs a:hover {
  color: var(--site-link, #3b5bfa);
  text-decoration: underline;
}

.tool-breadcrumbs .sep {
  color: var(--site-border, #cbd5e1);
  user-select: none;
}

.tool-breadcrumbs .current {
  color: var(--site-text, #1a1d29);
  font-weight: 600;
}

/* Related Tools Section */
.related-tools-section {
  max-width: 1100px;
  margin: 40px auto 10px auto;
  padding: 0 16px;
  box-sizing: border-box;
  width: 100%;
}

.related-tools-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--site-text, #1a1d29);
  display: flex;
  align-items: center;
  gap: 8px;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.related-tool-card {
  background: var(--site-surface, #ffffff);
  border: 1px solid var(--site-border, #e1e4ec);
  border-radius: var(--site-radius, 12px);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--site-text, #1a1d29);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.related-tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--site-link, #3b5bfa);
  box-shadow: 0 8px 20px rgba(59, 91, 250, 0.1);
}

.related-tool-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--site-link, #3b5bfa);
  margin-bottom: 6px;
  line-height: 1.3;
}

.related-tool-card:hover .related-tool-name {
  color: var(--site-link-hover, #324ee6);
  text-decoration: underline;
}

.related-tool-meta {
  font-size: 12px;
  color: var(--site-muted, #5f6675);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Site Global Footer */
footer.site-footer {
  background: var(--site-surface, #ffffff);
  border-top: 1px solid var(--site-border, #e1e4ec);
  padding: 32px 20px 28px;
  text-align: center;
  font-size: 14px;
  color: var(--site-muted, #5f6675);
  margin-top: 48px;
  box-sizing: border-box;
  width: 100%;
}

.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}

.site-footer .footer-links a {
  color: var(--site-muted, #5f6675);
  padding: 6px 12px;
  border: 1px solid var(--site-border, #e1e4ec);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.2s ease;
  background: var(--site-surface, #ffffff);
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.site-footer .footer-links a:hover {
  background: var(--site-surface-alt, #f9faff);
  color: var(--site-link, #3b5bfa);
  border-color: rgba(76, 111, 255, 0.4);
}

.site-footer .footer-copy {
  margin: 0;
  font-size: 13px;
  color: var(--site-muted, #8a92a6);
  line-height: 1.6;
}

/* Interactive Feedback: Copied Button State */
button.copied,
.btn.copied,
.btn-copy.copied,
.btn-copied {
  background-color: var(--site-success, #10b981) !important;
  border-color: var(--site-success, #10b981) !important;
  color: #ffffff !important;
  transition: all 0.2s ease;
}

/* Responsive Tables & Horizontal Scrolling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
}

.detailed-article table,
.guide table,
table.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

@media (max-width: 768px) {
  .detailed-article table,
  .guide table,
  table.data-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile Screen Breakpoints */
@media (max-width: 640px) {
  header.site-header {
    padding: 10px 14px;
  }
  .site-header .site-brand {
    font-size: 17px;
  }
  .search-btn-text,
  .search-shortcut {
    display: none;
  }
  .header-search-btn {
    padding: 7px 10px;
  }
  .site-header .header-nav a {
    padding: 4px 9px;
    font-size: 12px;
  }
  .related-tools-grid {
    grid-template-columns: 1fr;
  }
  footer.site-footer {
    padding: 24px 14px 20px;
    margin-top: 32px;
  }
  .site-footer .footer-links {
    gap: 6px;
  }
  .site-footer .footer-links a {
    padding: 5px 10px;
    font-size: 12px;
  }
  
  /* Sizing safety on mobile */
  .tool-container,
  .card,
  .detailed-article,
  .guide {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  input, select, textarea, button, .btn {
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Text Wrapping & Overflow Containment */
p, li, td, th, h1, h2, h3, h4,
.detailed-article,
.guide,
.tool-container {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Dark theme overrides for tool cards & containers */
[data-theme="dark"] .tool-container,
[data-theme="dark"] .card,
[data-theme="dark"] .detailed-article,
[data-theme="dark"] .guide,
[data-theme="dark"] .sample,
[data-theme="dark"] .case-card,
[data-theme="dark"] .case-input-wrapper {
  background: var(--site-surface) !important;
  border-color: var(--site-border) !important;
  color: var(--site-text) !important;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #0d1424 !important;
  border-color: var(--site-border) !important;
  color: #ffffff !important;
}

[data-theme="dark"] th {
  background-color: var(--site-surface-alt) !important;
  color: var(--site-link) !important;
}


/* Privacy Trust Badge in Footer */
.footer-privacy-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--site-surface-alt, #f9faff);
  border: 1px solid var(--site-border, #e1e4ec);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--site-muted, #5f6675);
  margin: 14px auto 8px auto;
  max-width: 90%;
  line-height: 1.4;
}

[data-theme="dark"] .footer-privacy-badge {
  background: var(--site-surface-alt);
  border-color: var(--site-border);
  color: var(--site-muted);
}

/* Print Optimization */
@media print {
  header.site-header,
  footer.site-footer,
  .related-tools-section,
  .tool-breadcrumbs,
  .actions,
  .input-action-btn,
  #site-toast,
  .site-search-modal {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .tool-container, .card, .detailed-article {
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}
