/* iPro FB - Premium Light Theme (matching iPro ERP style) */

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f4f5f7;
}

h1:focus {
    outline: none;
}

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #00875a;
}

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

.validation-message {
    color: #de350b;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: #de350b;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Došlo je do greške. Osvežite stranicu."
}

/* Custom scrollbar - light theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f1f4;
}

::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* MudBlazor nav link overrides */
.mud-nav-link {
    border-radius: 6px !important;
    margin: 2px 4px !important;
}

.mud-nav-link:hover {
    background: #eceef2 !important;
}

.mud-nav-link.active {
    background: #deebff !important;
    color: #0052cc !important;
}

.mud-nav-link.active .mud-nav-link-icon {
    color: #0052cc !important;
}

/* Nav sidebar styles */
.nav-module > .mud-nav-group > .mud-nav-link {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1d23;
    padding-left: 12px !important;
}

.nav-module > .mud-nav-group > .mud-nav-link:hover {
    background-color: #f0f1f4;
}

.nav-module > .mud-nav-group > .mud-nav-link .mud-icon-root {
    font-size: 1.25rem;
    min-width: 24px;
}

.nav-page {
    font-size: 0.84rem;
    color: #374151;
}

.nav-page:hover {
    color: #1a1d23;
    background-color: #f0f1f4;
}

.nav-page.active {
    color: #0052cc;
    background-color: #deebff;
    font-weight: 500;
}

.nav-page .mud-nav-link-icon {
    font-size: 1.1rem !important;
    min-width: 24px;
    color: #6b7280;
}

.nav-page.active .mud-nav-link-icon {
    color: #0052cc;
}

.nav-page-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav indentation is now computed inline via RenderItems depth parameter */

.nav-group > .mud-nav-link {
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

.nav-group > .mud-nav-link .mud-icon-root {
    font-size: 1.1rem !important;
    min-width: 24px;
    color: #6b7280;
}

.mud-nav-group .mud-nav-link .mud-icon-button {
    padding: 4px;
}

.nav-module:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
    padding-bottom: 4px;
}

.nav-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

.nav-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.nav-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.nav-scroll-container::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 3px;
}

.nav-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: #a1a1a1;
}

/* Table styles */
.mud-table-row:hover {
    background: #eceef2 !important;
}

/* Compact Data Grid Styles */
.mud-table-cell {
    padding: 6px 12px !important;
}

.mud-table-head .mud-table-cell {
    padding: 8px 12px !important;
    font-size: 0.8rem;
    font-weight: 600;
}

.mud-table-body .mud-table-cell {
    font-size: 0.82rem;
}

.mud-table-row {
    height: auto !important;
}

.mud-table-head .mud-input-root-outlined {
    margin: 0 !important;
}

.mud-table-head .mud-input-outlined {
    padding: 4px 8px !important;
    font-size: 0.78rem;
}

.mud-table-cell .mud-icon-button {
    padding: 4px !important;
}

.mud-table-cell .mud-icon-root {
    font-size: 1rem;
}

.mud-table-pagination {
    padding: 4px 8px !important;
    font-size: 0.8rem;
}

.mud-table-pagination .mud-select {
    font-size: 0.8rem;
}

.mud-table-toolbar {
    padding: 8px 12px !important;
    min-height: 48px !important;
}

.mud-table {
    table-layout: auto;
}

.mud-table-container {
    overflow-x: auto;
}

/* Input focus */
.mud-input-outlined:focus-within {
    border-color: #0052cc !important;
}

/* Button styles */
.mud-button-filled-primary {
    box-shadow: none !important;
}

.mud-button-filled-primary:hover {
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.25) !important;
}

/* Quick animations */
.fade-in {
    animation: fadeIn 0.2s ease-out;
}

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

