/* ======================================================================
   OL Emaren — Complete Custom Stylesheet (Joomla 6.2.2)
   ====================================================================== */

/* 1. Prevent horizontal overflow without shifting layout flow */
html,
body {
  overflow-x: clip;
  max-width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* 2. Center all main template wrappers */
.mx-base,
.main-bg,
#mx-wrapper {
  width: 100% !important;
  max-width: 1140px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
  float: none !important;
  box-sizing: border-box !important;
}

/* 3. Reset Bootstrap negative row margins and column offsets */
.mx-base .row,
.main-bg > .row {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* 4. Desktop side-by-side columns without overflowing .mx-base */
@media (min-width: 992px) {
  .main-bg > .row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    gap: 20px;
  }

  .main-bg > .row > #mx-maincol {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: auto !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    float: none !important;
    box-sizing: border-box !important;
  }

  .main-bg > .row > #mx-rightcol {
    flex: 0 0 280px !important;
    max-width: 280px !important;
    width: 280px !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    float: none !important;
    box-sizing: border-box !important;
  }
}

/* 5. Constrain right sidebar modules and HTML5 audio player */
#mx-rightcol,
#mx-rightcol .module,
#mx-rightcol .moduletable,
#mx-rightcol .j6-audio-player {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

#mx-rightcol .j6-audio-player audio {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 36px;
}

/* 6. Force equal side-by-side columns in .mx-bottom regardless of legacy CSS */
.mx-bottom-grid {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .mx-bottom-grid {
    grid-template-columns: repeat(var(--bottom-cols, 3), minmax(0, 1fr)) !important;
  }
}

.mx-bottom-col,
.mx-bottom-col > .module,
.mx-bottom-col > .moduletable {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
  box-sizing: border-box !important;
}

/* 7. Header Bar: Keep Logo Visible, Menu Close & White Font */
#mx-topout {
  background-color: #222222;
  padding: 10px 0;
  width: 100%;
}

#mx-topout > .mx-base {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0px !important;
}

#mx-topout #logo {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 0 0 auto !important;
  width: auto !important;
  height: auto !important;
  max-width: 260px !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
}

#mx-topout #logo a,
#mx-topout a#logo {
  display: inline-flex !important;
  align-items: center !important;
  visibility: visible !important;
  width: auto !important;
  height: auto !important;
  text-indent: 0 !important;
  font-size: 22px !important;
  color: #ffffff !important;
  background: none !important;
  overflow: visible !important;
}

#mx-topout #logo img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-height: 65px !important;
  width: auto !important;
  height: auto !important;
}

#mx-topout nav#header,
#mx-topout #header {
  flex: 0 1 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#mx-topout #header ul.mod-menu,
#mx-topout #header ul.nav,
#mx-topout #header ul.menu {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#mx-topout #header ul.mod-menu > li,
#mx-topout #header ul.nav > li,
#mx-topout #header ul.menu > li {
  float: none !important;
  display: inline-flex !important;
  width: auto !important;
  margin: 0 !important;
}

#mx-topout #header ul.mod-menu > li > a,
#mx-topout #header ul.mod-menu > li > button,
#mx-topout #header ul.nav > li > a,
#mx-topout #header ul.menu > li > a {
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 8px 14px !important;
  font-size: 15px;
  font-weight: 500;
  border-radius: 4px;
  background: transparent;
  border: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#mx-topout #header ul.mod-menu > li > a:hover,
#mx-topout #header ul.mod-menu > li.active > a,
#mx-topout #header ul.mod-menu > li.current > a,
#mx-topout #header ul.nav > li > a:hover,
#mx-topout #header ul.nav > li.active > a,
#mx-topout #header ul.menu > li > a:hover,
#mx-topout #header ul.menu > li.active > a {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.18) !important;
}

@media (max-width: 767.98px) {
  #mx-topout > .mx-base {
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
}

/* 8. Top Bar: Align Date & Top Menu Close Together inside #mx-top-header */
#mx-top-header {
  display: flex !important;
  align-items: center !important;
  min-height: 40px;
  padding: 4px 0;
}

#mx-top-header > .mx-base {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 15px !important;
}

#mx-top-header .mx-date,
#mx-top-header .mx_date {
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap;
  color: #fafafa;
  font-size: 14px;
  line-height: 1.4;
}

#mx-top-header .mx-top-menu {
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
}

#mx-top-header .mx-bookmarks {
  margin-left: auto !important;
}

