/* 
 * SCMI Costing System - macOS Glass UI Style
 * Modern glassmorphism design with backdrop blur and translucent surfaces
 */

/* macOS Glass UI Color Palette */
:root {
    --macos-white: #ffffff;
    --macos-gray-50: #fafafa;
    --macos-gray-100: #f5f5f7;
    --macos-gray-200: #e8e8ed;
    --macos-gray-300: #d2d2d7;
    --macos-gray-400: #86868b;
    --macos-gray-500: #6e6e73;
    --macos-gray-600: #515154;
    --macos-text: #1d1d1f;
    --macos-text-secondary: #6e6e73;

    /* SCMI Accent Colors */
    --scmi-blue: #0533b5;
    --scmi-blue-light: #2563eb;
    --scmi-blue-hover: #003cab;
    --scmi-excel-green: #34a853;

    /* Glass UI Colors with Transparency */
    --glass-white: rgba(255, 255, 255, 0.7);
    --glass-white-strong: rgba(255, 255, 255, 0.85);
    --glass-gray-50: rgba(250, 250, 250, 0.6);
    --glass-gray-100: rgba(245, 245, 247, 0.7);
    --glass-blue: rgba(5, 51, 181, 0.9);
    --glass-blue-light: rgba(37, 99, 235, 0.85);

    /* Blur Strengths */
    --blur-sm: blur(10px);
    --blur-md: blur(20px);
    --blur-lg: blur(30px);
    --blur-xl: blur(40px);

    /* Glass Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px 0 rgba(0, 0, 0, 0.12);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --shadow-glass-lg: 0 12px 48px 0 rgba(31, 38, 135, 0.2);
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--macos-text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* Glass-style Cards */
.card {
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-glass-lg);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
}

/* Glass Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--scmi-blue) 0%, var(--scmi-blue-hover) 100%);
    color: white;
    box-shadow: 0 4px 15px 0 rgba(5, 51, 181, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--scmi-blue-hover) 0%, #002080 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(5, 51, 181, 0.4);
    color: white;
}

/* Glass Forms */
.form-control {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    color: var(--macos-text);
}

.form-control:focus {
    border-color: var(--scmi-blue);
    box-shadow: 0 0 0 4px rgba(5, 51, 181, 0.15), 0 4px 12px rgba(5, 51, 181, 0.2);
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

.form-control::placeholder {
    color: rgba(110, 110, 115, 0.7);
}

/* Legacy class compatibility with Glass Effect */
.bg-web-main {
    background: linear-gradient(135deg, var(--scmi-blue) 0%, var(--scmi-blue-hover) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(5, 51, 181, 0.3);
}

.bg-excel {
    background: var(--scmi-excel-green);
    color: #ffffff;
}

.text-web-main {
    color: var(--scmi-blue);
}

.text-web-secondary {
    color: var(--scmi-blue-light);
}

/* Custom Table Styles */
.tbl-gen-data {
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--macos-white);
    border-radius: 8px;
    overflow: hidden;
}

.tbl-gen-data td,
.tbl-gen-data th {
    font-size: 0.85em;
    padding: 8px 12px;
    border: 1px solid var(--macos-gray-200);
}

.tbl-gen-data th {
    text-align: center;
    background-color: var(--macos-gray-50);
    font-weight: 600;
    color: var(--macos-text);
}

#tbl-gen-main {
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    position: relative;
}

#tbl-gen-main td,
#tbl-gen-main th {
    font-size: 0.85em;
    padding: 8px 12px;
    border: 1px solid var(--macos-gray-200);
}

#tbl-gen-main th {
    position: sticky;
    top: 0;
    background-color: var(--macos-gray-50);
    z-index: 10;
}

#tbl-gen-small {
    border-collapse: collapse;
    border-spacing: 0;
}

#tbl-gen-small td,
#tbl-gen-small th {
    font-size: 0.9em;
    padding: 10px;
    border: 1px solid var(--macos-gray-200);
}

#tbl-gen-small th {
    background-color: var(--macos-gray-50);
    text-align: center;
    font-weight: 600;
}

/* Excel Preview Table */
.tbl-show-excel {
    border-collapse: collapse;
    border-spacing: 0;
    position: relative;
    background: var(--macos-white);
}

.tbl-show-excel td,
.tbl-show-excel th {
    font-size: 0.8em;
    padding: 6px 10px;
    border: 1px solid var(--macos-gray-200);
}

.tbl-show-excel th {
    position: sticky;
    text-align: center;
    top: 0;
    background-color: var(--macos-gray-50);
    font-weight: 600;
}

/* Loading Spinner */
.waitloader-overlay {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20000;
    background: rgba(29, 29, 31, 0.4);
    backdrop-filter: blur(10px);
    text-align: center;
}

.waitloader-container {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
}

.waitloader-text {
    color: var(--macos-text);
    margin: 0 auto;
    margin-top: 20px;
    font-weight: 500;
}