/* Monospace numbers */
.mono-numbers {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Page header */
.page-header {
    padding: 0 0 16px 0;
}

/* ReadOnly field styling */
.field-readonly .mud-input-root {
    background-color: #f7f8fa;
    border-color: #e0e0e0;
}

.field-readonly .mud-input-slot,
.field-readonly .mud-input-root input,
.field-readonly .mud-input-root textarea {
    color: #b0b0b0 !important;
    -webkit-text-fill-color: #b0b0b0 !important;
}

.field-readonly .mud-input-label {
    color: #aaa;
}

.field-readonly .mud-input-adornment-start .mud-icon-root {
    color: #c0c0c0;
    font-size: 0.95rem;
}

.field-readonly .mud-input-adornment-end .mud-icon-root {
    color: #c0c0c0;
}

/* Hide numeric spinners on readonly fields */
.field-readonly .mud-input-adornment-end button {
    display: none;
}

/* Lookup field styling — readonly input but with clickable search icon */
.field-lookup .mud-input-root {
    background-color: #f7f8fa;
    border-color: #e0e0e0;
}

.field-lookup .mud-input-slot,
.field-lookup .mud-input-root input {
    color: #555 !important;
    -webkit-text-fill-color: #555 !important;
}

.field-lookup .mud-input-label {
    color: #aaa;
}

/* MultiLookup container */
.multi-lookup-container {
    border: 1px solid rgba(0,0,0,0.23);
    border-radius: 4px;
    position: relative;
    transition: border-color 0.2s;
}
.multi-lookup-container:hover {
    border-color: rgba(0,0,0,0.87);
}
.multi-lookup-label {
    position: absolute;
    top: -9px;
    left: 10px;
    background: white;
    padding: 0 4px;
    color: rgba(0,0,0,0.6);
    font-size: 0.75rem !important;
}

/* Form group header */
.form-group-header {
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.3px;
}

/* Money colors */
.money-positive { color: #059669; }
.money-negative { color: #dc2626; }

/* Lookup modal - highlighted current row */
.mud-selected-item {
    background-color: #deebff !important;
}

.mud-selected-item:hover {
    background-color: #c3dafe !important;
}

/* Tree master list — article code badge */
.tree-master-code {
    display: inline-block;
    background: #f0f1f4;
    color: #0052cc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Tree node row */
.tree-node-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.tree-node-actions {
    display: flex;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.mud-treeview-item-content:hover .tree-node-actions {
    opacity: 1;
}

/* BOM explosion tree */
.bom-tree-prefix {
    font-family: 'Consolas', 'Courier New', monospace;
    white-space: pre;
    color: #9e9e9e;
    font-size: 0.82rem;
    line-height: 1;
}

.bom-ident {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.75rem;
    color: #757575;
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 3px;
}

/* ── Dashboard ─────────────────────────────────────── */

.dash-card {
    border-radius: 10px !important;
    border: 1px solid #e5e7eb;
    height: 100%;
    transition: box-shadow 0.15s ease;
}

.dash-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Section header */
.dash-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 2px solid #e5e7eb;
}

/* KPI card */
.dash-kpi {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.dash-kpi-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.dash-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.dash-kpi-sub {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 2px;
}

.dash-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Chart header */
.dash-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

/* Horizontal bar */
.dash-hbar-row {
    margin-bottom: 14px;
}

.dash-hbar-row:last-child {
    margin-bottom: 0;
}

.dash-hbar-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.dash-hbar-name {
    font-size: 0.82rem;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.dash-hbar-amount {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
}

.dash-hbar-track {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.dash-hbar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Quick actions grid */
.dash-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 960px) {
    .dash-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dash-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px !important;
    transition: all 0.15s ease;
}

.dash-action-tile:hover {
    border-color: #0052cc;
    background: #f0f4ff !important;
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.1);
}

.dash-action-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}

/* Empty state */
.dash-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* Currency rate cards */
.currency-card {
    border-radius: 8px !important;
    transition: all 0.2s;
}

.currency-card:hover {
    border-color: #0052cc !important;
    background-color: #f0f4ff !important;
}

/* MudChart override — tighter Y axis labels */
.dash-card .mud-chart-line .mud-chart-yaxis text,
.dash-card .mud-chart-bar .mud-chart-yaxis text {
    font-size: 11px;
}

.dash-card .mud-chart {
    overflow: visible;
}

/* Dashboard two-column layout (main + news sidebar) */
.dash-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1280px) {
    .dash-layout {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 960px) {
    .dash-layout {
        grid-template-columns: 1fr;
    }
}

/* News panel */
.dash-news-panel {
    min-width: 0;
}

.dash-news-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

.dash-news-item {
    display: block;
    padding: 10px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.dash-news-item:hover {
    background: #f0f4ff;
}

.dash-news-item:last-child {
    border-bottom: none;
}

.dash-news-headline {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.82rem !important;
    color: #1a1d23;
}
