@import url('open.iconic/font/css/open-iconic-bootstrap.min.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('toolbar-large.css');

/* Override primary color from purple to navy blue */
:root {
    --bs-primary: #334575;
    --bs-primary-rgb: 51, 69, 117;
    --bs-link-color: #334575;
    --bs-link-color-rgb: 51, 69, 117;
    --bs-link-hover-color: #283659;
    --bs-link-hover-color-rgb: 40, 54, 89;
}

.bg-primary {
    background-color: #334575 !important;
}

.btn-primary {
    background-color: #334575;
    border-color: #334575;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #283659;
    border-color: #283659;
}

.btn-primary:active,
.btn-primary.active {
    background-color: #1e2a47;
    border-color: #1e2a47;
}

.btn-outline-primary {
    color: #334575;
    border-color: #334575;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #334575;
    border-color: #334575;
    color: #fff;
}

.text-primary {
    color: #334575 !important;
}

/* Override DevExpress primary button colors */
.dxbl-btn-primary {
    background-color: #334575 !important;
    border-color: #334575 !important;
}

.dxbl-btn-primary:hover,
.dxbl-btn-primary:focus {
    background-color: #283659 !important;
    border-color: #283659 !important;
}

/* Override DevExpress focused/active accents */
.dxbl-focused,
.dxbl-active {
    --dxbl-focus-color: #334575;
}

/* Override nav-pills active background (TreeView selected node) */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: #3f5494 !important;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    overflow: hidden;
}

/* ?? Global lean typography ?? */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

label, .form-label {
    font-weight: 500;
    font-size: 0.875rem;
}

input, select, textarea, .form-control, .form-select {
    font-family: inherit;
    font-size: 0.875rem;
}