#mx-top-header .mx-top-menu ul.mod-menu,
#mx-top-header .mx-top-menu ul.nav,
#mx-top-header .mx-top-menu ul.menu {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 12px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#mx-top-header .mx-top-menu ul li {
  float: none !important;
  display: inline-flex !important;
  margin: 0 !important;
  padding: 0 !important;
}

#mx-top-header .mx-top-menu ul li a {
  color: #fafafa !important;
  text-decoration: none;
  font-size: 13px;
  padding: 2px 6px;
}

#mx-top-header .mx-top-menu ul li a:hover {
  text-decoration: underline;
}

@media (max-width: 767.98px) {
  #mx-top-header > .mx-base {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px;
  }

  #mx-top-header .mx-bookmarks {
    margin-left: 0 !important;
  }
}

/* ======================================================================
   9. Restore OL Emaren Joomla 3 Colored Module Wrappers (Joomla 6.2)
   ====================================================================== */

/* Base container frame matching Joomla 3 .module look */
.main-bg .moduletable,
.main-bg .module,
#mx-rightcol .moduletable,
#mx-rightcol .module,
.mx-bottom .moduletable,
.mx-bottom .module {
  color: #333333;
  background-color: #ffffff;
  padding: 12px;
  margin-bottom: 15px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  box-sizing: border-box;
}

/* Color Variations (Add class name in Module > Advanced > Module Class without leading space) */
.moduletable.white,
.module.white {
  color: #333333 !important;
  background-color: #ffffff !important;
}
.moduletable.white:hover,
.module.white:hover {
  background-color: #f9f9f9 !important;
}

.moduletable.beige,
.module.beige {
  color: #000000 !important;
  background-color: #f9f4ed !important;
  border: 1px solid #eadcc8;
}

.moduletable.greys,
.module.greys {
  color: #333333 !important;
  background-color: #f9f9f9 !important;
  border: 1px solid #e5e5e5;
}
.moduletable.greys:hover,
.module.greys:hover {
  background-color: #f1f1f1 !important;
}

.moduletable.reds,
.module.reds {
  color: #222222 !important;
  background-color: #ffeeee !important;
  border: 1px solid #f5c6cb;
}

.moduletable.blues,
.module.blues {
  color: #222222 !important;
  background-color: #eef6ff !important;
  border: 1px solid #b8daff;
}

.moduletable.greens,
.module.greens {
  color: #222222 !important;
  background-color: #f1f6e2 !important;
  border: 1px solid #c3e6cb;
}

.moduletable.oranges,
.module.oranges {
  color: #222222 !important;
  background-color: #fff6ee !important;
  border: 1px solid #ffeeba;
}

.moduletable.colors,
.module.colors {
  color: #f1f1f1 !important;
  background-color: #444444 !important;
}

.moduletable.dark,
.module.dark {
  color: #dddddd !important;
  background-color: #333333 !important;
}

.moduletable.dark a,
.module.dark a,
.moduletable.colors a,
.module.colors a {
  color: #ffffff !important;
}

/* Colored Header Bars matching Joomla 3 OL Emaren Title Ribbons */
.moduletable > h3,
.module > h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin: -12px -12px 12px -12px;
  padding: 8px 12px;
  border-radius: 3px 3px 0 0;
  background-color: #444444;
  color: #ffffff;
}

.moduletable.white > h3,
.module.white > h3,
.moduletable.beige > h3,
.module.beige > h3,
.moduletable.greys > h3,
.module.greys > h3 {
  background-color: #e9e9e9;
  color: #333333;
  border-bottom: 1px solid #d5d5d5;
}

.moduletable.reds > h3,
.module.reds > h3 {
  background-color: #c9302c;
  color: #ffffff;
}

.moduletable.blues > h3,
.module.blues > h3 {
  background-color: #2b7bb9;
  color: #ffffff;
}

.moduletable.greens > h3,
.module.greens > h3 {
  background-color: #5c940d;
  color: #ffffff;
}

.moduletable.oranges > h3,
.module.oranges > h3 {
  background-color: #e67e22;
  color: #ffffff;
}

.moduletable.colors > h3,
.module.colors > h3,
.moduletable.dark > h3,
.module.dark > h3 {
  background-color: #1f1f1f;
  color: #ffffff;
}

/* ======================================================================
   11. OL Emaren 3D Wrap-Around Container Ribbon (Matches Any Nesting Depth)
   ====================================================================== */

