/* ===============================================
   ProcMia - Global Styles
   =============================================== */

/* -- Design Tokens -- */
:root {
    --oecl-primary: #1565C0;
    --oecl-primary-dark: #0D47A1;
    --oecl-primary-light: #42A5F5;
    --oecl-secondary: #FF8F00;
    --oecl-success: #2E7D32;
    --oecl-danger: #C62828;
    --oecl-warning: #F57F17;
    --oecl-info: #0277BD;
    --oecl-bg: #F5F7FA;
    --oecl-surface: #FFFFFF;
    --oecl-text-primary: #212121;
    --oecl-text-secondary: #616161;
    --oecl-border: #E0E0E0;
    --oecl-radius: 8px;
    --oecl-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --oecl-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --oecl-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --oecl-transition: 0.2s ease;
}

/* -- Dark Mode Design Tokens -- */
.mud-theme-dark {
    --oecl-bg: #0F0F1A;
    --oecl-surface: #1A1A2E;
    --oecl-text-primary: #ECEFF1;
    --oecl-text-secondary: #90A4AE;
    --oecl-border: #263238;
    --oecl-shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --oecl-shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --oecl-shadow-hover: 0 8px 24px rgba(0,0,0,0.5);
    --oecl-primary: #64B5F6;
    --oecl-primary-dark: #42A5F5;
    --oecl-primary-light: #90CAF9;
}

/* -- Base -- */
html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--oecl-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1:focus { outline: none; }

/* -- Card Polish -- */
.mud-card {
    transition: box-shadow var(--oecl-transition), transform var(--oecl-transition) !important;
    border-radius: var(--oecl-radius) !important;
    box-shadow: var(--oecl-shadow-sm) !important;
}

.mud-card:hover {
    box-shadow: var(--oecl-shadow-md) !important;
}

.stat-card {
    cursor: pointer;
}

.stat-card:hover {
    box-shadow: var(--oecl-shadow-hover) !important;
    transform: translateY(-2px);
}

/* Dark mode cards - subtle border instead of shadow */
.mud-theme-dark .mud-card {
    border: 1px solid #263238 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.mud-theme-dark .mud-card:hover {
    border-color: #37474F !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

/* -- Card Header -- */
.mud-card-header {
    border-bottom: 1px solid var(--oecl-border);
}

/* -- DataGrid / Table Polish -- */
.mud-table-container {
    border-radius: var(--oecl-radius) !important;
}

.mud-table .mud-table-head .mud-table-cell {
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    letter-spacing: 0.5px;
    color: var(--oecl-text-secondary) !important;
    background: #FAFBFC !important;
    border-bottom: 2px solid var(--oecl-border) !important;
}

.mud-theme-dark .mud-table .mud-table-head .mud-table-cell {
    background: #16213E !important;
    color: #90A4AE !important;
}

.mud-table .mud-table-body .mud-table-row:hover {
    background-color: rgba(21, 101, 192, 0.04) !important;
}

.mud-theme-dark .mud-table .mud-table-body .mud-table-row:hover {
    background-color: rgba(100, 181, 246, 0.08) !important;
}

/* -- DataGrid Pagination -- */
.mud-table-pagination {
    border-top: 1px solid var(--oecl-border);
    padding: 8px 16px !important;
}

/* -- Status Chip -- */
.status-chip {
    text-transform: capitalize;
    font-weight: 500 !important;
    letter-spacing: 0.3px;
}

/* -- NavMenu -- */
.mud-nav-group .mud-nav-link {
    padding-left: 2rem !important;
}

/* ═══════════════════════════════════════════════
   THEMED NAV — Blue sidebar in light mode
   Force ALL text and icons to be light/visible
   ═══════════════════════════════════════════════ */
.themed-nav .nav-section-header {
    color: #B3D4FC !important;
    opacity: 0.8 !important;
}

/* All nav items text — includes sub-items */
.themed-nav .mud-nav-item .mud-list-item-text,
.themed-nav .mud-list-item .mud-list-item-text,
.themed-nav .mud-nav-link .mud-list-item-text,
.themed-nav .mud-list-item-text {
    color: #E3F2FD !important;
}

/* All nav item icons */
.themed-nav .mud-nav-item .mud-icon-root,
.themed-nav .mud-list-item .mud-icon-root,
.themed-nav .mud-nav-link .mud-icon-root,
.themed-nav .mud-icon-root {
    color: #90CAF9 !important;
}

/* Expand/collapse arrow icons */
.themed-nav .mud-expand-icon,
.themed-nav .mud-navmenu .mud-expand-icon {
    color: #90CAF9 !important;
}

/* Hover state */
.themed-nav .mud-list-item:hover,
.themed-nav .mud-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

.themed-nav .mud-list-item:hover .mud-list-item-text,
.themed-nav .mud-nav-link:hover .mud-list-item-text {
    color: #FFFFFF !important;
}

.themed-nav .mud-list-item:hover .mud-icon-root,
.themed-nav .mud-nav-link:hover .mud-icon-root {
    color: #FFFFFF !important;
}

/* Active nav link */
.themed-nav .mud-nav-link.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-left: 3px solid #FFB74D !important;
    font-weight: 700 !important;
}

