/* ============================================================
   app.css — سامانه مدیریت اسناد
   Sneat Design System (RTL/Persian adaptation)
   ============================================================ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
}
html {
    direction: rtl;
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: 'Vazirmatn', sans-serif;
    min-width: 0;
}

.hnd-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
#app, .mud-layout {
    width: 100%;
    max-width: 100%;
    height: 100% !important;
    min-height: 100vh !important;
    overflow-x: hidden;
}

.hnd-icon-btn-wrap { display: inline-flex; }

.hnd-bell-alert.mud-icon-button,
.hnd-bell-alert.mud-button-root {
    color: var(--mud-palette-error) !important;
}
.hnd-bell-alert .mud-icon-root {
    color: var(--mud-palette-error) !important;
}
.hnd-bell-badge .mud-badge {
    background-color: var(--mud-palette-error) !important;
    color: var(--mud-palette-error-text) !important;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.hnd-drawer .mud-drawer-content {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    height: 100% !important;
}
.hnd-sidebar-logo {
    flex: 0 0 64px;
    padding: 0 20px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--mud-palette-divider);
}
.hnd-sidebar-scroll {
    flex: 1 1 0; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    padding: 8px 0;
}
.hnd-nav-section {
    padding: 18px 14px 4px;
    font-size: 0.6875rem; font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════ */
.mud-main-content {
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}
.hnd-main-content .mud-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 24px; }

/* ══════════════════════════════════════════════════════════════
   RTL Fixes
   ══════════════════════════════════════════════════════════════ */
/* RTL label/border positioning is handled natively by MudRTLProvider — no manual transform hacks here */
.mud-select .mud-input-adornment-end,
.mud-autocomplete .mud-input-adornment-end {
    margin-inline-start: 0; margin-inline-end: 4px;
}
.mud-table-cell, .mud-table-head-cell { text-align: right; }
.mud-table-pagination-actions         { direction: ltr; }
.mud-tooltip                          { direction: rtl; text-align: right; }
.mud-snackbar-location-bottom-right   { left: 16px !important; right: auto !important; }
.mud-nav-item .mud-nav-link           { padding-inline-start: 16px; padding-inline-end: 8px; }
.mud-chip .mud-chip-close-button      { margin-inline-start: 4px; margin-inline-end: -4px; }

