/* ==========================================================================
   Mongolian Lunar Calendar Converter (Монгол цаглабар хөрвүүлэгч)
   Design System & Styling - ScanAIPro Tool Page
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties & Variables
   -------------------------------------------------------------------------- */
:root {
  --color-bg-main: #0D1730;
  --color-bg-secondary: #131F3A;
  --color-bg-card: rgba(19, 31, 58, 0.75);
  --color-bg-card-hover: rgba(27, 42, 74, 0.85);
  --color-border: rgba(212, 162, 78, 0.25);
  --color-border-focus: #D4A24E;
  
  --color-gold: #D4A24E;
  --color-gold-bright: #F3C77C;
  --color-gold-glow: rgba(212, 162, 78, 0.2);
  --color-cyan: #38BDF8;
  --color-red: #EF4444;
  --color-green: #10B981;
  
  --color-text-main: #F8FAFC;
  --color-text-muted: #94A3B8;
  --color-text-dim: #64748B;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Inter', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(212, 162, 78, 0.18);
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg-main);
  color: var(--color-text-main);
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Skip link for keyboard accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--color-gold);
  color: #0D1730;
  padding: 12px 20px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  z-index: 9999;
  transition: top var(--transition-fast);
  text-decoration: none;
}
.skip-link:focus {
  top: 16px;
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-gold-bright);
}

/* Focus visibility for accessibility */
*:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   3. Navigation & Header
   -------------------------------------------------------------------------- */
.site-header {
  background: rgba(13, 23, 48, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.brand-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}
.brand-name span {
  color: var(--color-gold);
}

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}
.nav-link {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-link:hover {
  color: var(--color-text-main);
}

/* --------------------------------------------------------------------------
   4. Breadcrumb & Hero
   -------------------------------------------------------------------------- */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
  flex: 1;
}

.breadcrumb-nav {
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: var(--color-text-dim);
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  align-items: center;
}
.breadcrumb-item::after {
  content: "/";
  margin-left: 8px;
  color: var(--color-text-dim);
  opacity: 0.6;
}
.breadcrumb-item:last-child::after {
  display: none;
}
.breadcrumb-item a {
  color: var(--color-text-muted);
}
.breadcrumb-item.active {
  color: var(--color-gold);
}

.hero-section {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
}

.hero-banner-svg {
  width: 100%;
  max-width: 780px;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: #FFFFFF;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFFFFF 40%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 680px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   5. Interactive Converter Tool Card
   -------------------------------------------------------------------------- */
.converter-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  margin-bottom: 40px;
  position: relative;
}

.timezone-notice {
  text-align: right;
  font-size: 0.85rem;
  color: var(--color-gold);
  margin-bottom: 16px;
  font-weight: 600;
}

/* Mode Switcher Toggle */
.mode-switch-container {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}
.mode-switch-group {
  display: inline-flex;
  background: rgba(13, 23, 48, 0.8);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mode-btn.active {
  background: var(--color-gold);
  color: #0D1730;
  box-shadow: 0 4px 12px rgba(212, 162, 78, 0.3);
}

/* Input Panels */
.form-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}
.form-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-control, .form-select {
  background: rgba(13, 23, 48, 0.9);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  padding: 12px 16px;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(212, 162, 78, 0.2);
}

