/* ==========================================================================
   MEPCO Premium UI - Base Design System
   ========================================================================== */

:root {
  /* Color System */
  --primary: #0F766E;
  --primary-hover: #115E59;
  --primary-light: #CCFBF1;
  --secondary: #14B8A6;
  --accent: #06B6D4;
  --success: #16A34A;
  --warning: #F59E0B;
  --error: #DC2626;
  --bg-white: #FFFFFF;
  --bg-section: #F8FAFC;
  --text-dark: #1E293B;
  --text-gray: #475569;
  --text-light: #94A3B8;
  --border-color: #E2E8F0;
  
  /* Shadows (Soft, SaaS-style) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(2rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); margin-top: 2rem; }
h3 { font-size: clamp(1.125rem, 2vw, 1.35rem); margin-top: 1.5rem; }
p { color: var(--text-gray); margin-bottom: 1.5rem; font-size: 1.125rem; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-hover); text-decoration: underline; }
strong { color: var(--text-dark); font-weight: 600; }

/* ==========================================================================
   Layout Utilities
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.section-bg {
  background-color: var(--bg-section);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  padding: 1rem 0;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo:hover { text-decoration: none; }

/* Navigation & Dropdowns */
.main-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-dark);
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  transition: color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 0;
  line-height: normal; /* uniform line-height */
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link.highlight {
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.6rem 1.25rem;
  border-radius: 9999px; /* Modern pill shape */
}

.nav-link.highlight:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-btn {
  background: none;
  border: none;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.6rem 0;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  line-height: normal; /* uniform line-height */
}

.dropdown-btn:hover {
  color: var(--primary);
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: white;
  min-width: 240px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  z-index: 101;
  top: 100%;
  left: 0;
  padding: 0.5rem 0;
  margin-top: 0; /* No margin to prevent losing hover state */
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-fast);
}

/* Custom scrollbar for dropdown */
.dropdown-content::-webkit-scrollbar {
  width: 6px;
}
.dropdown-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.dropdown-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

@media (min-width: 1025px) {
  .dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-content a {
  color: var(--text-dark);
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  display: block;
  font-size: 0.95rem;
}

.dropdown-content a:hover {
  background-color: var(--bg-light);
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: block;
  }
  .main-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-top: 1px solid var(--border-color);
  }
  .main-nav.active {
    display: flex;
  }
  .dropdown-content {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    margin-top: 0.5rem;
    padding-left: 1rem;
    background: transparent;
    opacity: 1;
    transform: none;
  }
  .dropdown.active .dropdown-content {
    display: block;
  }
  .dropdown {
    width: 100%;
  }
  .dropdown-btn {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0;
  }
  .nav-link {
    padding: 0.5rem 0;
    width: 100%;
  }
}
/* ==========================================================================
   Hero & Bill Checker Component
   ========================================================================== */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at top, var(--primary-light) 0%, transparent 70%);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.hero p {
  max-width: 600px;
  margin: 0 auto 2rem;
  font-size: 1.25rem;
}

.bill-checker-card {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-white);
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
  text-align: left;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.125rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
  font-family: monospace;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none !important;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.helper-text {
  display: block;
  font-size: 0.875rem;
  color: var(--text-gray);
  margin-top: 0.5rem;
}

/* Trust Indicators */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-gray);
  background: var(--bg-section);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
}
.badge svg { width: 18px; height: 18px; color: var(--primary); }

/* ==========================================================================
   Content Blocks (Tables, Cards)
   ========================================================================== */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.card {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card h3 { margin-top: 0; }

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-section);
  font-weight: 600;
  color: var(--text-dark);
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) { background-color: #FAFAFA; }

/* Callouts / Highlights */
.callout {
  background-color: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 2rem 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout ul li {
  margin-bottom: 0.5rem;
}

.content-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  display: block;
}

/* ==========================================================================
   FAQ Accordion
   ========================================================================== */
.faq-list {
  margin: 3rem 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.5rem 0;
  background: none;
  border: none;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform var(--transition-fast);
}

.faq-question[aria-expanded="true"]::after {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.faq-answer-inner {
  padding-bottom: 1.5rem;
  color: var(--text-gray);
}

/* ==========================================================================
   Footer & Author Box
   ========================================================================== */
.author-box {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--bg-section);
  border-radius: var(--radius-lg);
  margin: 4rem 0;
  border: 1px solid var(--border-color);
}
.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: bold;
  font-size: 1.5rem;
}

