/* Custom Fonts */
@font-face {
    font-family: 'DBHeaventRegular';
    src: url('fonts/DB Heavent v3.2.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

html {
    font-size: 17.5px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga" 1, "dlig" 1;
}

/* Base Body Styles */
body {
    background-color: #0c0518;
    background-image: url('images/background_d.jpg');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    background-position: center bottom;
    font-family: 'DBHeaventRegular', 'Prompt', 'Sarabun', sans-serif !important;
    font-size: 1.35rem;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga" 1, "dlig" 1;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

@media (max-width: 768px) {
    body {
        background-image: url('images/background_m.jpg');
    }
}

/* Glassmorphism Panel styles for modern UI */
.glass-panel {
    background: linear-gradient(135deg, rgba(17, 0, 42, 0.8) 0%, rgba(41, 18, 80, 0.8) 100%) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px;
    color: white !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-panel-light {
    background: rgba(234, 244, 253, 0.7) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px;
    color: #1a1a1a !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

/* Custom layout container helper */
.app-container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

/* Sizing Utilities */
.w-100 {
    width: 100% !important;
}

.h-100 {
    height: 100% !important;
}

.min-vh-100 {
    min-height: 100vh !important;
}

/* Normalized actions buttons container for consistent layout across all pages */
.action-row-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.action-row-container .mud-button {
    flex: 1;
    max-width: 280px;
    min-width: 100px;
    min-height: 48px !important;
    height: auto !important;
    border-radius: 26px !important;
    font-weight: 600 !important;
    font-size: 1.3rem !important;
    line-height: 1.15 !important;
    text-transform: none !important;
    padding: 8px 16px !important;
    transition: all 0.2s ease-in-out;
}

.action-row-container .mud-button .mud-button-label {
    line-height: 1.15 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 100%;
}

/* Hover micro-interactions */
.action-row-container .mud-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Responsiveness adjustments for smaller devices */
@media (max-width: 576px) {
    .action-row-container {
        gap: 10px;
    }

    .action-row-container .mud-button {
        font-size: 1.1rem !important;
        min-height: 46px !important;
        height: auto !important;
        padding: 6px 12px !important;
        line-height: 1.15 !important;
    }
}

/* Consistent labels in glass panels */
.glass-label {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.glass-accent-label {
    color: #ffde21 !important;
    font-weight: 600 !important;
}

/* Font updates for MudBlazor elements to ensure consistency */
.mud-typography,
.mud-button,
.mud-button-label,
.mud-input,
.mud-input-control,
.mud-input-label,
.mud-select,
.mud-dialog,
.mud-dialog-title,
.mud-dialog-content,
.mud-dialog-actions,
.mud-checkbox,
.mud-list-item,
.mud-list-item-text,
.mud-table-cell {
    font-family: 'DBHeaventRegular', 'Prompt', 'Sarabun', sans-serif !important;
}

.mud-button-label {
    font-size: 1.4rem !important;
    font-weight: 500 !important;
}

.mud-input {
    font-size: 1.35rem !important;
}

/* Ensure check-boxes, list items, dropdown lists and tables scale properly */
.mud-checkbox-label,
.mud-checkbox {
    font-size: 1.35rem !important;
}

.mud-list-item,
.mud-list-item-text {
    font-size: 1.35rem !important;
}

.mud-table-cell {
    font-size: 1.25rem !important;
}

.mud-table-cell-header {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
}

/* Error boundary and standard Blazor styles */
h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 1.2rem;
    font-weight: 500;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC51NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzIa9kZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC51NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAz) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Align Radio Icon to the first line of multi-line text */
.align-start-radio,
.align-start-radio-group .mud-radio {
    align-items: flex-start !important;
}

.align-start-radio .mud-radio-button,
.align-start-radio-group .mud-radio .mud-radio-button,
.align-start-radio-group .mud-radio>span:first-child {
    align-self: flex-start !important;
    margin-top: -4px !important;
    /* Offset standard padding to align with first text line center */
}

/* Fix outlined floating labels overlapping with input text due to typography scaling */
.mud-input-label-outlined.mud-shrink,
.mud-input-label-outlined.mud-input-label-margin-dense.mud-shrink,
.glass-panel .mud-input-outlined~.mud-input-label-outlined,
.glass-panel-light .mud-input-outlined~.mud-input-label-outlined {
    transform: translate(14px, -11px) scale(0.75) !important;
    background-color: white !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    border-radius: 4px;
}

/* Login Error Alert Banner Styling */
@keyframes loginErrorPop {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }

    50% {
        transform: scale(1.02);
    }

    70% {
        transform: scale(0.98);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.login-error-banner {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(153, 27, 27, 0.95) 100%) !important;
    border: 2px solid #fca5a5 !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 25px rgba(220, 38, 38, 0.55), 0 0 15px rgba(252, 165, 165, 0.3) !important;
    animation: loginErrorPop 0.35s ease-out forwards;
    padding: 12px 18px !important;
    margin-top: 12px !important;
}

.login-error-banner .mud-alert-icon {
    font-size: 1.8rem !important;
    color: #ffffff !important;
}

.login-error-text {
    color: #ffffff !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6) !important;
    line-height: 1.4 !important;
}

/* Ensure MudDatePicker input matches MudTextField and MudSelect exactly */
.mud-picker.mud-input-control,
.mud-picker .mud-input.mud-input-outlined {
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
}

.mud-picker .mud-input.mud-input-outlined input {
    color: #11002a !important;
}

.mud-picker .mud-input.mud-input-outlined .mud-icon-root {
    color: #662d91 !important;
}

/* MudDatePicker Popover & Calendar (Only the popup calendar dialog) */
.mud-picker-inline-paper,
.mud-picker-paper,
.mud-picker-container,
.mud-picker-content,
.mud-picker-view,
.mud-picker-calendar,
.mud-picker-calendar-transition,
.mud-popover:has(.mud-picker-container) .mud-paper,
.mud-popover .mud-picker-container,
.mud-popover .mud-picker-content,
.mud-dialog .mud-picker-container {
    background-color: #ffffff !important;
    background: #ffffff !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.mud-picker-inline-paper,
.mud-picker-paper,
.mud-popover:has(.mud-picker-container) .mud-paper {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
}

.mud-picker-header {
    background-color: #662d91 !important;
    color: #ffffff !important;
}

.mud-picker-calendar-header {
    background-color: #ffffff !important;
    color: #11002a !important;
}

.mud-picker-calendar-day,
.mud-day {
    color: #11002a !important;
    font-weight: 500 !important;
}

.mud-picker-calendar-day.mud-selected,
.mud-day.mud-selected {
    background-color: #662d91 !important;
    color: #ffffff !important;
}

.mud-picker-calendar-day:hover,
.mud-day:hover {
    background-color: rgba(102, 45, 145, 0.12) !important;
}