/* Zahab Glass ERP — shared professional UI */

:root {
    --erp-brand: #2f6d93;
    --erp-brand-dark: #245a78;
    --erp-brand-light: #eaf3f8;
    --erp-border: #e2e8f0;
    --erp-text: #334155;
    --erp-muted: #64748b;
    --erp-success: #059669;
    --erp-danger: #dc2626;
    --erp-radius: 12px;
    --erp-shadow: 0 4px 14px rgba(47, 109, 147, 0.08);
}

.erp-footer {
    background: #fff;
    border-top: 1px solid var(--erp-border);
    padding: 0.85rem 1.5rem;
    font-size: 0.875rem;
    color: var(--erp-muted);
}

.erp-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
}

.erp-footer-brand {
    font-weight: 600;
    color: var(--erp-text);
    margin-left: 0.35rem;
}

.erp-footer-muted {
    opacity: 0.75;
    margin-right: 0.25rem;
}

.erp-footer-link {
    color: var(--erp-brand);
    font-weight: 700;
    text-decoration: none;
}

.erp-footer-link:hover {
    color: var(--erp-brand-dark);
}

.erp-online-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--erp-brand-light);
    color: var(--erp-brand-dark);
    border: 1px solid rgba(47, 109, 147, 0.15);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

html[data-theme="dark"] .erp-online-pill,
html[data-theme="dark"] .erp-online-pill strong,
html[data-theme="dark"] .erp-online-pill span:not(.erp-online-dot) {
    color: #ffffff !important;
}

html[data-theme="dark"] .erp-online-pill {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

.erp-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--erp-success);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
    animation: erp-pulse 2s infinite;
}

@keyframes erp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

#modern-app-header .header-center-meta {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

@media (min-width: 992px) {
    #modern-app-header .header-center-meta {
        display: flex;
    }
}

#modern-app-header .header-page-chip {
    background: var(--erp-brand-light);
    color: var(--erp-brand-dark);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 700;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#modern-app-header .header-online-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid var(--erp-border);
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--erp-text);
}

#modern-app-header .header-online-chip .erp-online-dot {
    width: 7px;
    height: 7px;
}

.task-group-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.25rem;
}

.task-group-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.task-group-badge,
.task-group-piece,
.task-group-customer,
.task-group-date,
.task-group-delivery,
.task-group-project {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--erp-border);
    color: var(--erp-text);
}

.task-group-badge {
    background: var(--erp-brand-light);
    color: var(--erp-brand-dark);
    border-color: rgba(47, 109, 147, 0.2);
}

.task-group-date i,
.task-group-delivery i,
.task-group-project i {
    color: var(--erp-brand);
    font-size: 0.75rem;
}

