/* ================================================================== */
/* 1. Basic Page & Header Styles                                      */
/* ================================================================== */
body {
    font-family: Arial, sans-serif;
    background-color: #e9eef2; /* Light grey page background */
}

/* A basic header for context */
.header-nav {
    background-color: #333;
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.header-nav .nav-item {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.header-nav .nav-item:hover {
    background-color: #555;
    cursor: pointer;
}


/* ================================================================== */
/* 2. Mega Menu Styles (WHITE THEME WITH BLACK FONTS)                 */
/* ================================================================== */
:root {
  --primary-color: #6a0dad; /* Purple */
  --accent-color: #ffd700;  /* Gold */
  --accent-dark: #daa520;   /* Darker gold */
  
  /* White theme variables */
  --menu-bg: #ffffff;
  --button-bg: #f8f9fa;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --font-color: #000000; /* FONT IS BLACK */
}

/* White 3D Mega Menu Window */
.mega-menu-window {
  display: none;
  position: fixed;
  z-index: 12000;
  background: var(--menu-bg); /* WHITE BACKGROUND */
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow-color);
  color: var(--font-color); /* BLACK FONT */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  overflow: auto;
  will-change: top, left, width, height, opacity, transform;
  box-sizing: border-box;
}

.mega-menu-window.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.mega-menu-window.__clamp {
  transition: none !important;
}

.mega-header {
  cursor: move;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.mega-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: bold;
  color: var(--font-color) !important; /* FONT IS BLACK */
}

.mega-close {
  background: #f1f1f1;
  color: #555;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  line-height: 24px;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.mega-close:hover {
  background: #e7e7e7;
  color: #000;
}

.mega-content {
  padding: 10px 20px 20px 20px;
}

/* ================================================================== */
/* 3. WORKING 3D Button Styles & Pop-Out Animation                  */
/* ================================================================== */

.mega-item a,
.mega-accordion-trigger,
.mega-accordion-link {
  display: block;
  position: relative;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 14px 20px;
  margin: 12px 0;
  font-family: inherit;
  font-size: 1em;
  font-weight: 600;
  color: var(--font-color) !important; /* FONT IS BLACK */

  /* 3D Button Appearance on White BG */
  background: var(--button-bg);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  border-bottom-width: 3px;
  box-shadow: 0 2px 4px var(--shadow-color);
  
  /* CRITICAL: Smooth animation for the pop effect */
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

/* THE WORKING "POP OUT" HOVER ANIMATION */
.mega-item a:hover,
.mega-accordion-trigger:hover,
.mega-accordion-link:hover {
  /* This lifts the button up */
  transform: translateY(-6px);
  
  /* This enhances the shadow for a clear "floating" effect */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}


/* ================================================================== */
/* 4. Accordion (Children Menu) with INCREASED SPACING              */
/* ================================================================== */
.mega-accordion-trigger {
  cursor: pointer;
}

.mega-accordion-trigger i {
  float: right;
  transition: transform 0.3s ease;
}

/* Container for child links */
.mega-accordion-panel {
  margin: 5px 0 10px 0;
  padding: 0; /* No padding when closed */
  max-height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #f0f0f0; /* Slightly off-white to stand out */
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
  transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
}

/* THIS CREATES THE SPACING BETWEEN CHILD BUTTONS */
.mega-accordion-panel > .mega-accordion-link {
    margin: 12px 15px; /* Increased vertical margin for spacing */
}

.mega-accordion-trigger.active + .mega-accordion-panel {
  max-height: 500px;
  padding: 10px 5px; /* Adds space at the top and bottom of the group */
}

.mega-accordion-trigger.active i {
  transform: rotate(180deg);
}


/* ================================================================== */
/* 5. Layout, Drag/Resize & Helpers (Unchanged)                       */
/* ================================================================== */
.resize-handle { position: absolute; width: 12px; height: 12px; z-index: 12001; }
.resize-nw { top: -6px; left: -6px; cursor: nwse-resize; } .resize-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.resize-sw { bottom: -6px; left: -6px; cursor: nesw-resize; } .resize-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.resize-n  { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-s  { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-w  { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }
.resize-e  { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }
.drag-handle { cursor: move; }

#reset-layout-button {
  position: fixed; bottom: 20px; right: 20px; z-index: 12002;
  background-color: var(--accent-color);
  color: var(--primary-color);
  font-family: 'Poppins', sans-serif; font-weight: 600; border: none;
  padding: 10px 20px; border-radius: 5px; cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2); transition: background-color 0.3s;
}

#reset-layout-button:hover {
  background-color: var(--accent-dark);
}

/* ================================================================== */
/* 6. Responsive Mobile Styles (Unchanged)                            */
/* ================================================================== */
@media (max-width: 991px) {
  #reset-layout-button { display: none; }
}
@media (max-width: 768px) {
  .mega-menu-window {
    width: 95vw !important;
    left: 2.5vw !important;
    top: 80px !important;
    transform: none !important;
    max-height: calc(100vh - 100px);
  }
  .resize-handle { display: none; }
}