.themed-nav .mud-nav-link.active .mud-list-item-text {
    color: #FFFFFF !important;
}

.themed-nav .mud-nav-link.active .mud-icon-root {
    color: #FFB74D !important;
}

.themed-nav .mud-nav-link.active:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
}

/* Active group parent highlight */
.themed-nav .mud-nav-group:has(.mud-nav-link.active) > .mud-list-item .mud-list-item-text {
    color: #FFFFFF !important;
    font-weight: 600 !important;
}

.themed-nav .mud-nav-group:has(.mud-nav-link.active) > .mud-list-item .mud-icon-root {
    color: #FFFFFF !important;
}

/* -- Page Header -- */
.page-header {
    margin-bottom: 1.5rem;
}

/* -- Breadcrumbs -- */
.mud-breadcrumbs {
    padding: 0 !important;
}

.mud-breadcrumbs .mud-breadcrumb-item {
    font-size: 0.8125rem;
}

/* -- Buttons -- */
.mud-button-root {
    border-radius: var(--oecl-radius) !important;
    transition: all var(--oecl-transition) !important;
}

/* -- Form fields -- */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--oecl-radius) !important;
}

.mud-select .mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--oecl-radius) !important;
}

/* -- Dialog -- */
.mud-dialog {
    border-radius: 12px !important;
}

.mud-dialog .mud-dialog-title {
    font-weight: 600;
}

/* -- Scrollbars (webkit) -- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A0A0A0;
}

.mud-theme-dark ::-webkit-scrollbar-thumb {
    background: #455A64;
}

.mud-theme-dark ::-webkit-scrollbar-thumb:hover {
    background: #546E7A;
}

/* -- Drawer -- */
.mud-drawer {
    border-right: none !important;
    box-shadow: none !important;
}

/* -- AppBar -- */
.mud-appbar {
    backdrop-filter: blur(8px);
}

/* -- Chip in table cells -- */
.mud-table .mud-chip {
    margin: 0 !important;
}

/* -- Alert -- */
.mud-alert {
    border-radius: var(--oecl-radius) !important;
}

/* -- Tabs -- */
.mud-tabs-header {
    border-bottom: 1px solid var(--oecl-border);
}

/* -- Page Transition -- */
.mud-main-content {
    animation: fadeIn 0.25s ease-out;
}

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

/* -- Snackbar -- */
.mud-snackbar {
    border-radius: var(--oecl-radius) !important;
}

/* -- Tooltip -- */
.mud-tooltip {
    border-radius: 6px !important;
}

/* -- Footer spacing -- */
.mud-appbar[style*="border-top"] {
    margin-top: auto;
}

/* -- Dark Mode Input Fields -- */
.mud-theme-dark .mud-input-outlined .mud-input-outlined-border {
    border-color: #37474F !important;
}

.mud-theme-dark .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #546E7A !important;
}

.mud-theme-dark .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: #64B5F6 !important;
}

/* -- Dark Mode Breadcrumbs -- */
.mud-theme-dark .mud-breadcrumbs .mud-breadcrumb-item {
    color: #90A4AE;
}

/* -- Dark Mode Pagination -- */
.mud-theme-dark .mud-table-pagination {
    border-top-color: #263238;
}

/* -- Dark Mode AppBar -- */
.mud-theme-dark .mud-appbar {
    border-bottom-color: rgba(255,255,255,0.06) !important;
}