.task-group-delivery {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.task-group-project {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

tr.task-group-header td {
    background: linear-gradient(90deg, #f8fafc 0%, #fff 100%) !important;
    border-top: 2px solid var(--erp-brand-light) !important;
    border-bottom: 1px solid var(--erp-border) !important;
}

.oh-segment.oh-dates,
.oh-segment.oh-project {
    min-width: 120px;
}

.oh-segment.oh-dates .oh-seg-value,
.oh-segment.oh-project .oh-seg-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--erp-text);
}

.oh-segment.oh-project .oh-seg-value {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fv-kpi-investment {
    background: linear-gradient(135deg, #1e3a5f 0%, var(--erp-brand) 100%);
    color: #fff;
}

.fv-kpi-investment .fv-kpi-label,
.fv-kpi-investment small {
    color: rgba(255, 255, 255, 0.85);
}

.fv-kpi-investment .fv-kpi-value {
    color: #fff;
}

[dir="rtl"] .erp-footer-brand {
    margin-left: 0;
    margin-right: 0.35rem;
}

[dir="rtl"] #modern-app-header .profile-info {
    text-align: right !important;
    margin-left: 0 !important;
    margin-right: 10px !important;
}

/* Layout stability — prevent double offset from legacy style.css */
.section-container,
.admin-wrapper .section-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.section-container.active {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (min-width: 1151px) {
    [dir="ltr"] .section-container,
    [dir="ltr"] .section-container.active {
        margin-left: var(--sidebar-width, 300px) !important;
        width: calc(100% - var(--sidebar-width, 300px)) !important;
        max-width: calc(100% - var(--sidebar-width, 300px)) !important;
    }

    [dir="rtl"] .section-container,
    [dir="rtl"] .section-container.active {
        margin-right: var(--sidebar-width, 300px) !important;
        margin-left: 0 !important;
        width: calc(100% - var(--sidebar-width, 300px)) !important;
        max-width: calc(100% - var(--sidebar-width, 300px)) !important;
    }

    body.sidebar-collapsed [dir="ltr"] .section-container {
        margin-left: var(--sidebar-width-collapsed, 80px) !important;
        width: calc(100% - var(--sidebar-width-collapsed, 80px)) !important;
        max-width: calc(100% - var(--sidebar-width-collapsed, 80px)) !important;
    }

    body.sidebar-collapsed [dir="rtl"] .section-container {
        margin-right: var(--sidebar-width-collapsed, 80px) !important;
        width: calc(100% - var(--sidebar-width-collapsed, 80px)) !important;
        max-width: calc(100% - var(--sidebar-width-collapsed, 80px)) !important;
    }
}

main.main-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Dark mode */
html[data-theme="dark"] body {
    background-color: #0f172a;
    color: #e2e8f0;
}

html[data-theme="dark"] .section-container,
html[data-theme="dark"] main.main-content {
    background: #0f172a;
    color: #e2e8f0;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .production-card,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .assign-role-card {
    background: #1e293b !important;
    color: #e2e8f0;
    border-color: #334155 !important;
}

html[data-theme="dark"] .erp-footer {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

html[data-theme="dark"] .erp-footer-brand {
    color: #f1f5f9;
}

html[data-theme="dark"] #modern-app-header.main-header-section {
    background-color: rgba(30, 41, 59, 0.95) !important;
    border-bottom-color: #334155 !important;
}

html[data-theme="dark"] #modern-app-header .sidebar-opener,
html[data-theme="dark"] #modern-app-header .profile-pill-btn,
html[data-theme="dark"] #modern-app-header .header-online-chip {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] #modern-app-header .icon-box {
    background: #334155 !important;
    color: #7dd3fc !important;
}

html[data-theme="dark"] .table {
    --bs-table-bg: #1e293b;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: #334155;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .erp-theme-icon-dark { display: none !important; }
html[data-theme="dark"] .erp-theme-icon-light { display: inline-block !important; }
html[data-theme="light"] .erp-theme-icon-light { display: none !important; }

/* Dark mode — global page surfaces */
html[data-theme="dark"] {
    --erp-page-bg: #0f172a;
    --erp-surface: #1e293b;
    --erp-surface-2: #334155;
    --erp-border: #475569;
    --erp-text: #e2e8f0;
    --erp-text-muted: #94a3b8;
}

html[data-theme="dark"] .text-muted {
    color: var(--erp-text-muted) !important;
}

html[data-theme="dark"] .main-card,
html[data-theme="dark"] .erp-table-section,
html[data-theme="dark"] .order-top-panel,
html[data-theme="dark"] .bulk-table-wrapper,
html[data-theme="dark"] .action-process-section,
html[data-theme="dark"] .processes-panel,
html[data-theme="dark"] .summary-panel {
    background: var(--erp-surface) !important;
    border-color: var(--erp-border) !important;
    color: var(--erp-text) !important;
}

html[data-theme="dark"] .erp-table-section {
    background: var(--erp-page-bg) !important;
}

html[data-theme="dark"] .order-top-panel label,
html[data-theme="dark"] .processes-panel-header,
html[data-theme="dark"] .summary-panel-header,
html[data-theme="dark"] .action-process-header {
    color: var(--erp-text-muted) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .size-input,
html[data-theme="dark"] .qty-input-field,
html[data-theme="dark"] .remarks-input {
    background: #0f172a !important;
    border-color: var(--erp-border) !important;
    color: var(--erp-text) !important;
}

html[data-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

html[data-theme="dark"] #erp-table tbody td {
    border-color: #334155;
    color: var(--erp-text);
}

html[data-theme="dark"] #erp-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] #erp-table tbody tr:hover {
    background: rgba(47, 109, 147, 0.18) !important;
}

html[data-theme="dark"] .summary-table td {
    border-color: #334155;
    color: var(--erp-text);
}

html[data-theme="dark"] .summary-table .label-cell {
    color: var(--erp-text-muted);
}

html[data-theme="dark"] .glass-config-step {
    background: #0f172a;
    border-color: #475569;
}

html[data-theme="dark"] .glass-config-modal .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}

html[data-theme="dark"] .glass-config-modal .modal-footer {
    border-top-color: #334155;
}

html[data-theme="dark"] .process-item-card {
    background: #0f172a;
    border-color: #475569;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #2f6d93;
}
