/* ---------------------------------------------------------- */
/* Base styles */
/* ---------------------------------------------------------- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(#272b33, #282828);
    background-attachment: fixed;
    color: #e6e6e6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: margin-left 0.3s ease; /* Smooth transition for body margin */
}

/* Common transitions for elements that shift or animate */
.header-container,
main,
.container {
    transition: margin-left 0.3s ease;
}

body main {
    transition: margin-left 0.3s ease, margin-right 0.3s ease; /* Also shift right */
}

body.menu-open main {
    transition: margin-left 0.3s ease, margin-right 0.3s ease;
}

/* Headings, basic text styles */
h1, h2, h3, h4, h5, h6 {
    color: #abbfab; /* Gold-like color for headers */
    margin-bottom: 10px;
}

p {
    margin-bottom: 15px;
    line-height: 1.6; /* Improved readability */
}

a {
    color: #abbfab; 
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

ul, ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

blockquote {
    border-left: 4px solid #ffd700; /* Gold left border */
    padding-left: 15px;
    color: #b3b3b3;
    margin: 20px 0;
    background-color: #2f2f2f;
}

/* Base code styles */
code {
    background-color: #3b3b3b;
    color: #d1d1d1;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

/* ---------------------------------------------------------- */
/* Consolidated scrollbar styling for .sliding-menu, <pre>, and .terminal */
/* ---------------------------------------------------------- */

/* Firefox scrollbar */
.sliding-menu,
pre,
.terminal {
    scrollbar-width: thin; /* Thinner scrollbar for Firefox */
    scrollbar-color: #555 #333; /* Thumb color #555, track #333 */
}

/* WebKit scrollbar */
.sliding-menu::-webkit-scrollbar,
pre::-webkit-scrollbar,
.terminal::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.sliding-menu::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
.terminal::-webkit-scrollbar-track {
    background: #333;
    border-radius: 5px;
}

.sliding-menu::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
.terminal::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 6px;
    border: 3px solid #333;
}

.sliding-menu::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
.terminal::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}

/* ---------------------------------------------------------- */
/* Header, Menu Button, and Sticky/Shrink behavior */
/* ---------------------------------------------------------- */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #1e1e1e;
    padding: 20px;
    display: flex;
    border-bottom: 1px solid #505050;
    align-items: center;
    z-index: 5000;
    transition: font-size 0.3s ease;
}

.menu-button {
    background-color: #333;
    color: #82a282;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-size: 24px; /* Larger hamburger icon */
    border-radius: 4px;
    margin-right: 10px;
}

.menu-button:hover {
    background-color: #444;
}

/* =====================================
 HEADER SHRINK & MENU TRANSITIONS
 ===================================== */
header {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: #0f0f0f;
  transition: all 0.3s ease;
  padding: 1rem 2rem;
}

/* The header container (inside <header>) */
.header-container {
  display: flex;
  align-items: center;
  /* Whatever else you need here... */
  transition: all 0.3s ease; 
}

.header-container h1 {
  font-size: 2rem;
  transition: all 0.3s ease; 
}

/* When NOT at the very top, we add .shrink */
header.shrink {
  padding: 0.3rem 1rem; 
  /* Add other shrunken styles as needed */
}

/* Shrink the H1 text */
header.shrink .header-container h1 {
  font-size: 1.2rem;
}

/* Make sure the sliding menu shifts up to match the shrunk header */
header.shrink + .sliding-menu {
  top: 92px; /* Adjust if you change the header size */
  transition: all 0.3s ease;
}

/* Ensure the menu list transitions smoothly whether shrinking or growing */
.sliding-menu .menu li {
  /* Normal (expanded) size: */
  padding: 0.5rem;
  font-size: 1em;

  /* This ensures it transitions up or down in size */
  transition: all 0.3s ease;
}

/* When the header is shrunk, shrink the menu text, too */
header.shrink ~ .sliding-menu .menu li {
  padding: 0.3rem;
  font-size: 0.85em;
}