/* -- Dark Mode Drawer -- */
.mud-theme-dark .mud-drawer {
    border-right: 1px solid rgba(255,255,255,0.06) !important;
}

/* ═══════════════════════════════════════
   RTL SUPPORT (Arabic, Hebrew, etc.)
   ═══════════════════════════════════════ */

/* Drawer */
[dir="rtl"] .mud-drawer {
    border-left: none !important;
    border-right: none !important;
}

[dir="rtl"] .mud-drawer--open-responsive-lg-left {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Nav link indent for sub-items */
[dir="rtl"] .mud-nav-group .mud-nav-link {
    padding-left: 16px !important;
    padding-right: 2.5rem !important;
}

/* Active link border */
[dir="rtl"] .themed-nav .mud-nav-link.active {
    border-left: none !important;
    border-right: 3px solid #FFB74D !important;
}

[dir="rtl"] .mud-theme-dark .mud-nav-link.active {
    border-left: none !important;
    border-right: 3px solid #FFB74D !important;
}

/* Stat cards */
[dir="rtl"] .stat-card {
    border-left: none !important;
}

/* Card header border */
[dir="rtl"] .mud-card-header {
    direction: rtl;
}

/* Table header alignment */
[dir="rtl"] .mud-table .mud-table-head .mud-table-cell {
    text-align: right !important;
}

/* MudMainContent RTL margin */
[dir="rtl"] .mud-main-content {
    margin-left: 0 !important;
}

/* Form fields */
[dir="rtl"] .mud-input {
    text-align: right;
}

[dir="rtl"] .mud-input-label {
    right: 14px;
    left: auto;
}

/* Buttons with icons */
[dir="rtl"] .mud-button-icon-start {
    margin-left: 8px;
    margin-right: -4px;
}

/* Breadcrumbs */
[dir="rtl"] .mud-breadcrumbs {
    direction: rtl;
}

/* Dialog */
[dir="rtl"] .mud-dialog .mud-dialog-content {
    text-align: right;
}

/* Alert */
[dir="rtl"] .mud-alert-message {
    text-align: right;
}

/* Login page RTL */
[dir="rtl"] .login-field label {
    text-align: right;
}

[dir="rtl"] .login-field .input-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .login-field .input-wrapper .field-icon {
    margin-right: 0;
    margin-left: 0.625rem;
}

[dir="rtl"] .login-actions {
    flex-direction: row-reverse;
}

/* Nav section headers */
[dir="rtl"] .nav-section-header {
    text-align: right;
    padding-right: 16px;
    padding-left: 16px;
}

/* ═══════════════════════════════════════
   DARK MODE FIXES
   ═══════════════════════════════════════ */

/* Fix error UI for dark mode */
.mud-theme-dark #blazor-error-ui {
    background: #263238;
    color: #CFD8DC;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.5);
}

/* Fix card border in dark mode */
.mud-theme-dark .mud-card-header {
    border-bottom-color: #263238;
}

/* Fix dialog in dark mode */
.mud-theme-dark .mud-dialog {
    background: #1A1A2E !important;
}

/* Fix expansion panels in dark mode */
.mud-theme-dark .mud-expand-panel {
    border-color: #263238 !important;
}

/* Fix paper elevation in dark mode */
.mud-theme-dark .mud-paper {
    background: #1A1A2E !important;
}

.mud-theme-dark .mud-paper[style*="border"] {
    border-color: #263238 !important;
}

/* Fix stat card hover in dark mode */
.mud-theme-dark .stat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

/* Fix tab headers in dark mode */
.mud-theme-dark .mud-tabs-header {
    border-bottom-color: #263238;
}

/* Fix chip in dark mode */
.mud-theme-dark .mud-chip.mud-chip-outlined {
    border-color: #37474F !important;
}

/* Fix select/autocomplete popover in dark mode */
.mud-theme-dark .mud-popover-paper {
    background: #1A1A2E !important;
    border: 1px solid #263238 !important;
}

.mud-theme-dark .mud-list-item:hover {
    background-color: rgba(100, 181, 246, 0.08) !important;
}

/* Fix menu in dark mode */
.mud-theme-dark .mud-menu .mud-list {
    background: #1A1A2E !important;
}

/* -- Error UI -- */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
}