/* landing / login */
.hnd-login-layout {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 24px 16px;
    background: var(--mud-palette-background);
}
.hnd-landing-container {
    width: 100%;
    min-width: 0;
}
.hnd-landing-grid {
    align-items: center;
}
.hnd-landing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.hnd-landing-header .mud-icon-button {
    width: 44px;
    height: 44px;
}
.hnd-login-column,
.hnd-landing-intro-column {
    min-width: 0;
}
.hnd-login-column { order: 1; }
.hnd-landing-intro-column { order: 2; }
.hnd-landing-copy {
    width: 100%;
    max-width: 520px;
    margin-inline-start: auto;
    margin-bottom: 28px;
}
.hnd-landing-title {
    margin-top: 8px;
    line-height: 1.38;
    letter-spacing: -0.025em;
}
.hnd-landing-description {
    max-width: 500px;
    margin-top: 14px;
    line-height: 1.9;
}
.hnd-login-card {
    width: 100%;
    max-width: 440px;
    margin-inline-end: 0;
    margin-inline-start: auto;
}
.hnd-landing-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hnd-landing-brand > div,
.hnd-process-step,
.hnd-process-step > div {
    min-width: 0;
}
.hnd-landing-title,
.hnd-landing-description,
.hnd-process-step .mud-typography {
    overflow-wrap: anywhere;
}
.hnd-landing-visual {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--mud-palette-divider);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
}
.hnd-landing-visual img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1600 / 833;
    object-fit: cover;
}
.hnd-process-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 22px;
    padding-block: 18px;
    border-block: 1px solid var(--mud-palette-divider);
}
.hnd-process-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-inline: 18px;
}
.hnd-process-step + .hnd-process-step {
    border-inline-start: 1px solid var(--mud-palette-divider);
}
.hnd-process-step .mud-icon-root {
    flex: 0 0 auto;
    margin-top: 2px;
}
.hnd-login-assurances {
    max-width: 440px;
    margin-top: 18px;
    margin-inline-start: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
}
.hnd-login-assurances span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hnd-login-assurances .mud-icon-root {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: var(--mud-palette-primary);
}
.hnd-login-label {
    display: block; font-family: 'Vazirmatn', sans-serif;
    font-size: 0.8125rem; color: var(--mud-palette-text-secondary); margin-bottom: 6px;
}
.hnd-login-input {
    width: 100%; padding: 10px 14px;
    font-family: 'Vazirmatn', sans-serif; font-size: 0.9375rem;
    border: 1px solid var(--mud-palette-lines-inputs); border-radius: var(--mud-default-borderradius);
    min-height: 48px;
    outline: 2px solid transparent;
    outline-offset: 2px;
    background: var(--mud-palette-surface); color: var(--mud-palette-text-primary);
    box-sizing: border-box;
}
.hnd-login-input:focus-visible {
    border-color: var(--mud-palette-primary);
    outline-color: var(--mud-palette-primary);
}
@media (max-width: 959px) {
    .hnd-login-layout {
        align-items: flex-start;
        padding-block: 24px;
    }
    .hnd-landing-header {
        margin-bottom: 24px;
    }
    .hnd-landing-copy {
        max-width: none;
        margin-bottom: 22px;
    }
    .hnd-login-card {
        max-width: none;
        margin-inline: 0;
    }
    .hnd-login-assurances {
        max-width: none;
        margin-inline: 0;
    }
    .hnd-landing-title {
        font-size: 1.75rem;
    }
    .hnd-landing-intro-column {
        margin-top: 4px;
    }
}
@media (max-width: 599px) {
    .hnd-landing-header .mud-typography-caption {
        display: none;
    }
    .hnd-landing-visual img {
        aspect-ratio: 16 / 10;
        object-position: center;
    }
    .hnd-process-strip {
        grid-template-columns: 1fr;
        padding-block: 4px;
    }
    .hnd-process-step {
        padding: 14px 4px;
    }
    .hnd-process-step + .hnd-process-step {
        border-inline-start: 0;
        border-top: 1px solid var(--mud-palette-divider);
    }
}
@media (max-height: 700px) {
    .hnd-login-layout {
        align-items: flex-start;
    }
}
@media (min-width: 960px) {
    .hnd-login-column { order: 1; }
    .hnd-landing-intro-column { order: 2; }
}
.hnd-persian-date-picker {
    width: min(296px, calc(100vw - 32px));
    direction: rtl;
}

/* ══════════════════════════════════════════════════════════════
   OFFICE RANKING TABLE (referral selection)
   ══════════════════════════════════════════════════════════════ */
.recommended-row .mud-table-cell {
    background: var(--mud-palette-success-hover) !important;
}
.selected-row .mud-table-cell {
    background: var(--mud-palette-primary-hover) !important;
    font-weight: 600 !important;
}
.mud-table-row-disabled .mud-table-cell {
    opacity: 0.45;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 960px) {
    .mud-main-content {
        width: calc(100% - var(--mud-drawer-width-right, 240px));
        max-width: calc(100% - var(--mud-drawer-width-right, 240px));
        margin-right: var(--mud-drawer-width-right, 240px) !important;
        margin-left: 0 !important;
    }
    .mud-drawer--closed ~ .mud-main-content,
    .mud-drawer-close ~ .mud-main-content {
        width: 100%;
        max-width: 100%;
        margin-right: 0 !important;
    }
}
@media (max-width: 959px) {
    .mud-main-content {
        width: 100%;
        max-width: 100%;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* جداول عریض باید در محدوده خودشان اسکرول شوند، نه در کل صفحه. */
.mud-table-container {
    max-width: 100%;
    overflow-x: auto;
}
.mud-data-grid {
    min-width: 0;
    max-width: 100%;
}
.mud-grid-item {
    min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
