/*@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');*/
@import url("_content/MudBlazor/MudBlazor.min.css");
/*@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');*/

html,
body {
    font-family: 'Vazirmatn', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    height: 100%;
    margin: 0;
    direction: rtl;
}

a,
.btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

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

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

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5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1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
    text-align: start;
}

/* CKEditor High Z-Index Fix used to fix modal issues or overlap */
:root {
    --ck-z-default: 2000;
    --ck-z-modal: 2000;
}

.mud-dialog-container {
    z-index: 1300 !important;
}

.ck.ck-balloon-panel {
    z-index: 2000 !important;
}

.ck.ck-editor__editable_inline {
    user-select: text !important;
    cursor: text !important;
}

/* Ensure CKEditor is not trapped by MudDialog focus trap */
.mud-dialog:focus-within {
    outline: none;
}

/* Ensure Dialogs are above MudAppBar */
.mud-appbar {
    z-index: 1000 !important;
}

.mud-dialog-container {
    z-index: 2000 !important;
    /* Increased from 1300 */
}

/* Ensure MudBlazor Popovers (Menus, Selects, Tooltips) render above MudDialogs */
.mud-popover-provider .mud-popover,
.mud-popover {
    z-index: 2100 !important;
}

/* Fix MudDialog Close Button overlapping with Title in RTL */
.mud-dialog .mud-dialog-title {
    padding-left: 48px !important;
    padding-right: 24px !important;
}

.mud-dialog .mud-dialog-title>.mud-icon-button {
    right: auto !important;
    left: 8px !important;
    position: absolute !important;
    top: 8px !important;
}

/* Fix Fullscreen Dialog shrinking or expanding weirdly in RTL */
.mud-dialog.mud-dialog-fullscreen {
    margin: 0 !important;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure content scrolls if needed */
.mud-dialog.mud-dialog-fullscreen .mud-dialog-content {
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    padding: 24px !important;
}

/* Make all dialog content scrollable */
.mud-dialog .mud-dialog-content {
    overflow-y: auto !important;
    max-height: 80vh !important;
}

/* Snackbar must always render ABOVE dialogs and everything else */
.mud-snackbar-location-bottom-right,
.mud-snackbar-location-bottom-left,
.mud-snackbar-location-top-right,
.mud-snackbar-location-top-left,
.mud-snackbar-location-bottom-center,
.mud-snackbar-location-top-center {
    z-index: 9999 !important;
    position: fixed !important;
}

.mud-snackbar-container {
    z-index: 10000 !important;
}

/* ==========================================
   Antigravity Premium UI Additions & Themes
   ========================================== */

/* Fade-in animation for views */
.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glassmorphism for Top Appbar */
.mud-appbar.custom-glassy-appbar {
    background-color: var(--mud-palette-surface) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--mud-palette-divider) !important;
    transition: all 0.3s ease;
}

/* Modernized Sidebar */
.custom-sidebar {
    background-color: var(--mud-palette-drawer-background) !important;
    border-inline-end: 1px solid var(--mud-palette-divider) !important;
    transition: all 0.3s ease;
}

/* Sidebar Nav Links */
.custom-sidebar .mud-nav-link {
    border-radius: 8px !important;
    margin: 4px 8px !important;
    padding: 10px 16px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 500 !important;
}

.custom-sidebar .mud-nav-link:hover {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.08) !important;
    color: var(--mud-palette-primary) !important;
    transform: translateX(-4px) !important; /* RTL slide in */
}

/* Active Nav Link Styling */
.custom-sidebar .mud-nav-link.active {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.12) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 600 !important;
    border-inline-start: 4px solid var(--mud-palette-primary) !important;
    box-shadow: 0 4px 12px rgba(var(--mud-palette-primary-rgb), 0.08);
}

/* Dashboard Metric Cards */
.dashboard-metric-card {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: 1px solid var(--mud-palette-divider) !important;
    position: relative;
    overflow: hidden;
}

.dashboard-metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--mud-elevation-8) !important;
    border-color: rgba(var(--mud-palette-primary-rgb), 0.3) !important;
}