table, .dxbl-grid {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.dxbl-grid .dxbl-grid-header-content {
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.dxbl-grid td {
    font-size: 0.875rem;
    font-weight: 400;
}

.btn, .dxbl-btn {
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.dxbl-tabs {
    font-family: inherit;
    font-weight: 600;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

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

/* DxGrid popup edit form sizing */
.pw-800 {
    width: min(920px, 95vw);
}

.pw-800 .dxbl-grid-edit-form-body {
    padding: 1.5rem 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.pw-800 .dxbl-grid-edit-form-body .dxbl-fl-ctrl {
    margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
    .pw-800 .dxbl-grid-edit-form-body {
        padding: 1rem;
    }
}

.pw-1100 {
    width: min(1100px, 95vw);
}

.pw-1100 .dxbl-grid-edit-form-body {
    padding: 1.5rem 2rem;
    max-height: 75vh;
    overflow-y: auto;
}

.pw-1100 .dxbl-grid-edit-form-body .dxbl-fl-ctrl {
    margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
    .pw-1100 {
        width: 95vw;
    }
    .pw-1100 .dxbl-grid-edit-form-body {
        padding: 1rem;
    }
}

/* Grid action buttons (edit / delete icons) */
.grid-action-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.btn-grid-action {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    color: #6c757d;
    transition: all 0.15s;
}

.btn-grid-action:hover {
    background-color: #f0f0f0;
    border-color: #dee2e6;
}

.btn-grid-edit:hover {
    color: #0d6efd;
}

.btn-grid-copy:hover {
    color: #198754;
}

.btn-grid-delete:hover {
    color: #dc3545;
}

.btn-grid-notes:hover {
    color: #6f42c1;
}

/* Right-align numeric grid columns */
.text-right {
    text-align: right !important;
}

/* Document totals */
.doc-totals {
    font-size: 0.7rem;
    border-collapse: collapse;
    border: none !important;
}

.doc-totals tr {
    border: none !important;
}

.doc-totals th,
.doc-totals td {
    padding: 0.05rem 0.3rem;
    border: none !important;
    line-height: 1.3;
}

.doc-totals .doc-total-grand {
    font-size: 1.05rem;
}

.doc-totals .doc-total-grand th,
.doc-totals .doc-total-grand td {
    padding-top: 0.25rem;
    border-top: 2px solid #333 !important;
}

.doc-totals .doc-total-tax-detail td {
    font-size: 0.65rem;
    padding: 0rem 0.3rem;
    font-weight: 400;
    color: #666;
    line-height: 1.2;
}

/* Document line edit popup sizing */
.line-edit-popup {
    width: min(1100px, 95vw) !important;
}

.line-edit-popup .dxbl-popup-body {
    padding: 1.5rem 2rem;
    min-height: 380px;
}

@media (max-width: 768px) {
    .line-edit-popup .dxbl-popup-body {
        padding: 1rem;
    }
}

/* ?? Icon-only action buttons (detail forms) ?? */
.detail-actions {
    display: flex;
    justify-content: flex-start !important;
    gap: 6px;
    align-items: center;
    margin-right: auto;
    width: fit-content;
}

.detail-actions .dxbl-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 1.05rem;
    border-radius: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.detail-actions .dxbl-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Sidebar (DevExpress TreeView) typography */
.app-sidebar,
.app-sidebar .dx-treeview,
.app-sidebar .dx-treeview-node,
.app-sidebar .dx-treeview-item,
.app-sidebar .dx-treeview-item-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

/* Slightly lighter weight for child items */
.app-sidebar .dx-treeview .dx-treeview-node .dx-treeview-item .dx-treeview-item-text {
    font-weight: 500;
}

/* Improve spacing and alignment with icons */
.app-sidebar .dx-treeview .dx-treeview-item {
    padding: 8px 12px;
}

.app-sidebar .dx-treeview .dx-treeview-item .dx-icon {
    margin-right: 10px;
}

/* Στυλ toolbar */
.dxbl-toolbar {
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
}

/* Separator ορατός στο toolbar */
.dxbl-toolbar .dxbl-toolbar-separator {
    background-color: #c0c0c0 !important;
    width: 1px !important;
    min-height: 1.5rem;
    margin: 0 0.5rem;
}

/* Λιγότερο στρογγυλά κουμπιά στο toolbar */
.dxbl-toolbar .dxbl-btn {
    border-radius: 4px !important;
    margin-right: 0.4rem;
}

/* myDATA transmission indicator (header) */
.header-sync-dropdown {
    position: relative;
}

.header-sync {
    font-size: 0.85rem;
    color: #888;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s;
}

.header-sync:hover {
    color: #555;
}

.header-sync.has-pending {
    color: #856404;
}

.header-sync.transmitting {
    color: #0d6efd;
}

.header-sync.transmitting .oi {
    animation: mydata-pulse 1.5s ease-in-out infinite;
}

.header-sync-badge {
    display: inline-block;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
    vertical-align: middle;
}

.header-sync-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.35rem;
    min-width: 14rem;
    z-index: 1050;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 0.25rem 0;
}

/* ??? Document Import Grid ??? */
.import-grid td {
    padding: 0.15rem 0.25rem;
    vertical-align: middle;
}

.import-grid .import-cell {
    font-size: 0.8rem;
}

/* ??? Document Preview Side Panel ??? */
.preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1040;
}

.preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.preview-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.preview-panel-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

    .preview-panel-close:hover {
        color: #333;
    }

.preview-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Lines table inside preview panel */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

    .preview-table th {
        background: #f5f5f5;
        font-weight: 600;
        font-size: 11px;
        color: #555;
        padding: 5px 8px;
        border-bottom: 1px solid #ccc;
        white-space: nowrap;
    }

    .preview-table td {
        padding: 4px 8px;
        border-bottom: 1px solid #eee;
        white-space: nowrap;
    }

/* Totals table inside preview panel */
.preview-totals {
    border-collapse: collapse;
    font-size: 13px;
    min-width: 200px;
}

    .preview-totals td {
        padding: 2px 8px;
    }

    .preview-totals tr:last-child td {
        border-top: 1px solid #999;
        padding-top: 4px;
    }

.import-grid .dxbl-combobox,
.import-grid .dxbl-date-edit,
.import-grid .dxbl-spin-edit,
.import-grid .dxbl-text-box {
    min-width: 0;
}

.header-sync-dropdown .dropdown-item-text {
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
}

/* ?? Generic header dropdown backdrop (used by subscription/company/sync) ?? */
.dropdown-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1040;
}

/* ?? Dashboard ?? */
.dashboard-card {
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    transition: box-shadow .2s, transform .2s;
}

.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

.dashboard-grid {
    font-size: 0.875rem;
}

@keyframes mydata-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Document preview drawer (sliding panel from right) */
.doc-preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1040;
}

.doc-preview-drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease-in-out;
}

.doc-preview-drawer.open {
    right: 0;
}

.doc-preview-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
}

.doc-preview-drawer-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Prevent DxMemo / textarea overflow in form layout groups */
.dxbl-fl-group {
    overflow: hidden;
}

