:root {
  --primary: #0a2540;
  --secondary: #00d4ff;
  --accent: #2ecc71;
  --text: #3c4257;
  --bg: #f7f9fc;
  --white: #ffffff;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background: var(--white);
  padding: 20px 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav > ul {
  display: flex;
  list-style: none;
  gap: 30px;
  align-items: stretch; /* stretch so li.has-children fills header height = reliable hover zone */
}

nav > ul > li > a {
  text-decoration: none;
  color: var(--primary);
  font-weight: 500;
  transition: color 0.3s;
}

nav > ul > li > a.active { 
  color: var(--secondary); 
  box-shadow: 0 2px 0 var(--secondary);
}

.btn-cabinet {
  background: var(--primary);
  color: var(--white);
  padding: 8px 20px;
  font-size: 0.9rem;
  border: 1px solid var(--secondary);
}

.btn-cabinet:hover {
  background: var(--secondary);
  color: var(--primary);
}

.hero {
  background: linear-gradient(rgba(10, 37, 64, 0.8), rgba(10, 37, 64, 0.8)), url('../img/hero_energy_banner.png');
  background-size: cover;
  background-position: center;
  color: var(--white);
  padding: 120px 0;
  text-align: center;
}

.hero h1 { font-size: 3.5rem; margin-bottom: 20px; }
.hero p { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.9; }

.btn {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.3s;
}

.btn-primary { background: var(--secondary); color: var(--white); }
.btn-primary:hover { transform: translateY(-3px); }

.services { padding: 80px 0; }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.service-card {
  background: var(--white);
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
  transition: transform 0.3s;
}

.service-card:hover { transform: translateY(-10px); }
.service-card h3 { color: var(--primary); margin-bottom: 15px; }

footer {
  background: var(--primary);
  color: #adbdcc;
  padding: 60px 0;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
}
.logo span {
  color: var(--secondary);
  margin-left: 5px;
}

/* Dropdown Menu Custom CSS */
nav ul li {
  position: relative;
  display: flex;
  align-items: center; /* vertically center <a> text within the stretched li */
}

/* has-children li stretches full height of nav bar => no hover gap possible */
nav > ul > li.has-children {
  align-self: stretch;
}

nav ul li .dropdown-menu {
  display: flex;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  min-width: 260px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 9999;
  flex-direction: column;
  padding: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.05);
  gap: 0;
  list-style: none;
}

nav ul li:hover .dropdown-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Bridge pseudo-element: keeps :hover active while mouse travels
   from the nav item down to the dropdown (covers the 15px gap) */
nav > ul > li.has-children::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -10px;
  right: -10px;
  height: 22px;
  background: transparent;
}

nav ul li .dropdown-menu li {
  width: 100%;
}

nav ul li .dropdown-menu a {
  padding: 12px 24px;
  display: block;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

nav ul li .dropdown-menu li:last-child a {
  border-bottom: none;
}

nav ul li .dropdown-menu a:hover {
  background: var(--bg);
  color: var(--secondary);
  padding-left: 30px;
}

/* ------------------------------ */
/* Inner Page Typography & Tables */
/* ------------------------------ */
main h2, main h3, main h4 {
  color: var(--primary);
  margin-top: 40px;
  margin-bottom: 15px;
}

main p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  color: #4a5568;
  line-height: 1.7;
}

main ul, main ol {
  margin-bottom: 20px;
  padding-left: 20px;
  color: #4a5568;
  font-size: 1.05rem;
  line-height: 1.7;
}

main li {
  margin-bottom: 10px;
}

main a:not(.btn) {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  padding-bottom: 2px;
  border-bottom: 1px dashed var(--secondary);
}

main a:not(.btn):hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Beautiful Tables */
main table {
  width: 100%;
  border-collapse: collapse;
  margin: 30px 0;
  background: var(--white);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
}

main th {
  background: var(--primary);
  color: var(--white);
  padding: 15px 20px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid rgba(0,0,0,0.1);
}