/* ---------------------------------------------------------- */
/* Sliding Menu */
/* ---------------------------------------------------------- */
.sliding-menu {
    position: fixed;
    left: -300px; /* Hidden off-screen initially */
    top: 114px;   /* Align below header */
    height: calc(100% - 60px);
    width: 300px;
    background-color: #1e1e1e;
    border-right: 1px solid #505050;
    z-index: 5001; /* Sits beneath the header */
    padding-top: 0;
    padding-bottom: 30px; /* Room for scrolling */
    overflow-y: auto;
    transition: 
        left 0.3s ease,
        transform 0.3s ease,
        top 0.3s ease;
}

.sliding-menu.show {
    left: 0; /* Slide in */
}

/* Close button */
.close-menu {
    background: none;
    color: #e6e6e6;
    border: none;
    font-size: 24px;
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
}
.close-menu:hover {
    color: #abbfab;
}

/* Menu list */
.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    padding: 10px 20px;
    cursor: pointer;
    color: #e6e6e6;
    border-bottom: 1px solid #333;
    transition: background-color 0.3s ease;
}
.category-item:hover {
    background-color: #333;
}
.category-item.expanded {
    background-color: transparent; /* Remove highlight */
}

/* Submenu */
.tool-list {
    max-height: 0; /* Collapsed */
    overflow: hidden;
    list-style: none;
    padding: 0;
    margin: 5px 0 0 20px; /* Indent subcategories */
    transition: max-height 0.5s ease;
}

.tool-list.show {
    max-height: 1200px; /* Expand enough to show items */
}

.tool-list li {
    background-color: #2e2e2e;
    padding: 8px;
    margin: 2px 0;
    cursor: pointer;
    color: #e6e6e6;
    border-radius: 4px;
}
.tool-list li:hover {
    background-color: #444;
}

/* ---------------------------------------------------------- */
/* Main Content & Container */
/* ---------------------------------------------------------- */
main, .container {
    max-width: 800px;
    margin: 20px auto; 
}

body.menu-open main {
    margin-left: calc(50vw - 400px + 150px);  /* Center content when menu is open */
    margin-right: calc(50vw - 400px - 150px);
}

body main {
    margin: 20px calc(50vw - 400px); /* Center content normally */
}

