/* Base Styles */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    background-color: #cccccc;
    background-image: url('tech-background-image.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; 
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.35);
    z-index: -1;
    pointer-events: none;
}

/* Navigation Bar Styles */
#navbar {
    width: 300px;
    height: 60vh;
    position: fixed;
    left: 0.5vw;
    top: 20vh;
    overflow-y: auto;
    border-right: 2px solid #4dabf7;
    background: #f8f9fa;
    padding: 20px;
    box-sizing: border-box;
    z-index: 100;
    border-radius: 8px;
}

#navbar header {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 20px;
}

#navbar ul {
    padding: 0;
    list-style: none;
}

#navbar .nav-link {
    display: block;
    padding: 10px 0;
    color: #333;
    text-decoration: none;
    border-bottom: 2px solid #4dabf7;
    border-radius: 40px 30px 40px 30px;
    text-align: center;
}

#navbar .nav-link:hover {
    color: #4dabf7;
}

header {
    text-align: center;
}

/* Main Content Styles */
#main-doc {
    margin-left: 320px; /* navbar width + some gap */
    padding: 20px;
    max-width: 800px;
    flex: 1;
}

/* Rest of your existing CSS remains the same */



/* styling for code snipets */
pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid #4dabf7;
    overflow-x: auto;
}
  
/* Style for code elements within list items */
li > code {
    background-color: #f5f5f5;
    border: 1px solid #e1e1e1;
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-family: monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* Styles for legend texts */
legend {
    text-align: center;
    font-weight: bolder;
    font-size: 1.3rem;
}

/* Styles for feildsets */
fieldset {
    transition: all 0.3s ease;
    background-color: white;
    border: 2px solid #4dabf7;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 20px;
}

fieldset legend {
    border: 2px solid #4dabf7;
    border-radius: 20px; /* Pill shape */
    padding: 0.2em 1em;
    background-color: #c4e3fc;
}

/* Styles for Sub-Headings */
h4 {
    display: inline-block;
    background-image: linear-gradient(to right, #4dabf7, #4dabf7);
    background-position: 0 100%;
    background-size: 100% 2px;
    background-repeat: no-repeat;
    padding-bottom: 5px;
}

/* borders for live demos */
.live-demo {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px dashed #ddd;
}
  
/* syles for border of flex-grid demo */
.container-flex-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #f0f8ff;
    padding: 1rem;
    border-radius: 4px;
}

/* Live demo of flex-grid code */
.justified-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #4dabf7;
    color: white;
    border-radius: 4px;
    min-height: 40px;
}


/* styles for border of flex-container demo */
.container-flex-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
    padding: 1rem;
    background: #fff0f6;
    border-radius: 4px;
}

/* Live demo of flex-container code */
.flex-container-item {
    background: #4dabf7;
    color: white;
    border-radius: 4px;
    text-align: center;
    flex: 1;
    min-height: 30px;
}

/* styles for border of flex-items demo */
.container-flex-items {
    display: flex;
    gap: 10px;
    min-height: 150px; /* Increased for alignment visibility */
    align-items: flex-start; /* Container alignment */
    background: #f6f7de;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    position: relative; /* For alignment demo */
}

/* Live demo of flex-items code */
.demo-flex-item {
    color: white;
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 80px; /* Ensures items maintain visibility */
}

.demo-default {
    flex-grow: 1;
    background: #4dabf7;
    height: 60px; /* Explicit height for alignment contrast */
}

.demo-grow {
    flex-grow: 2;
    align-self: flex-end; /* Will stick to bottom */
    background: #ff922b;
    height: 80px; /* Taller to emphasize alignment */
}

.demo-order {
    order: -1; /* Forces this item first */
    background: #51cf66;
    height: 60px;
}

/* Styles for border of Grid Container demo */
.container-grid-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: 80px auto;
    gap: 15px;
    background: #e6f8e2;
    padding: 1.5rem;
    border-radius: 6px;
}
  
/* Live demo of grid-container code  */
.demo-grid-item {
    background: #74c0fc;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
  
.main-content {
    grid-column: 1 / -1; /* Spans from first to last column line */
}

/* Styles for border of Grid Items demo */
.grid-items-demo .grid-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: 80px auto 100px;
    gap: 15px;
    background: #e8f8fa;
    padding: 1.5rem;
    border-radius: 6px;
    min-height: 300px;
}

/* Live demo of Grid Items */
.grid-items-demo .grid-item {
    background: #74c0fc;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
  
/* Specific Grid-Item Placements */
.grid-items-demo .header {
    grid-column: 1 / -1;
    background: #3bc9db;
}
  
.grid-items-demo .sidebar {
    grid-row: 2 / 4;
    background: #ffa94d;
}
  
.grid-items-demo .featured {
    grid-area: 1 / 2 / 3 / 4;
    background: #ff8787;
}
  
.grid-items-demo .footer {
    grid-column: 1 / -1;
    background: #63e6be;
}

/* References Section */
.reference-list {
    padding-left: 1.5rem;
}
  
.reference-list li {
    margin-bottom: 1rem;
    line-height: 1.8;
}
  
.reference-list a {
    color: #4dabf7;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}
  
.reference-list a:hover {
    color: #228be6;
    border-bottom-style: solid;
}
  
.reference-list strong {
    color: #2b2b2b;
}
  
.live-demo {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1.5rem;
}

footer {
    text-align: center;
    border: 2px solid #4dabf7;
    border-radius: 20px; /* Pill shape */
    padding: 0.2em 1em;
    display: table;
    margin: 0 auto;
    background-color: #c4e3fc;

}

/* Hover Effects */
.flex-container-item:hover, 
.justified-item:hover,
.demo-flex-item:hover,
.demo-grid-item:hover,
.grid-item:hover {
  transform: scale(1.05);
  transition: 0.2s;
}


/* Responsive Media Queries */
@media (max-width: 600px) {
    
.container-flex-items {
    overflow: hidden; /* Contain overflowing items */
    min-height: 200px; /* Adjusted height for mobile */
    padding: 0.8rem; /* Slightly reduce padding */
}
    
.demo-grow {
      height: 50px; /* Reduce tall item height */
      margin-bottom: 0; /* Remove extra space */
      flex-shrink: 1; /* Allow shrinking if needed */
    }
    
    .demo-flex-item {
      min-width: 0; /* Allow items to shrink below 80px */
      padding: 0.8rem; /* Slightly reduce padding */
    }
}


/* Mobile-first responsive navbar */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

@media (max-width: 768px) {
        #navbar {
        position: fixed; 
        top: 0; 
        width: 100%;
        height: auto;
        max-height: 200px;
        overflow-y: auto;
        border-right: none;
        border-bottom: 2px solid #4dabf7; 
        border-radius: 0 0 8px 8px; 
        z-index: 1000; 
    }
    
    #main-doc {
        margin-top: 200px; 
        margin-left: 0;
        padding: 15px;
    }
}

/* Consistent Fieldset Sizing for Mobile */
@media (max-width: 768px) {
    fieldset {
        width: 100%;
        min-width: 0; 
        box-sizing: border-box; 
        margin: 0 auto; 
    }

    /* Remove the <br> spacing between sections */
    .main-section + .main-section {
        margin-top: 20px;
    }
    
    /* Adjust's legend/header sizing for mobile */
    legend header {
        font-size: 1.2em; 
        white-space: normal; 
    }
}

@media (max-width: 768px) {
    fieldset legend {
        font-size: 1em; /* Slightly smaller on mobile */
        padding: 0.2em 0.4em; /* Tighter padding */
        margin-left: 5px; /* Reduced margin */
    }
}
}