/* Custom Checkbox Toggle for Leap Month */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(13, 23, 48, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-gold);
  cursor: pointer;
}
.checkbox-label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  align-items: center;
}
.quick-label {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}
.btn-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-chip:hover {
  background: rgba(212, 162, 78, 0.15);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

/* Action Button */
.btn-action-container {
  display: flex;
  justify-content: center;
}
.btn-convert {
  background: linear-gradient(135deg, #D4A24E 0%, #B88330 100%);
  color: #0D1730;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 48px;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(212, 162, 78, 0.3);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-convert:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 162, 78, 0.45);
  background: linear-gradient(135deg, #F3C77C 0%, #D4A24E 100%);
}
.btn-convert:active {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   6. Result Card & Loading Skeleton
   -------------------------------------------------------------------------- */
.result-container {
  margin-top: 32px;
}

/* Loading Skeleton */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: rgba(13, 23, 48, 0.6);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
}
.skeleton-bar {
  height: 24px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-bar.w-50 { width: 50%; }
.skeleton-bar.w-75 { width: 75%; }
.skeleton-bar.w-100 { width: 100%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Actual Result Display */
.result-card {
  background: linear-gradient(145deg, rgba(27, 42, 74, 0.9) 0%, rgba(19, 31, 58, 0.95) 100%);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.4s ease-out;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(212, 162, 78, 0.2);
}
.result-title-tag {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  font-weight: 700;
}
.result-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.result-main-date {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 8px;
}
.result-year-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-gold-bright);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-item {
  background: rgba(13, 23, 48, 0.6);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.detail-label {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.tsagaan-sar-alert {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7DD3FC;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover {
  background: rgba(212, 162, 78, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.result-disclaimer {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  margin-top: 18px;
  line-height: 1.4;
}

/* Error Card State */
.error-card {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
}
.error-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Toast Alert Popup */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-gold);
  color: #0D1730;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   7. How To Section (3 Steps)
   -------------------------------------------------------------------------- */
.how-to-section {
  margin-bottom: 50px;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 24px;
  text-align: center;
}
.section-title span {
  color: var(--color-gold);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.step-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  transition: transform var(--transition-fast);
}
.step-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-gold);
}
.step-number {
  width: 40px;
  height: 40px;
  background: var(--color-gold);
  color: #0D1730;
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 8px;
}
.step-desc {
  font-size: 0.92rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   8. SEO Article Section
   -------------------------------------------------------------------------- */
.article-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 50px;
}

.article-content h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
  margin: 32px 0 16px;
  padding-left: 14px;
  border-left: 4px solid var(--color-gold);
}
.article-content h2:first-child {
  margin-top: 0;
}

.article-content p {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: 18px;
  line-height: 1.7;
}

.article-content ul, .article-content ol {
  margin: 0 0 20px 24px;
  color: var(--color-text-muted);
}
.article-content li {
  margin-bottom: 8px;
}

/* Animal x Element Grid Table */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
}
.element-animal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: rgba(13, 23, 48, 0.8);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.element-animal-table th, .element-animal-table td {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  text-align: left;
}
.element-animal-table th {
  background: rgba(212, 162, 78, 0.15);
  color: var(--color-gold);
  font-weight: 700;
}
.element-animal-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* --------------------------------------------------------------------------
   9. FAQ Accordion Block
   -------------------------------------------------------------------------- */
.faq-section {
  margin-bottom: 50px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}
.faq-item.active {
  border-color: var(--color-gold);
}

.faq-question-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 20px 24px;
  text-align: left;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-toggle-icon {
  font-size: 1.4rem;
  color: var(--color-gold);
  transition: transform var(--transition-fast);
}
.faq-item.active .faq-toggle-icon {
  transform: rotate(45deg);
}

.faq-answer-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 24px;
  color: var(--color-text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}
.faq-item.active .faq-answer-panel {
  max-height: 300px;
  padding: 0 24px 20px;
}

/* --------------------------------------------------------------------------
   10. Related Tools Section
   -------------------------------------------------------------------------- */
.related-tools-section {
  margin-bottom: 50px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.tool-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.tool-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}
.tool-name {
  color: #FFFFFF;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.tool-desc {
  color: var(--color-text-dim);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   11. Footer (Strict 7 Required Links)
   -------------------------------------------------------------------------- */
.site-footer {
  background: #080E1E;
  border-top: 1px solid var(--color-border);
  padding: 40px 20px;
  margin-top: auto;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 28px;
  list-style: none;
}

.footer-link {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.footer-link:hover {
  color: var(--color-gold);
}

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

/* --------------------------------------------------------------------------
   12. Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.8rem;
  }
  .converter-card {
    padding: 20px;
  }
  .mode-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
  }
  .result-main-date {
    font-size: 1.7rem;
  }
  .article-section {
    padding: 24px;
  }
  .timezone-notice {
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   13. Print Support (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .site-header, .breadcrumb-nav, .hero-section, .mode-switch-container,
  .form-panel, .quick-dates, .btn-action-container, .how-to-section,
  .article-section, .faq-section, .related-tools-section, .site-footer,
  .btn-secondary, .toast-notification, .timezone-notice {
    display: none !important;
  }
  .page-wrapper {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .converter-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .result-card {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 20px !important;
  }
  .result-main-date, .result-year-name, .detail-value {
    color: #000000 !important;
  }
  .detail-item {
    background: #F3F4F6 !important;
    border: 1px solid #D1D5DB !important;
  }
}

/* --------------------------------------------------------------------------
   14. Accessibility Preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn-convert, .mode-btn.active {
    border: 2px solid CanvasText;
  }
}