.waitloader-spinner {
    height: 60px;
    width: 60px;
    margin: 0 auto;
    animation: rotation .6s infinite linear;
    border-left: 6px solid rgba(5, 51, 181, 0.15);
    border-right: 6px solid rgba(5, 51, 181, 0.15);
    border-bottom: 6px solid rgba(5, 51, 181, 0.15);
    border-top: 6px solid var(--scmi-blue);
    border-radius: 100%;
}

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(359deg);
    }
}

.showDataLoader-spinner {
    height: 40px;
    width: 40px;
    margin: 0 auto;
    animation: rotation .6s infinite linear;
    border-left: 4px solid rgba(5, 51, 181, 0.15);
    border-right: 4px solid rgba(5, 51, 181, 0.15);
    border-bottom: 4px solid rgba(5, 51, 181, 0.15);
    border-top: 4px solid var(--scmi-blue);
    border-radius: 100%;
}

/* Mini Loading Spinner */
.loading-spinner {
    width: 15px;
    height: 15px;
    border: 3px solid var(--macos-gray-300);
    border-top-color: var(--scmi-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Utility Classes */
.al-r {
    text-align: right;
}

.al-l {
    text-align: left;
}

.al-c {
    text-align: center;
}

.has-error,
.input-error-warn {
    border: 1px solid #ff3b30;
}

.pre-wrap {
    white-space: pre-wrap;
}

/* AG Grid Custom Styles */
.ag-head-row1 {
    background-color: var(--macos-gray-50);
    color: var(--macos-text);
}

.ag-head-row2 {
    background-color: var(--macos-gray-100);
    color: var(--macos-text);
}

.ag-header-cell-comp-wrapper {
    justify-content: center;
}

.ag-header-cell-label {
    justify-content: center;
}

.cell-num-ag-table {
    text-align: right;
}

.manual-lock-cell {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.edit-lock-float {
    border: none;
    background: transparent;
    color: transparent;
    padding: 0;
    position: absolute;
    z-index: 500;
}

.custom-edit-manual-lock-wrapper:hover .edit-lock-float.is-lock {
    color: #ff9500;
}

.custom-edit-manual-lock-wrapper:hover .edit-lock-float.is-unlock {
    color: var(--macos-gray-400);
}

.cell-display-value {
    margin-left: 22px;
}

/* Sheet Tabs */
.div-sheet-head-wrapper {
    padding-top: 6px;
    border-top-right-radius: 8px;
    border-top-left-radius: 8px;
    background: var(--macos-gray-50);
}

.div-sheet-item {
    border: none;
    padding: 0 4px;
    margin-right: 4px;
    background-color: transparent;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}

.div-sheet-item.active .btn-sheet-link {
    color: var(--macos-text);
    background-color: var(--macos-white);
    box-shadow: var(--shadow-sm);
}

.div-sheet-item .btn-sheet-link {
    border: none;
    border-top-right-radius: 8px;
    border-top-left-radius: 8px;
    padding: 6px 12px;
    color: var(--macos-text-secondary);
    transition: all 0.2s ease;
}

.div-sheet-item .btn-sheet-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Tab Styles */
.nav-tabs {
    border-bottom: 1px solid var(--macos-gray-200);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--macos-text-secondary);
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--macos-text);
    background-color: var(--macos-gray-50);
    border-radius: 8px 8px 0 0;
}

.nav-tabs .nav-link.active {
    color: var(--scmi-blue);
    background-color: transparent;
    border-bottom: 2px solid var(--scmi-blue);
}

/* Compare Table */
#tbl-compare-small {
    border-collapse: collapse;
    border-spacing: 0;
}

#tbl-compare-small td,
#tbl-compare-small th {
    font-size: 0.7em;
    padding: 4px 8px;
    border: 1px solid var(--macos-gray-200);
}

#tbl-compare-small th {
    background-color: var(--macos-gray-50);
    text-align: center;
    position: sticky;
    top: 0;
    font-weight: 600;
}

#tbl-compare-small thead tr.head-row-1 th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 20px;
}

#tbl-compare-small thead tr.head-row-2 th {
    position: sticky;
    top: 20px;
    z-index: 3;
    height: 20px;
}

#tbl-compare-small thead tr.head-row-3 th {
    position: sticky;
    top: 40px;
    z-index: 3;
    height: 20px;
}

/* Animations */
.just-updated {
    animation: transcolorupdate 2s 1;
}

@keyframes transcolorupdate {
    from {
        color: var(--macos-gray-400);
    }

    to {
        color: unset;
    }
}

.text-loading:after {
    overflow: hidden;
    display: inline-block;
    vertical-align: bottom;
    animation: ellipsis steps(4, end) 900ms infinite;
    content: "\2026";
    width: 0;
}

@keyframes ellipsis {
    to {
        width: 1.25em;
    }
}

/* Remove number input spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Scrollbar Styling (macOS-like) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--macos-gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--macos-gray-400);
}