/* Icon badge glowing backgrounds */
.icon-badge {
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Modern zebra striping and styling for MudDataGrid */
.custom-modern-grid {
    border-radius: 12px !important;
    overflow: hidden;
    border: 1px solid var(--mud-palette-divider) !important;
    box-shadow: var(--mud-elevation-2) !important;
}

.custom-modern-grid .mud-table-container {
    border-radius: 12px !important;
}

.custom-modern-grid .mud-table-row {
    transition: background-color 0.2s ease !important;
}

.custom-modern-grid .mud-table-row:nth-of-type(odd) {
    background-color: rgba(var(--mud-palette-action-default-rgb), 0.02) !important;
}

.custom-modern-grid .mud-table-row:hover {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.04) !important;
}

.custom-modern-grid .mud-table-head {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.06) !important;
    border-bottom: 2px solid var(--mud-palette-divider) !important;
}

.custom-modern-grid .mud-table-cell {
    font-weight: 500 !important;
    padding: 14px 16px !important;
    transition: all 0.2s ease !important;
}

@media (min-width: 960px) {
    .custom-modern-grid .mud-table-cell {
        max-width: 280px !important;
        white-space: normal !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }
    .custom-modern-grid .mud-table-cell-content {
        white-space: normal !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }
}

@media (max-width: 959.98px) {
    .custom-modern-grid {
        width: 100% !important;
        max-width: 100% !important;
    }
    .custom-modern-grid .mud-table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    .custom-modern-grid table {
        table-layout: fixed !important;
        width: 100% !important;
    }
    .custom-modern-grid .mud-table-cell,
    .custom-modern-grid .mud-table-cell-content {
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }
    .custom-modern-grid .mud-table-cell span:not(.mud-chip),
    .custom-modern-grid .mud-table-cell div:not(.mud-chip-content) {
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }
}

/* Outlined Form Field Focus glowing shadow */
.mud-input-control.mud-input-outlined:focus-within {
    box-shadow: 0 0 0 3px rgba(var(--mud-palette-primary-rgb), 0.15) !important;
    border-radius: 8px !important;
}

.mud-input-outlined {
    transition: all 0.25s ease !important;
}

/* Elegant Dialog Headers */
.mud-dialog .mud-dialog-title {
    background: linear-gradient(135deg, rgba(var(--mud-palette-primary-rgb), 0.12), rgba(var(--mud-palette-surface-rgb), 0));
    border-bottom: 1px solid var(--mud-palette-divider) !important;
    padding: 16px 24px !important;
    font-weight: bold !important;
}

.mud-dialog-content {
    padding: 24px !important;
}

.mud-dialog-actions {
    border-top: 1px solid var(--mud-palette-divider) !important;
    padding: 16px 24px !important;
}

/* Micro animations */
.animate-rotate {
    transition: transform 0.4s ease;
}
.animate-rotate:hover {
    transform: rotate(30deg);
}

/* Clean Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(var(--mud-palette-action-default-rgb), 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.5);
}

/* Fix mobile grid squeezing: make sure the datagrid takes full width */
.custom-mobile-grid-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
}

.custom-mobile-grid-wrapper .custom-modern-grid {
    width: 100% !important;
    min-width: 100% !important;
}

/* CKEditor Fullscreen mode styling */
.ck-editor-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--mud-palette-surface) !important;
}

.ck-editor-fullscreen .ck-editor__main {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.ck-editor-fullscreen .ck-content {
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: none !important;
}

/* Fixed header / scrollable editor area */
.ck.ck-editor {
    display: flex !important;
    flex-direction: column !important;
}

.ck.ck-editor__main {
    flex: 1 1 auto !important;
}

.ck-editor__editable_inline {
    min-height: 250px !important;
    max-height: 550px !important;
    overflow-y: auto !important;
}

/* Hide toolbar and border for read-only CKEditor */
.ck-editor-readonly .ck-editor__top {
    display: none !important;
}

.ck-editor-readonly .ck-editor__editable {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Also reset min-height in read-only mode so it fits content size */
.ck-editor-readonly .ck-editor__editable_inline {
    min-height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
}

/* Escape all containing contexts and overflows for fullscreen CKEditor */
*:has(.ck-editor-fullscreen) {
    transform: none !important;
    animation: none !important;
    filter: none !important;
    perspective: none !important;
    contain: none !important;
    backdrop-filter: none !important;
    clip-path: none !important;
    will-change: auto !important;
    overflow: visible !important;
}

/* Ensure CKEditor editable container takes full height in fullscreen mode */
.ck-editor-fullscreen .ck-editor__editable_inline {
    max-height: none !important;
    height: 100% !important;
    flex: 1 1 auto !important;
}
