﻿/* ==========================================================================
   SCORTECH GLOBAL LAYOUT & NAVIGATION SYSTEM (st-layout.css)
   ========================================================================== */

/* --- 1. Root Variables & Box Resets --- */
:root {
    --st-secondary-rgb: 108, 117, 125;
    --vh-px: 800px;
    --header-height: 75px;
    --nav-height: 45px;
    --file-bar-height: 0;
    --workspace-header-height: 0px;
    --source-bar-height: 0px;
    --action-bar-height: 0px;
    --footer-height: 0px;
    --table-scroll-height: 0px;
    --grid-max-height: 0px;
    --table-summary-height: 0px;
    --st-input-height: 1.85rem;
    --st-input-padding-y: 0.15rem;
    --st-input-padding-x: 0.4rem;
    --st-cell-padding-y: 0.25rem;
    --st-cell-padding-x: 0.5rem;
}

/* ==========================================================================
   1. BOX SIZING RESET
   Ensures padding and borders do not expand an element's declared width/height.
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ==========================================================================
   2. MARGIN RESET & DEFAULTS
   Removes default margins on common elements to prevent layout jumps.
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   3. ROOT (HTML)
   ========================================================================== */
html {
    /* Provides smooth scrolling for anchor links (jump-to-section) */
    scroll-behavior: smooth;
    /* Sets a predictable rem base (1rem = 16px by default) while respecting 
     user-configured browser font sizes for accessibility */
    font-size: 100%;
    /* Prevents horizontal layout shifts when scrollbars appear/disappear */
    scrollbar-gutter: stable;
    /* NO height or overflow declarations here */
}

/* ==========================================================================
   4. BODY (PAGE CANVAS)
   ========================================================================== */
body {
    /* Dynamic Viewport Height: Fills the screen on empty/short pages, 
     but expands indefinitely on long scrolling pages (supports sticky!).
     100vh is included as a fallback for older browsers. */
    min-height: 100vh;
    min-height: 100dvh;
    /* Ensures full-width background coverage */
    min-width: 100%;
    /* Readable baseline typography */
    line-height: 1.5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* NO overflow-x: hidden or height: 100% here */
}

/* ==========================================================================
   5. ESSENTIAL MEDIA & FORM RESETS
   ========================================================================== */

/* Prevents images/videos from breaking out of their parent containers */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Inherit typography fonts across form inputs */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Prevents long text/URLs from breaking the page horizontally */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        interpolate-size: allow-keywords;
    }
}

@media (min-width: 992px) {
    .container-lg, .container-md, .container-sm, .container {
        max-width: 80%;
    }
}

/* --- Header & Sticky Navigation Architecture --- */

.site-header-wrapper {
    top: 0;
    width: 100%;
    z-index: 1040; /* Above table sticky headers (usually 10-20) and Bootstrap dropdowns */
    background-color: #e9f5f7;
    isolation: isolate; /* Creates a hard stacking context so table scroll layers CANNOT bleed through */
}
.site-nav-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1050; /* Above table sticky headers (usually 10-20) and Bootstrap dropdowns */
    background-color: #e9f5f7;
    isolation: isolate; /* Creates a hard stacking context so table scroll layers CANNOT bleed through */
}

/* Outer wrapper inside _Header.cshtml */
.site-header {
    display: block;
    width: 100%;
    background-color: #e9f5f7;
}

/* Outer wrapper inside _Navigation.cshtml */
.main-navigation-track {
    display: block;
    width: 100%;
    border-top: 1px solid #cbd5e1;
}

.st-secondary {
    --st-bg-opacity: 1;
    background-color: rgba(var(--st-secondary-rgb), var(--st-bg-opacity)) !important;
}

.navbar {
    position: relative;
    display: flex;
    min-width: 100% !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

/* --- 3. Global Menu Typography & Brand Colors --- */
.dropdown-menu {
    background-color: rgba(108, 117, 125, 1) !important; /* Solid slate gray */
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
}

.dropdown-item {
    background-color: rgba(255, 255, 255, 0.55);
    color: #212529 !important;
    transition: background-color 0.15s ease;
}

    .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.85) !important;
        color: #000 !important;
    }

/* Custom Identity Logout & Button Helpers */
.st-dropdown-item {
    display: block;
    width: 100%;
    clear: both;
    font-weight: 400;
    color: azure !important;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.st-btn {
    margin: 0;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    padding: 0.25rem 1.5rem;
}

/* --- 4. Desktop Navigation & Submenu Flyouts (@min-width: 1200px) --- */
@media all and (min-width: 1200px) {
    .dropdown-menu li {
        position: relative;
    }

    .dropdown-menu .submenu {
        display: none;
        position: absolute;
        left: 100%;
        top: 0;
        margin-top: -1px;
        background-color: rgba(108, 117, 125, 1);
        min-width: 12rem;
    }

    .dropdown-menu .submenu-left {
        right: 100%;
        left: auto;
    }

    /* Un-isolated hover rules: works cleanly across nested submenus */
    .dropdown-menu li:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }

        .dropdown-menu li:hover > .submenu {
            display: block !important;
        }
}

/* --- 5. Mobile & Tablet Navigation Accordions (@max-width: 1199px) --- */
@media (max-width: 1199px) {
    .dropdown-menu {
        max-width: 95% !important;
        float: none !important;
        box-shadow: none !important;
    }

        .dropdown-menu .submenu {
            margin: 0.5rem 1rem !important;
            max-width: 95% !important;
            background-color: rgba(255, 255, 255, 0.15) !important;
            position: relative;
            left: 0 !important;
            top: 0 !important;
            display: none;
        }
}

/* --- 6. Page Shell Containers & Sticky Calculators --- */
#scroll-container,
#main-container {
    display: block;
    position: relative;
    width: 100%;
    overflow: visible; /* Allows table-scroll calculations to freeze paths accurately */
}

#scroll-container {
    max-width: 100%;
    margin-top: 0 !important; /* Prevents unwanted gap above sticky toolbar */
    padding-inline: 2rem;
}
.main-content {
    display: flex;
    flex-direction: row;
    width: 99% !important;
    flex-wrap: wrap;
    justify-content: space-around;
    padding-inline: .5rem;
}

.scroll-stop {
    width: 100%;
    flex-wrap: nowrap;
    z-index: 100;
}

.st-form-group {
    margin: 0.25rem 0.75rem;
}

.st-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex-wrap: nowrap;
}

.div-container {
    width: 100%;
    padding-right: var(--bs-gutter-x, 0.75rem);
    padding-left: var(--bs-gutter-x, 0.75rem);
    margin-right: auto;
    margin-left: auto;
}

/* --- 7. Utility Form Controls & Modal Overlays --- */
.st-form-input {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
}

#confirm {
    position: absolute;
    top: 43%;
    left: 43%;
    width: auto;
    text-wrap: nowrap;
    height: 15%;
    align-items: center;
    text-align: center;
    transform: translate(-50%, -50%);
    background-color: blue;
    padding: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    z-index: 5000;
}

    #confirm .message {
        font-weight: bold;
        color: white;
    }

    #confirm button {
        width: 60%;
    }

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

p {
    text-wrap: pretty;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

#root, #__next {
    isolation: isolate;
}

.w-10 {
    width: 10% !important;
}