.footer {
  background-color: #0f172a; /* Modern dark navy */
  color: white;
  padding: 5rem 0 2rem;
  margin-top: 5rem;
  font-size: 0.95rem;
}

.footer .container {
  max-width: 1280px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2.5rem;
  }
}

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

.footer-brand p {
  color: var(--text-light);
  line-height: 1.6;
  margin-top: 1rem;
  max-width: 400px;
}

.footer-col h4 {
  color: white;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.footer-links-vert {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer a { 
  color: var(--text-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer a:hover { 
  color: var(--primary-light); 
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 2rem;
}

.footer-bottom p {
  color: var(--text-light);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.footer strong {
  color: white;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================================================
   Layout: Sidebar / Main
   ========================================================================== */
.page-layout {
  display: flex;
  gap: 4rem;
  align-items: flex-start;
}
.main-content {
  flex: 1;
  min-width: 0;
}
.sidebar {
  width: 300px;
  position: sticky;
  top: 100px;
  display: none;
}
@media (min-width: 1024px) {
  .sidebar { display: block; }
}

.toc {
  background: var(--bg-section);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.toc ul { list-style: none; padding-left: 0; }
.toc li { margin-bottom: 0.75rem; }
.toc a { color: var(--text-gray); font-size: 0.95rem; }
.toc a:hover, .toc a.active { color: var(--primary); font-weight: 600; }
.toc-title { font-weight: 700; margin-bottom: 1rem; color: var(--text-dark); }

/* Loader state for form */
.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.is-loading .btn-text { display: none; }
.is-loading .btn-loader { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Floating Back To Top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary);
  color: white;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  border: none;
  z-index: 99;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
}

/* Form Validation */
.form-error-msg {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
}
.form-input.error {
  border-color: var(--error);
}
.form-input.error:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

/* ==========================================================================
   Inner Pages (Markdown generated)
   ========================================================================== */
.inner-page-hero {
  padding: 3.5rem 1rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at top, var(--primary-light) 0%, transparent 70%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.inner-page-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-dark);
  line-height: 1.25;
}

.inner-page-hero p {
  font-size: 1.1rem;
  color: var(--text-gray);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
}

.inner-page-section {
  padding-top: 2rem;
}

.content-card {
  background: var(--bg-white);
  padding: 2.5rem 3rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
  z-index: 10;
  margin-bottom: 4rem;
}

/* Centered & Responsive Images */
.content-card img, .content-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.content-card p:has(img) {
  text-align: center;
}

/* Typography inside the markdown content card */
.content-card h2 {
  font-size: 1.65rem;
  margin-top: 2.25rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.4rem;
  display: inline-block;
}

.content-card h3 {
  font-size: 1.25rem;
  margin-top: 1.75rem;
  margin-bottom: 0.85rem;
  color: var(--text-dark);
}

.content-card p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-gray);
  margin-bottom: 1.25rem;
}

.content-card ul, .content-card ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: var(--text-gray);
  line-height: 1.7;
}

.content-card li {
  margin-bottom: 0.5rem;
}

.content-card a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.content-card a:hover {
  text-decoration: underline;
}

.content-card table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.content-card th, .content-card td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.content-card th {
  background-color: var(--bg-light);
  font-weight: 700;
  color: var(--text-dark);
}

.content-card tr:last-child td {
  border-bottom: none;
}

.content-card strong {
  color: var(--text-dark);
}

.content-card blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin-left: 0;
  font-style: italic;
  color: var(--text-gray);
  background: var(--bg-light);
  padding: 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

@media (max-width: 768px) {
  .content-card {
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
  }
  .inner-page-hero {
    padding: 2.5rem 1rem 1.5rem;
  }
  .inner-page-hero h1 {
    font-size: 1.75rem;
  }
  .inner-page-hero p {
    font-size: 1rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .section {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  h2 {
    font-size: 1.6rem !important;
    margin-top: 1.5rem !important;
    line-height: 1.3 !important;
  }
  h3 {
    font-size: 1.3rem !important;
    margin-top: 1.25rem !important;
  }
  .faq-question {
    font-size: 1rem;
    padding: 1rem 0;
  }
  .content-card img, .content-image {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin: 1.25rem auto !important;
    border-radius: var(--radius-md);
    box-sizing: border-box;
    display: block;
  }
}

