/**
 * MIBT Blazor Application Styles
 * =============================
 * A comprehensive stylesheet for the MIBT Blazor WASM application that defines
 * the visual styling for the entire UI. The stylesheet is organized into logical
 * sections using #region for better navigation and maintenance.
 * 
 * Color Palette:
 * - Primary Blue: #0072ce
 * - Light Blue: #b3d9ff
 * - Background: #FAFAFA
 * - Success Green: #90EE90, #C1FFC1
 * - Error Red: #ffe6e6
 * - Warning/Modified: #E0F5FF
 * 
 * Last updated: June 20, 2025
 */

/* #region Base Elements - Core styling for base HTML elements */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background-color: #FAFAFA !important;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    overflow: hidden;
}

input[type="text"],
input[type="list"] {
    text-transform: uppercase;
}

hr {
    color: black;
    margin: 0;
}
/* #endregion */

/* #region Utility Classes - Reusable utility classes */
.hidden {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

.visible {
    display: block !important;
}

.disabled {
    filter: invert(100%) grayscale(100%) brightness(50%);
    pointer-events: none;
}

.enabled {
    color: black;
    pointer-events: all;
    cursor: pointer;
}

.close {
    cursor: pointer !important;
    color: red !important;
    background-color: transparent !important;
    border: 0;
}

.bubble {
    display: inline-block;
    margin-right: 5px;
    background-color: lightskyblue;
    color: black;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
}
/* #endregion */

/* #region Progress Spinner - Styling for the application's progress indicator */
.progress-container-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 1500;
}

#progress-container-modal {
    position: fixed !important;
    z-index: 1510;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 8px;
    border: 1px solid white;
    background-color: white;
    text-align: center;
}

#progress-container-header {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: ghostwhite;
    font-size: 18pt;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    overflow: hidden;
    padding: 10px;
    color: #333;
    cursor: pointer;
}

.progress-container-draggable-header {
    background-color: ghostwhite;
    border-bottom: 1px solid #ddd;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

    .progress-container-draggable-header:hover {
        background: linear-gradient(135deg, #e8e8e8 0%, #ddd 100%);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .progress-container-draggable-header:active {
        background: linear-gradient(135deg, #ddd 0%, #ccc 100%);
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }

    .progress-container-draggable-header:hover .material-symbols-outlined {
        opacity: 1;
    }

#progress-container-table {
    width: 100%;
    margin: 10px 0;
}

    #progress-container-table th {
        font-weight: bold;
        text-align: right;
        padding: 5px;
        background-color: white;
        border-bottom: 1px solid #ddd;
    }

    #progress-container-table td {
        text-align: right;
        padding: 5px;
        border-bottom: 1px solid #eee;
    }

#progress-container-button-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background-color: #f9f9f9;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top: 1px solid #ddd;
}

/* Dialog buttons */
#progress-container-toggle {
    padding: 8px 16px;
    background-color: #0072ce;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

    #progress-container-toggle:hover {
        background-color: #005a9e;
    }

    #progress-container-toggle:focus {
        outline: 2px solid #0072ce;
        outline-offset: 2px;
    }

/* Empty rule - can be removed */
#progess-contaner-toggle {
}
/* #endregion */

/* #region Main Layout - Core layout structure for the application */
.main-page {
    height: calc(100vh - 5px) !important;
    width: calc(100vw - 5px) !important;
    border-radius: 15px;
    background-color: #FAFAFA;
}