/* Container styling */
.container {
    margin: 150px auto;
    padding: 20px;
    background-color: #1e1e1e;
    border: 1px solid #505050;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------- */
/* Code Blocks & Copy Button */
/* ---------------------------------------------------------- */
pre {
    background-color: #3b3b3b;
    color: #e6e6e6;
    padding: 15px;
    border-radius: 0;
    overflow-x: auto;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    max-width: 100%;
    font-size: 0.9em;
}

pre code {
    font-size: inherit;
    font-weight: inherit;
}

/* Code container */
.code-container {
    margin: 20px auto;
    border: 1px solid #555;
    border-radius: 5px;
    overflow: hidden;
    padding-bottom: 0;
    max-width: 90%;
    box-sizing: border-box;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Code header (top bar) */
.code-header {
    background-color: #333;
    color: #e6e6e6;
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

/* Copy button */
.copy-btn {
    background-color: #555;
    color: #e6e6e6;
    border: none;
    padding: 5px 10px;
    font-size: 0.9em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.copy-btn:hover {
    background-color: #777;
}

/* Highlighted code blocks via Pygments */
.highlight pre {
    background-color: #3b3b3b !important;
    color: #e6e6e6 !important;
}

/* ---------------------------------------------------------- */
/* Table Styles */
/* ---------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #2f2f2f;
    color: #e6e6e6;
    border: 1px solid #666; 
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

th, td {
    border: 1px solid #666;
    padding: 10px;
    text-align: left;
    font-size: 0.95em;
}

th {
    background-color: #3c3c3c;
    color: #abbfab;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #383838;
}
tr:nth-child(odd) {
    background-color: #2f2f2f;
}
tr:hover {
    background-color: #444;
}

/* ---------------------------------------------------------- */
/* Terminal & Title Page */
/* ---------------------------------------------------------- */
.title-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(#272b33, #282828);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 1s ease; /* Smooth fade-out */
}

.terminal {
    background-color: #1e1e1e;
    color: #e6e6e6;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #505050;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    width: 80%;
    max-width: 800px;
    height: 400px; /* Fixed height */
    font-family: 'Courier New', Courier, monospace;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column; 
}

.terminal-output {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    max-height: 100%;
}

.line {
    width: 100%;
    background-color: transparent;
    padding: 0;
    margin: 0;
    line-height: 1.5;
    font-size: 0.95em;
    overflow: hidden;
}

/* Code header inside the terminal (if needed) */
.code-header {
    background-color: #333;
    color: #abbfab; 
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

#user-ip {
    flex-grow: 1;
    font-weight: normal;
    color: #abbfab;
}

.window-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}
.button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.minimize {
    background-color: #f4c542; /* Yellow */
}
.maximize {
    background-color: #50c878; /* Green */
}
.close {
    background-color: #e74c3c; /* Red */
}

/* ---------------------------------------------------------- */
/* Slide in/out keyframes */
/* ---------------------------------------------------------- */
@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-150%);
        opacity: 0;
    }
}
@keyframes slideInRight {
    from {
        transform: translateX(150%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
.slide-out {
    animation: slideOutLeft 0.2s forwards;
}
.slide-in {
    animation: slideInRight 0.2s forwards;
}

/* ---------------------------------------------------------- */
/* Media Queries */
/* ---------------------------------------------------------- */
@media (max-width: 768px) {
    .sliding-menu {
        width: 80%; 
    }
    body.menu-open main {
        margin-left: 80%;
    }
}


/* ---------------------------------------------------------- */
/* Mobile‑first overrides */
/* ---------------------------------------------------------- */
@media (max-width: 768px) {

  /* Lock background when the menu is open */
  body.menu-open {
      overflow: hidden;               /* stop background scroll      */
      touch-action: none;             /* prevent iOS “rubber band”   */
  }

  /* ------------------------------------------------------ */
  /* Header                                                 */
  /* ------------------------------------------------------ */
  header {
      padding: 0.6rem 1rem;
  }
  header.shrink {
      padding: 0.3rem 0.8rem;
  }
  header .header-container h1 {
      font-size: 1.4rem;
  }

  /* ------------------------------------------------------ */
  /* Full‑screen sliding menu                               */
  /* ------------------------------------------------------ */
  .sliding-menu {
      top: 1;                         /* cover entire viewport       */
      left: -100vw;                   /* keep off‑canvas by default  */
      width: 100vw;
      height: 100vh;
      border-right: none;             /* edge‑to‑edge look           */
      transition: left 0.3s ease;
  }
  .sliding-menu.show {
      left: 0;                        /* slide fully into view       */
  }

  /* Bigger tappable targets */
  .menu-button {
      padding: 12px 18px;
      font-size: 28px;
  }
  .category-item {
      padding: 14px 24px;
      font-size: 1.05rem;
  }
  .tool-list li {
      padding: 12px 18px;
      margin: 4px 0;
  }

  /* ------------------------------------------------------ */
  /* Main content & cards                                   */
  /* ------------------------------------------------------ */
  main, .container {
      max-width: 95%;                 /* nearly full‑width           */
      margin: 90px auto 20px;         /* push below fixed header     */
  }

    body main,
        body.menu-open main {          /* keep same look when menu open */
            margin: 90px auto 20px;    /* top   sides   bottom */
            max-width: 95%;            /* almost full‑width    */
            transition: none;          /* no sideways shift    */
        }

  /* Code blocks and tables scale down a hair */
  pre, table {
      font-size: 0.85em;
  }
}