.main-bg .moduletable,
.main-bg .module,
#mx-rightcol .moduletable,
#mx-rightcol .module,
.mx-bottom .moduletable,
.mx-bottom .module,
.mx-mainbottom .moduletable,
.mx-mainbottom .module {
  position: relative;
  overflow: visible !important;
}

/* Base 3D Ribbon Bar (Default Charcoal Ribbon) */
.moduletable h3:first-of-type,
.module h3:first-of-type {
  position: relative;
  margin: 0 -20px 14px -20px !important;
  padding: 8px 20px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  color: #ffffff !important;
  background: linear-gradient(to bottom, #555555, #333333) !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  border-radius: 2px 2px 0 0;
  border: 0 !important;
}

/* Left & Right Folded Ribbon Triangles */
.moduletable h3:first-of-type::before,
.module h3:first-of-type::before,
.moduletable h3:first-of-type::after,
.module h3:first-of-type::after {
  content: "";
  position: absolute;
  bottom: -8px;
  width: 0;
  height: 0;
  border-style: solid;
}

.moduletable h3:first-of-type::before,
.module h3:first-of-type::before {
  left: 0;
  border-width: 0 8px 8px 0;
  border-color: transparent #1a1a1a transparent transparent;
}

.moduletable h3:first-of-type::after,
.module h3:first-of-type::after {
  right: 0;
  border-width: 8px 8px 0 0;
  border-color: #1a1a1a transparent transparent transparent;
}

/* --- White / Beige Ribbon --- */
.moduletable:is(.white, .beige) h3:first-of-type,
.module:is(.white, .beige) h3:first-of-type,
.moduletable:has(.white, .beige) h3:first-of-type,
.module:has(.white, .beige) h3:first-of-type {
  background: linear-gradient(to bottom, #f5efe6, #e2d4be) !important;
  color: #333333 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.moduletable:is(.white, .beige) h3:first-of-type::before,
.module:is(.white, .beige) h3:first-of-type::before,
.moduletable:has(.white, .beige) h3:first-of-type::before,
.module:has(.white, .beige) h3:first-of-type::before {
  border-color: transparent #b5a48b transparent transparent;
}
.moduletable:is(.white, .beige) h3:first-of-type::after,
.module:is(.white, .beige) h3:first-of-type::after,
.moduletable:has(.white, .beige) h3:first-of-type::after,
.module:has(.white, .beige) h3:first-of-type::after {
  border-color: #b5a48b transparent transparent transparent;
}

/* --- Greys Ribbon --- */
.moduletable.greys h3:first-of-type,
.module.greys h3:first-of-type,
.moduletable:has(.greys) h3:first-of-type,
.module:has(.greys) h3:first-of-type {
  background: linear-gradient(to bottom, #dcdcdc, #bdbdbd) !important;
  color: #222222 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.moduletable.greys h3:first-of-type::before,
.module.greys h3:first-of-type::before,
.moduletable:has(.greys) h3:first-of-type::before,
.module:has(.greys) h3:first-of-type::before {
  border-color: transparent #8c8c8c transparent transparent;
}
.moduletable.greys h3:first-of-type::after,
.module.greys h3:first-of-type::after,
.moduletable:has(.greys) h3:first-of-type::after,
.module:has(.greys) h3:first-of-type::after {
  border-color: #8c8c8c transparent transparent transparent;
}

/* --- Blues Ribbon --- */
.moduletable.blues h3:first-of-type,
.module.blues h3:first-of-type,
.moduletable:has(.blues) h3:first-of-type,
.module:has(.blues) h3:first-of-type {
  background: linear-gradient(to bottom, #3b93d6, #24689c) !important;
  color: #ffffff !important;
}
.moduletable.blues h3:first-of-type::before,
.module.blues h3:first-of-type::before,
.moduletable:has(.blues) h3:first-of-type::before,
.module:has(.blues) h3:first-of-type::before {
  border-color: transparent #164263 transparent transparent;
}
.moduletable.blues h3:first-of-type::after,
.module.blues h3:first-of-type::after,
.moduletable:has(.blues) h3:first-of-type::after,
.module:has(.blues) h3:first-of-type::after {
  border-color: #164263 transparent transparent transparent;
}

/* --- Greens Ribbon --- */
.moduletable.greens h3:first-of-type,
.module.greens h3:first-of-type,
.moduletable:has(.greens) h3:first-of-type,
.module:has(.greens) h3:first-of-type {
  background: linear-gradient(to bottom, #76b817, #51800c) !important;
  color: #ffffff !important;
}
.moduletable.greens h3:first-of-type::before,
.module.greens h3:first-of-type::before,
.moduletable:has(.greens) h3:first-of-type::before,
.module:has(.greens) h3:first-of-type::before {
  border-color: transparent #335206 transparent transparent;
}
.moduletable.greens h3:first-of-type::after,
.module.greens h3:first-of-type::after,
.moduletable:has(.greens) h3:first-of-type::after,
.module:has(.greens) h3:first-of-type::after {
  border-color: #335206 transparent transparent transparent;
}

/* --- Oranges Ribbon --- */
.moduletable.oranges h3:first-of-type,
.module.oranges h3:first-of-type,
.moduletable:has(.oranges) h3:first-of-type,
.module:has(.oranges) h3:first-of-type {
  background: linear-gradient(to bottom, #f59331, #d36b0d) !important;
  color: #ffffff !important;
}
.moduletable.oranges h3:first-of-type::before,
.module.oranges h3:first-of-type::before,
.moduletable:has(.oranges) h3:first-of-type::before,
.module:has(.oranges) h3:first-of-type::before {
  border-color: transparent #8f4706 transparent transparent;
}
.moduletable.oranges h3:first-of-type::after,
.module.oranges h3:first-of-type::after,
.moduletable:has(.oranges) h3:first-of-type::after,
.module:has(.oranges) h3:first-of-type::after {
  border-color: #8f4706 transparent transparent transparent;
}

/* --- Reds Ribbon --- */
.moduletable.reds h3:first-of-type,
.module.reds h3:first-of-type,
.moduletable:has(.reds) h3:first-of-type,
.module:has(.reds) h3:first-of-type {
  background: linear-gradient(to bottom, #e04844, #b52521) !important;
  color: #ffffff !important;
}
.moduletable.reds h3:first-of-type::before,
.module.reds h3:first-of-type::before,
.moduletable:has(.reds) h3:first-of-type::before,
.module:has(.reds) h3:first-of-type::before {
  border-color: transparent #731512 transparent transparent;
}
.moduletable.reds h3:first-of-type::after,
.module.reds h3:first-of-type::after,
.moduletable:has(.reds) h3:first-of-type::after,
.module:has(.reds) h3:first-of-type::after {
  border-color: #731512 transparent transparent transparent;
}

/* --- Dark / Colors Ribbon --- */
.moduletable:is(.dark, .colors) h3:first-of-type,
.module:is(.dark, .colors) h3:first-of-type,
.moduletable:has(.dark, .colors) h3:first-of-type,
.module:has(.dark, .colors) h3:first-of-type {
  background: linear-gradient(to bottom, #3a3a3a, #1a1a1a) !important;
  color: #ffffff !important;
}
.moduletable:is(.dark, .colors) h3:first-of-type::before,
.module:is(.dark, .colors) h3:first-of-type::before,
.moduletable:has(.dark, .colors) h3:first-of-type::before,
.module:has(.dark, .colors) h3:first-of-type::before {
  border-color: transparent #000000 transparent transparent;
}
.moduletable:is(.dark, .colors) h3:first-of-type::after,
.module:is(.dark, .colors) h3:first-of-type::after,
.moduletable:has(.dark, .colors) h3:first-of-type::after,
.module:has(.dark, .colors) h3:first-of-type::after {
  border-color: #000000 transparent transparent transparent;
}

/* ======================================================================
   12. Equal Width & Height Containers in top1 (and top1–top6)
   ====================================================================== */

/* Make columns across top1–top6 equal width & height */
.mx-userpos {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: stretch !important;
  gap: 20px;
}

/* Make multiple modules inside top1 sit side-by-side with equal width & height */
.mx-userpos > .col {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  gap: 20px;
}

@media (min-width: 768px) {
  .mx-userpos > .col {
    flex-direction: row !important;
    align-items: stretch !important;
  }
}

/* Force every module box inside top1 to share equal width and full height */
.mx-userpos > .col > .moduletable,
.mx-userpos > .col > .module {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  box-sizing: border-box !important;
}

/* Prevent horizontal scrolling */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Force images, sliders, and videos to fit mobile screens */
img, video, iframe, .camera_wrap, .nivoSlider {
  max-width: 100% !important;
  height: auto !important;
}

/* Stack legacy Bootstrap 2/3 columns on phones */
@media (max-width: 767px) {
  [class*="span"], .col-xs-12, .col-sm-6, .col-md-4, .col-md-3 {
    width: 100% !important;
    float: none !important;
    margin-left: 0 !important;
    display: block !important;
  }
}
