@font-face {
    font-family: 'IRANSans';
    src: url('/fonts/IRANSansWeb.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* MudBlazor پیش‌فرض Roboto از Google می‌خواهد — از فونت محلی استفاده می‌کنیم */
.mud-typography,
.mud-input,
.mud-input-root,
.mud-button-label,
.mud-table-cell {
    font-family: 'IRANSans', Tahoma, sans-serif !important;
}
#custom-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 40%, #3b82f6 100%);
    font-family: 'IRANSans', sans-serif;
    color: #fff;
    z-index: 99999;
    transition: opacity 0.35s ease-out;
    pointer-events: none;
}

#custom-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.12), transparent 55%);
    pointer-events: none;
}

#custom-loading img {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.25));
    animation: psLogoPulse 2s ease-in-out infinite;
}

@keyframes psLogoPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#custom-loading.hiding {
    opacity: 0;
}

.loading-text {
    position: relative;
    z-index: 1;
    margin-top: 18px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff !important;
    text-align: center;
}

.loading-subtext {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.loader {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    animation: spin 0.85s linear infinite;
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.2);
}

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

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

/* Loading screen برای Authorizing */
.loading-container-auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background-color: var(--theme-drawer-bg, #0d47a1);
    font-family: 'IRANSans', sans-serif;
    color: var(--theme-appbar-text, white);
}

.loading-container-auth img {
    margin-bottom: 20px;
}

.loading-text-auth {
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--theme-appbar-text, white);
    text-align: center;
}

.loader-auth {
    margin-top: 20px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

 

/* مخفی کردن spinner در input های number */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

.dialog-rtl {
    direction: rtl;
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
}

.dialog-content-large {
    height: 80vh !important;
    overflow-y: auto !important;
    max-height: 80vh !important;
}

.dialog-rtl .mud-typography,
.dialog-rtl .mud-input,
.dialog-rtl .mud-input-label,
.dialog-rtl .mud-button,
.dialog-rtl .mud-checkbox,
.dialog-rtl .mud-switch,
.dialog-rtl .mud-table,
.dialog-rtl .mud-card,
.dialog-rtl .mud-select,
.dialog-rtl .mud-form-control,
.dialog-rtl .mud-chip,
.dialog-rtl .mud-badge {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
}

/* فونت برای نمودارها */
.dialog-rtl .mud-chart text {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
}

.dialog-rtl .mud-chart .apexcharts-xaxis-label,
.dialog-rtl .mud-chart .apexcharts-yaxis-label {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
}

.dialog-rtl .mud-chart .apexcharts-tooltip {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif !important;
    direction: rtl;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

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

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.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;
}

.not-found-container {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, 
        rgba(var(--theme-primary-rgb, 33, 150, 243), 0.08), 
        rgba(var(--theme-primary-dark-rgb, 63, 81, 181), 0.05));
}

.not-found-card {
    max-width: 540px;
    width: 100%;
    padding: 3rem 2.5rem;
    text-align: center;
    border-radius: 24px;
    background-color: var(--theme-surface, rgba(255, 255, 255, 0.92));
    backdrop-filter: blur(6px);
    box-shadow: 0 16px 40px rgba(var(--theme-primary-rgb, 63, 81, 181), 0.18);
    color: var(--theme-text-primary);
}

.not-found-icon {
    margin-bottom: 1.5rem;
    font-size: 96px;
}

.not-found-title {
    font-family: "iransans", sans-serif;
    margin-bottom: 1rem;
}

.not-found-subtitle {
    color: var(--mud-palette-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

@media (max-width: 600px) {
    .not-found-card {
        padding: 2.5rem 1.75rem;
        border-radius: 18px;
    }

    .not-found-icon {
        font-size: 72px;
    }
}

/* دکمه شناور قابل drag دستیار هوش مصنوعی */
.ai-assistant-draggable {
    position: fixed !important;
    z-index: 1000 !important;
    border-radius: 50% !important;
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    padding: 0 !important;
    box-shadow: 0 8px 16px rgba(var(--theme-primary-rgb, 63, 81, 181), 0.4) !important;
    transition: box-shadow 0.3s ease !important;
    background: linear-gradient(135deg, var(--theme-primary, #1976d2), var(--theme-primary-dark, #1565c0)) !important;
    cursor: grab !important;
    user-select: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.ai-assistant-draggable .mud-button-root {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ai-assistant-draggable .mud-button-label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-assistant-draggable .mud-icon-root,
.ai-assistant-draggable .mud-icon-button-icon,
.ai-assistant-draggable i,
.ai-assistant-draggable .mud-icon-root svg {
    color: white !important;
    font-size: 40px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.ai-assistant-draggable:hover {
    box-shadow: 0 12px 24px rgba(var(--theme-primary-rgb, 63, 81, 181), 0.6) !important;
}

.ai-assistant-draggable:active {
    cursor: grabbing !important;
    transform: scale(0.95) !important;
}

/* در موبایل: دکمه در گوشه پایین چپ */
@media (max-width: 768px) {
    .ai-assistant-draggable {
        position: fixed !important;
        bottom: 24px !important;
        left: 24px !important;
        right: auto !important;
        top: auto !important;
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        cursor: pointer !important;
    }
}