.main-body {
    width: 100% !important;
    height: calc(100vh - 100px) !important;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.main-header {
    background-color: #0072ce !important;
    font-size: 15pt !important;
    font-weight: bold !important;
    width: 100% !important;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.loading-header {
    background-color: #0072ce !important;
    font-size: 15pt !important;
    font-weight: bold !important;
    width: 100% !important;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    padding: 0px;
    margin: 0px;
    height: 47px;
}

.main-image {
    width: 170px;
    padding: 0px;
    margin: 0px;
    height: 35px;
    white-space: nowrap;
}

.loading-image {
    height: 45px !important;
    width: 170px;
}

.main-name {
    text-align: left;
    vertical-align: bottom;
    color: white;
    width: 100px;
    line-height: 1;
    font-size: 12pt;
    border-left: 2px solid white;
    white-space: nowrap;
}

.main-version {
    color: white;
    font-size: 7pt;
}

.main-nav {
    font-size: 14pt;
    display: flex;
    justify-content: center; /* Centers content horizontally */
}
/* #endregion */

/* #region Main Menu - Top navigation menu styling */
.main-menu {
    text-align: center !important;
    vertical-align: middle !important;
    width: auto;
    color: white;
    white-space: nowrap;
}

.main-menu-table {
    margin: 0 auto; /* Center the table horizontally */
}

.main-menu-choice {
    padding: 5px 10px;
    display: inline-block;
}

.main-menu button {
    background-color: #0072ce !important;
    cursor: pointer !important;
    color: white !important;
    border: 0;
    font-weight: bold;
    display: inline-block;
    margin: 5px;
}

    .main-menu button:hover {
        cursor: pointer !important;
        background-color: lightgray !important;
        border-radius: 5px !important;
        color: white !important;
        display: inline-block;
    }

    .main-menu button:focus {
        cursor: pointer !important;
    }

    .main-menu button.selected {
        background-color: #0072ce !important;
        border-bottom: 3px solid white !important;
        border-radius: 0 !important;
        color: white !important;
    }

.main-icons {
    width: 270px;
    white-space: nowrap;
}

    .main-icons a {
        color: white;
    }
/* #endregion */

/* #region Sheets Navigation - Tab-like navigation for content sheets */
.main-sheets {
    display: flex;
    width: 100% !important;
    height: 40px;
    white-space: nowrap !important;
    background-color: #b3d9ff !important;
    color: #333333 !important;
    font-size: 13pt !important;
    font-weight: bold !important;
    justify-content: center;
    vertical-align: bottom;
}

.main-sheets-progress {
    display: flex;
    width: 100%;
    height: 32px;
    white-space: nowrap !important;
    background-color: #b3d9ff !important;
    color: #333333 !important;
    font-size: 13pt !important;
    font-weight: bold !important;
    justify-content: left;
    vertical-align: bottom;
}

.main-sheets-progress-button {
    border-radius: 15px;
    background-color: #32CD32;
    border: 1px solid lightgrey;
    color: white;
    height: 30px;
    width: 30px;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .main-sheets-progress-button:focus {
        outline: none;
        box-shadow: 0 0 0 3px #ffffff, 0 0 0 1px #000000 inset; /* white outer border, black inner border */
    }

.main-sheets-table {
    width: 100% !important;
    max-width: calc(100vw - 10px) !important;
}

    /* Duplicate rule - keeping the first one and removing this
.main-sheets-table {
    width: 100% !important;
    calc(100vw - 10px)
}
*/

    .main-sheets-table td:last-child {
        width: 40px !important;
    }

.main-sheets-table-sheets {
    vertical-align: bottom;
    width: 100% !important;
    text-align: center;
    padding: 0px;
    margin: 0px;
}

.main-sheets-table-sheets-div {
    width: 100%;
    overflow: hidden;
    padding-bottom: 5px;
}

.main-sheets-table-scroll {
    width: 40px;
}

.main-sheets .check-mark {
    color: darkgreen;
    font-size: 12pt;
    visibility: hidden;
    vertical-align: bottom;
}

.main-sheets .check-mark-checked {
    color: darkgreen;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets .check-mark-checked-issues {
    color: red;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets .check-mark-checked-warnings {
    color: #808000;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets .sheet {
    white-space: nowrap !important;
    padding: 0 !important;
    font-weight: bold !important;
    cursor: pointer !important;
    border-radius: 5px;
}

.main-sheets .sheet-selected {
    white-space: nowrap !important;
    padding: 0 !important;
    font-weight: bold !important;
    border-bottom: 6px solid white !important;
}

.main-sheets .sheet:hover {
    white-space: nowrap !important;
    background-color: white !important;
    padding: 0 !important;
    font-weight: bold !important;
    cursor: pointer !important;
}

.main-sheets .sheet-spacer {
    display: flex;
    white-space: nowrap;
    padding-left: 2px;
    padding-right: 2px;
}

.main-sheets-drop .check-mark {
    color: darkgreen;
    font-size: 12pt;
    visibility: hidden;
    vertical-align: bottom;
}

.main-sheets-drop .check-mark-checked {
    color: darkgreen;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets-drop .check-mark-checked-issues {
    color: red;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets-drop .check-mark-checked-warnings {
    color: #808000;
    font-size: 12pt;
    vertical-align: bottom;
}

.main-sheets-drop .sheet {
    white-space: nowrap !important;
    padding: 0 !important;
    font-weight: bold !important;
    cursor: pointer !important;
    border-radius: 5px;
}

.main-sheets-drop .sheet-selected {
    white-space: nowrap !important;
    padding: 0 !important;
    font-weight: bold !important;
    border-bottom: 6px solid white !important;
}

.main-sheets-drop .sheet:hover {
    white-space: nowrap !important;
    background-color: white !important;
    padding: 0 !important;
    font-weight: bold !important;
    cursor: pointer !important;
}

/* #endregion */

/* #region Page Structure - Content page layout components */
.page-body {
    max-width: 100vw !important;
}

.page-content {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}
/* #endregion */

.under-construction {
}

    .under-construction div:nth-of-type(2) {
        display: flex;
        flex-direction: column; /* Stack items vertically */
        justify-content: center; /* Center vertically */
        align-items: center; /* Center horizontally */
    }

        .under-construction div:nth-of-type(2) img {
            width: 40%;
        }

.icon-container {
    white-space: nowrap;
}

.icon {
    font-size: 24px;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border-radius: 3px;
}

    .icon:hover {
        background-color: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }

/* Icon color definitions optimized for blue toolbar background (#0072ce) */

.save {
    color: #FFFFFF; /* white for save icon - good contrast */
    background-color: rgba(255, 255, 255, 0.1); /* subtle white background */
}

    .save:hover {
        color: #4CAF50; /* green on hover */
        background-color: rgba(76, 175, 80, 0.2); /* light green background on hover */
    }

.save-as {
    color: #FFD700; /* gold color for better contrast than previous yellow */
    background-color: rgba(255, 215, 0, 0.15); /* subtle gold background */
}

    .save-as:hover {
        color: #FFC107; /* amber on hover */
        background-color: rgba(255, 193, 7, 0.25); /* amber background on hover */
    }

.open {
    color: #FF9800; /* orange for folder open - good contrast */
    background-color: rgba(255, 152, 0, 0.15); /* subtle orange background */
}

    .open:hover {
        color: #F57C00; /* darker orange on hover */
        background-color: rgba(255, 152, 0, 0.25); /* more prominent orange background */
    }

.excel {
    color: #4CAF50; /* green for Excel theme */
    background-color: rgba(76, 175, 80, 0.15); /* subtle green background */
}

    .excel:hover {
        color: #388E3C; /* darker green on hover */
        background-color: rgba(76, 175, 80, 0.25); /* more prominent green background */
    }

.update-page {
    color: #E3F2FD; /* very light blue - improved from previous */
    background-color: rgba(227, 242, 253, 0.15); /* subtle light blue background */
}

    .update-page:hover {
        color: #BBDEFB; /* medium light blue on hover */
        background-color: rgba(187, 222, 251, 0.25); /* more prominent blue background */
    }

.update-all {
    color: #90CAF9; /* medium blue for better contrast */
    background-color: rgba(144, 202, 249, 0.15); /* subtle blue background */
}

    .update-all:hover {
        color: #64B5F6; /* darker blue on hover */
        background-color: rgba(144, 202, 249, 0.25); /* more prominent blue background */
    }

.update-email {
    color: #FFE082; /* light amber for email theme */
    background-color: rgba(255, 224, 130, 0.15); /* subtle amber background */
}

    .update-email:hover {
        color: #FFCC02; /* darker amber on hover */
        background-color: rgba(255, 204, 2, 0.25); /* more prominent amber background */
    }

.update-silent {
    color: #BDBDBD; /* medium gray for better contrast than light gray */
    background-color: rgba(189, 189, 189, 0.15); /* subtle gray background */
}

    .update-silent:hover {
        color: #9E9E9E; /* darker gray on hover */
        background-color: rgba(158, 158, 158, 0.25); /* more prominent gray background */
    }

.clear {
    color: #F44336; /* material red for clear action */
    background-color: rgba(244, 67, 54, 0.15); /* subtle red background */
}

    .clear:hover {
        color: #D32F2F; /* darker red on hover */
        background-color: rgba(244, 67, 54, 0.25); /* more prominent red background */
    }

.refresh-db {
    color: #E1BEE7; /* lavender - works well with blue background */
    background-color: rgba(225, 190, 231, 0.15); /* subtle lavender background */
}

    .refresh-db:hover {
        color: #CE93D8; /* darker lavender on hover */
        background-color: rgba(206, 147, 216, 0.25); /* more prominent lavender background */
    }

.enter-products {
    color: #FF9800; /* orange for product entry actions */
    background-color: rgba(255, 152, 0, 0.15); /* subtle orange background */
}

    .enter-products:hover {
        color: #F57C00; /* darker orange on hover */
        background-color: rgba(255, 152, 0, 0.25); /* more prominent orange background */
    }

.preview {
    color: #FFE082;
    background-color: rgba(255, 224, 130, 0.15);
}

    .preview:hover {
        color: #FFCC02;
        background-color: rgba(255, 204, 2, 0.25);
    }

.generate {
    color: #FFE082;
    background-color: rgba(255, 224, 130, 0.15);
}

    .generate:hover {
        color: #FFCC02;
        background-color: rgba(255, 204, 2, 0.25);
    }

/* #region Undo/Redo Icons - Styling for undo/redo functionality in main toolbar */
.undo {
    color: #FFB74D; /* light orange for undo action */
    background-color: rgba(255, 183, 77, 0.15); /* subtle orange background */
}

    .undo:hover {
        color: #FF9800; /* medium orange on hover */
        background-color: rgba(255, 152, 0, 0.25); /* more prominent orange background */
    }

    .undo.disabled {
        filter: invert(100%) grayscale(100%) brightness(50%);
        pointer-events: none;
        opacity: 0.5;
    }

.redo {
    color: #81C784; /* light green for redo action */
    background-color: rgba(129, 199, 132, 0.15); /* subtle green background */
}

    .redo:hover {
        color: #4CAF50; /* medium green on hover */
        background-color: rgba(76, 175, 80, 0.25); /* more prominent green background */
    }

    .redo.disabled {
        filter: invert(100%) grayscale(100%) brightness(50%);
        pointer-events: none;
        opacity: 0.5;
    }

/* Undo/Redo dropdown styling */
.main-undo-redo-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 300px;
    max-width: 400px;
    display: none;
}

    .main-undo-redo-dropdown .dropdown-header {
        background-color: #f8f9fa;
        border-bottom: 1px solid #ddd;
        padding: 8px 12px;
        font-weight: bold;
        font-size: 14px;
        color: #333;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
    }

    .main-undo-redo-dropdown .dropdown-content {
        max-height: 300px;
        overflow-y: auto;
        font-size: 10pt;
        padding: 0;
    }

    .main-undo-redo-dropdown .dropdown-item {
        display: block;
        width: 100%;
        text-align: left;
        padding: 8px 12px;
        border: none;
        background: none;
        cursor: pointer;
        border-bottom: 1px solid #f0f0f0;
        transition: background-color 0.2s ease;
    }

        .main-undo-redo-dropdown .dropdown-item:hover {
            background-color: #f5f5f5;
        }

        .main-undo-redo-dropdown .dropdown-item:last-child {
            border-bottom: none;
        }

        .main-undo-redo-dropdown .dropdown-item.disabled {
            color: #999;
            cursor: default;
            font-style: italic;
        }

            .main-undo-redo-dropdown .dropdown-item.disabled:hover {
                background-color: transparent;
            }

        .main-undo-redo-dropdown .dropdown-item div:first-child {
            font-weight: bold;
            margin-bottom: 2px;
            color: #333;
        }

        .main-undo-redo-dropdown .dropdown-item div:last-child {
            font-size: 0.9em;
            color: #666;
        }

    /* Keep dropdown open when hovering */
    .main-undo-redo-dropdown:hover {
        display: block !important;
    }
/* #endregion */

/* Highlight for updated (yellow) rows in VirtualGrid */
.virtual-grid-table-row-updated {
    background-color: #fff9c4 !important; /* Material yellow 100 */
    transition: background-color 0.3s;
}

    /* Optionally, highlight updated cells as well */
    .virtual-grid-table-row-updated td {
        background-color: #fff9c4 !important;
    }

.auto-select-wrapper {
    position: relative;
    display: inline-block;
    font-family: sans-serif;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding-right: 28px; /* reserve full width for new chevron container */
    box-sizing: border-box;
    width: fit-content;
}

    .auto-select-wrapper input {
        border: 1px solid lightgrey;
        outline: none;
        padding: 8px;
        font-size: 16px;
        border-radius: 4px;
        width: 100%;
        box-sizing: border-box;
        color: #000; /* force black text */
        font-weight: normal; /* semibold */
    }

.chevron {
    position: absolute;
    top: 0; /* full height */
    right: 0; /* flush to wrapper edge */
    bottom: 0; /* stretch */
    transform: none; /* no vertical translate needed */
    display: flex; /* center icon */
    align-items: center;
    justify-content: center;
    width: 28px; /* matches padding-right */
    cursor: pointer;
    font-size: 24px;
    color: #555;
    user-select: none;
    line-height: 1; /* keep icon tight */
}

/* Optional visual separator */
.auto-select-wrapper .chevron {
    border-left: 1px solid #ccc;
}

.auto-select-wrapper input[readonly],
.auto-select-wrapper input:read-only {
    background-color: #f5f5f5; /* lighter grey for readonly to match disabled */
    cursor: default;
}

    .auto-select-wrapper input[readonly] ~ .chevron,
    .auto-select-wrapper input:read-only ~ .chevron {
        background-color: #f5f5f5; /* lighter grey chevron for readonly */
        color: #888;
        cursor: not-allowed;
        pointer-events: none;
    }

    .auto-select-wrapper input:disabled ~ .chevron,
    .auto-select-wrapper input[readonly] ~ .chevron,
    .auto-select-wrapper input:read-only ~ .chevron {
        background-color: #f5f5f5;
        color: #888;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Never show dropdown if host input is disabled/readonly */
    .auto-select-wrapper input:disabled ~ .auto-select-dropdown,
    .auto-select-wrapper input[readonly] ~ .auto-select-dropdown,
    .auto-select-wrapper input:read-only ~ .auto-select-dropdown {
        display: none !important;
    }

.auto-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff !important; /* reinforce solid background */
    border: 1px solid #ccc !important; /* reinforce border */
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    padding-left: 8px;
    z-index: 1000;
    isolation: isolate; /* create stacking context to prevent bleed */
    color: #000; /* force black text */
    font-weight: normal; /* semibold */
}

.auto-select-dropdown {
    background: #fff;
    border: 1px solid #ccc;
}

.auto-select-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.auto-select-dropdown li {
    padding: 6px 8px;
    cursor: pointer;
    border: none;
    background: transparent;
    white-space: nowrap;
}

/* Hover state - light grey background */
.auto-select-dropdown li:hover {
    background-color: #d3d3d3;
    border: none;
    outline: none;
}

/* Selected state (keyboard navigation) - light grey background */
.auto-select-dropdown li.selected {
    background-color: #d3d3d3;
    border: none;
    outline: none;
}

/* Focused state - light grey background */
.auto-select-dropdown li:focus {
    background-color: #d3d3d3;
    border: none;
    outline: none;
}