main td {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  color: var(--text);
  vertical-align: top;
}

main tr:last-child td {
  border-bottom: none;
}

main tr:hover td {
  background-color: #fcfcfc;
}

/* ========================================================================= */
/* MOBILE RESPONSIVE STYLES (Max Width: 768px)                               */
/* ========================================================================= */
@media screen and (max-width: 768px) {
  :root {
    font-size: 15px;
  }

  .container {
    padding: 0 15px;
  }

  /* ---- Header layout on mobile (CSS Grid approach) ----
     Logo at left edge | ☰ Меню TRULY CENTERED | Кабінет at right edge
  */
  header {
    padding: 12px 0;
    position: relative;
  }

  .header-inner {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between; /* logo left, actions right */
    position: relative;
  }

  /* Logo stays left */
  .header-inner .logo {
    flex-shrink: 0;
  }

  /* Hamburger TRULY centered via absolute positioning */
  .mobile-menu-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    color: var(--primary);
    z-index: 205;
    gap: 2px;
  }

  .mobile-menu-btn .menu-icon {
    font-size: 1.7rem;
    line-height: 1;
  }

  .mobile-menu-btn .menu-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  /* Actions block (cabinet btn) stays right */
  .header-inner .header-actions {
    flex-shrink: 0;
  }

  /* Cabinet button — compact on mobile */
  .btn-cabinet {
    padding: 7px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
    margin: 0;
    width: auto;
    display: inline-block;
  }

  /* ---- Navigation (hidden by default, drops below header) ---- */
  nav {
    width: 100%;
  }

  nav > ul {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--white);
    position: absolute;
    top: 100%;   /* relative to header */
    left: 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
    padding: 10px 0;
    z-index: 200;
    gap: 0;
    list-style: none;
  }

  nav > ul.nav-open {
    display: flex;
  }

  /* Each li stacks its link + dropdown vertically */
  nav > ul > li {
    width: 100%;
    flex-direction: column;  /* dropdown falls BELOW the link row */
    align-items: stretch;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }

  nav > ul > li:last-child { border-bottom: none; }

  /* Row wrapper — block container, button is absolutely placed inside */
  .mobile-has-children-row {
    position: relative;
    width: 100%;
    display: block; /* NOT flex, so no align-items:stretch on the button */
  }

  /* Regular nav link — same style for ALL items including has-children */
  nav > ul > li > a,
  .mobile-has-children-row > a {
    display: block;
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    text-align: center;    /* same centering as Головна / Про нас */
    box-sizing: border-box;
  }

  /* Arrow button: fixed 36×36px square, does not stretch */
  .mobile-dropdown-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;          /* fixed — no flex-stretch */
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    z-index: 1;
  }

  .mobile-dropdown-arrow:hover,
  li.dropdown-open .mobile-dropdown-arrow {
    background: var(--secondary);
    color: var(--primary);
  }

  /* Dropdown inside mobile nav — appears BELOW the row (flex column) */
  nav ul li .dropdown-menu {
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    box-shadow: none;
    background: rgba(0,0,0,0.03);
    border: none;
    border-radius: 0;
    display: none;
    flex-direction: column;
    padding: 0;
    width: 100%;
  }

  nav ul li.dropdown-open .dropdown-menu {
    display: flex;
  }

  /* Dropdown sub-items: full-row clickable and centered */
  nav ul li .dropdown-menu li {
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }

  nav ul li .dropdown-menu li:last-child { border-bottom: none; }

  nav ul li .dropdown-menu a {
    display: block;
    width: 100%;
    padding: 13px 20px;
    font-size: 0.95rem;
    color: var(--primary);
    text-align: center;
    box-sizing: border-box;
  }

  /* Hero Section */
  .hero {
    padding: 65px 15px;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero p {
    font-size: 1rem;
  }

  /* Services Grid */
  .services {
    padding: 50px 0;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .service-card {
    padding: 25px;
  }

  /* Tables (Horizontal Scroll) */
  main table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
  }
}