.dxbl-fl-group textarea {
    max-height: 200px;
    resize: vertical;
}

/* ?? Blazor reconnect modal ?? */
#blazor-reconnect-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blazor-reconnect-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.blazor-reconnect-dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    font-family: inherit;
    font-size: 1rem;
    min-width: 320px;
}

.blazor-reconnect-spinner {
    margin: 16px auto 0;
    width: 36px;
    height: 36px;
    border: 4px solid #e0e0e0;
    border-top-color: #334575;
    border-radius: 50%;
    animation: blazor-spin 0.8s linear infinite;
}

@keyframes blazor-spin {
    to { transform: rotate(360deg); }
}

/* ?? License Status Badge ??????????????????????????????????? */
.license-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.license-badge:hover { opacity: 0.85; text-decoration: none; }

.license-badge--ok      { background: #d1f0da; color: #155724; border: 1px solid #b8dfc5; }
.license-badge--info    { background: #d0eaff; color: #004085; border: 1px solid #b6d4f5; }
.license-badge--warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.license-badge--danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }


/* Form / group header / accordion styling -- make titles thinner and more visible */
/* Target common DevExpress/fieldset/formlayout header class names and a few generic patterns */
.dx-formlayout-group .dx-formlayout-group-caption,
.dx-formlayout-group .dx-caption,
.dx-form-layout-group .dx-form-layout-group-caption,
.dx-fieldset .dx-fieldset-caption,
.dx-card .card-header,
.dxbl-fl-group > .dxbl-fl-group-header,
.dxbl-fl-group .dxbl-fl-group-caption,
.form-section-header,
.form-group-header {
    font-weight: 500 !important; /* lighter than headings */
    color: #2b4f7a !important;   /* more contrast, navy-ish */
    background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%) !important;
    border: 1px solid rgba(51,69,117,0.06) !important;
    padding: 10px 14px !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

/* Make the small descriptive text under the caption slightly dimmer */
.dx-formlayout-group .dx-formlayout-group-caption + .dx-formlayout-group-caption-subtext,
.dx-formlayout-group .dx-caption + .caption-subtext,
.dxbl-fl-group .subtext {
    color: #6d7785 !important;
    font-weight: 400 !important;
    font-size: 0.85rem !important;
}

/* Icon box on the left of headers (when present) */
.dx-formlayout-group .dx-icon,
.dxbl-fl-group .group-icon,
.dx-card .card-header .oi {
    background: #ffffff !important;
    color: #234a6b !important;
    border: 1px solid rgba(51,69,117,0.08) !important;
    border-radius: 6px !important;
    padding: 8px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}

/* Slightly increase spacing between groups so headers stand out */
.dx-formlayout-group,
.dxbl-fl-group,
.form-section {
    margin-bottom: 12px !important;
}

/* Additional broad overrides for DevExpress / card / accordion headers */
/* Use high specificity so theme rules are overridden */
.content .dx-formlayout-group-caption,
.content .dx-formlayout-caption,
.content .dx-form-layout-group-caption,
.content .dx-card-header,
.content .card-header,
.content .dx-accordion-item-header,
.content .dx-accordion-item .dx-accordion-item-header,
.content .dx-accordion .dx-accordion-item-header,
.content .dx-panel-header,
.content .dx-panel .dx-panel-header,
.content .dx-fieldset .dx-fieldset-caption,
.content .fieldset-caption,
.content .group-header,
.content .group-title,
.content .form-section-header,
.content .form-group-header,
.content .dxbl-fl-group-header {
    font-weight: 500 !important;
    color: #234a6b !important;
    background: linear-gradient(180deg,#ffffff 0%,#f7fbff 100%) !important;
    border-color: rgba(51,69,117,0.08) !important;
}

/* Ensure the small subtext is subdued */
.content .dx-formlayout-group-caption + .dx-formlayout-group-subtext,
.content .dx-caption + .caption-subtext,
.content .group-subtext,
.content .caption-subtext {
    color: #6d7785 !important;
    font-weight: 400 !important;
}

/* Make the left icon container consistent and visible */
.content .dx-accordion-item-header .dx-icon,
.content .dx-formlayout-group .dx-icon,
.content .dx-card-header .dx-icon,
.content .dxbl-fl-group-header .dx-icon {
    background: #fff !important;
    color: #234a6b !important;
    border: 1px solid rgba(51,69,117,0.08) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}

