/* ============================================
   PO WORKSPACE DARK MODE STYLES
   This file provides comprehensive dark mode 
   support for the Purchase Order workspace.
   ============================================ */

/* ============================================
   SIDEBAR STYLES
   ============================================ */

/* Sidebar container */
[data-theme="dark"] .po-sidebar {
    background-color: #16191c !important;
    border-right-color: #2d3238 !important;
}

/* Filters and dropdowns in sidebar */
[data-theme="dark"] .po-sidebar .form-select,
[data-theme="dark"] .po-sidebar .form-control {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-sidebar .form-select option {
    background-color: #1c1f23 !important;
    color: #e2e8f0 !important;
}

/* Cost Center header groups */
[data-theme="dark"] .cc-header,
[data-theme="dark"] .cc-header.bg-light {
    background-color: #1e2227 !important;
    border-bottom-color: #2d3238 !important;
}

[data-theme="dark"] .cc-header strong {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .cc-header .toggle-icon {
    color: #94a3b8 !important;
}

/* PO List Items */
[data-theme="dark"] .po-list-item {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
}

[data-theme="dark"] .po-list-item:hover {
    background-color: #252a30 !important;
}

[data-theme="dark"] .po-list-item.active {
    background-color: #1a2332 !important;
    border-left-color: #3b82f6 !important;
}

[data-theme="dark"] .po-list-item.text-dark,
[data-theme="dark"] .po-list-item .text-dark {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-list-item .text-muted {
    color: #94a3b8 !important;
}

/* PO sub-items list */
[data-theme="dark"] .po-items-list {
    background-color: #14171a !important;
}

[data-theme="dark"] .po-sub-item {
    color: #94a3b8 !important;
}

[data-theme="dark"] .po-sub-item .text-muted {
    color: #94a3b8 !important;
}

/* CC content area */
[data-theme="dark"] .cc-content {
    background-color: transparent !important;
}

[data-theme="dark"] .cc-group {
    border-color: #2d3238 !important;
}

/* ============================================
   MAIN DETAIL PANEL STYLES
   ============================================ */

/* Detail panel container */
[data-theme="dark"] .po-detail-panel {
    background-color: #121417 !important;
}

/* Cards */
[data-theme="dark"] .po-detail-panel .card,
[data-theme="dark"] #po-detail-container .card {
    background-color: #16191c !important;
    border-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .card-header,
[data-theme="dark"] #po-detail-container .card-header,
[data-theme="dark"] .card-header.bg-white {
    background-color: #1c1f23 !important;
    border-bottom-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .card-body,
[data-theme="dark"] #po-detail-container .card-body {
    background-color: #16191c !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .card-header h4,
[data-theme="dark"] #po-detail-container .card-header h4 {
    color: #e2e8f0 !important;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

[data-theme="dark"] .po-detail-panel .form-control,
[data-theme="dark"] #po-detail-container .form-control,
[data-theme="dark"] .po-detail-panel .form-select,
[data-theme="dark"] #po-detail-container .form-select {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .form-control:focus,
[data-theme="dark"] #po-detail-container .form-control:focus,
[data-theme="dark"] .po-detail-panel .form-select:focus,
[data-theme="dark"] #po-detail-container .form-select:focus {
    background-color: #252a30 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
}

[data-theme="dark"] .po-detail-panel .form-control::placeholder,
[data-theme="dark"] #po-detail-container .form-control::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .po-detail-panel .form-control[readonly],
[data-theme="dark"] #po-detail-container .form-control[readonly],
[data-theme="dark"] .form-control.bg-light {
    background-color: #14171a !important;
    border-color: #2d3238 !important;
    color: #94a3b8 !important;
}

/* Form labels */
[data-theme="dark"] .po-detail-panel .form-label,
[data-theme="dark"] #po-detail-container .form-label {
    color: #e2e8f0 !important;
}

/* Input groups */
[data-theme="dark"] .po-detail-panel .input-group-text,
[data-theme="dark"] #po-detail-container .input-group-text {
    background-color: #252a30 !important;
    border-color: #2d3238 !important;
    color: #94a3b8 !important;
}

/* ============================================
   TABLE STYLES
   ============================================ */

[data-theme="dark"] .po-detail-panel .table,
[data-theme="dark"] #po-detail-container .table {
    color: #e2e8f0 !important;
    border-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .table thead,
[data-theme="dark"] #po-detail-container .table thead,
[data-theme="dark"] .po-detail-panel .table-light,
[data-theme="dark"] #po-detail-container .table-light,
[data-theme="dark"] thead.table-light {
    background-color: #1e2227 !important;
}

[data-theme="dark"] .po-detail-panel .table thead th,
[data-theme="dark"] #po-detail-container .table thead th,
[data-theme="dark"] thead.table-light th {
    background-color: #1e2227 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .table tbody tr,
[data-theme="dark"] #po-detail-container .table tbody tr {
    border-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .table tbody td,
[data-theme="dark"] #po-detail-container .table tbody td {
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .table-hover tbody tr:hover,
[data-theme="dark"] #po-detail-container .table-hover tbody tr:hover {
    background-color: #252a30 !important;
}

/* Table footer / totals */
[data-theme="dark"] .po-detail-panel .table tfoot,
[data-theme="dark"] #po-detail-container .table tfoot,
[data-theme="dark"] tfoot.table-light {
    background-color: #1e2227 !important;
}

[data-theme="dark"] .po-detail-panel .table tfoot td,
[data-theme="dark"] #po-detail-container .table tfoot td,
[data-theme="dark"] tfoot.table-light td {
    background-color: #1e2227 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

/* Issued items styling */
[data-theme="dark"] .po-item-issued {
    background-color: #14171a !important;
    opacity: 0.8;
}

[data-theme="dark"] .po-item-issued td {
    background-color: #14171a !important;
    color: #94a3b8 !important;
}

/* ============================================
   TOOLBAR STYLES
   ============================================ */

[data-theme="dark"] .po-toolbar {
    background-color: #16191c !important;
    border-bottom-color: #2d3238 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-primary {
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-primary:hover {
    background-color: #1e3a5f !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-dark,
[data-theme="dark"] #main-print-btn {
    color: #ffffff !important;
    border-color: #4b5563 !important;
    background-color: #374151 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-dark i,
[data-theme="dark"] #main-print-btn i {
    color: #ffffff !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-dark:hover,
[data-theme="dark"] #main-print-btn:hover {
    background-color: #4b5563 !important;
    border-color: #6b7280 !important;
}

[data-theme="dark"] .po-toolbar .btn-saas-danger,
[data-theme="dark"] #main-cancel-btn {
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    background-color: transparent !important;
}

[data-theme="dark"] .po-toolbar .btn-saas-danger i,
[data-theme="dark"] #main-cancel-btn i {
    color: #ffffff !important;
}

[data-theme="dark"] .po-toolbar .btn-saas-primary,
[data-theme="dark"] #top-new-po-btn {
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    background-color: transparent !important;
}

[data-theme="dark"] .po-toolbar .btn-saas-primary i,
[data-theme="dark"] #top-new-po-btn i {
    color: #ffffff !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #4b5563 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-secondary:hover {
    background-color: #374151 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-success {
    color: #4ade80 !important;
    border-color: #22c55e !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-success:hover {
    background-color: #14532d !important;
    color: #86efac !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-danger {
    color: #f87171 !important;
    border-color: #ef4444 !important;
}

[data-theme="dark"] .po-toolbar .btn-outline-danger:hover {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

/* ============================================
   TOTALS BAR
   ============================================ */

[data-theme="dark"] .po-totals-bar {
    background-color: #16191c !important;
    border-top-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-totals-bar strong {
    color: #e2e8f0 !important;
}

/* ============================================
   MODALS
   ============================================ */

[data-theme="dark"] .po-detail-panel .modal-content,
[data-theme="dark"] #po-detail-container .modal-content,
[data-theme="dark"] #addSupplierModal .modal-content,
[data-theme="dark"] #itemNotesModal .modal-content {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .modal-header,
[data-theme="dark"] #po-detail-container .modal-header,
[data-theme="dark"] #addSupplierModal .modal-header,
[data-theme="dark"] #itemNotesModal .modal-header {
    background-color: #16191c !important;
    border-bottom-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .modal-footer,
[data-theme="dark"] #po-detail-container .modal-footer,
[data-theme="dark"] #addSupplierModal .modal-footer,
[data-theme="dark"] #itemNotesModal .modal-footer {
    background-color: #16191c !important;
    border-top-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .modal-title,
[data-theme="dark"] #po-detail-container .modal-title,
[data-theme="dark"] #addSupplierModal .modal-title,
[data-theme="dark"] #itemNotesModal .modal-title {
    color: #e2e8f0 !important;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */

[data-theme="dark"] .po-detail-panel .dropdown-menu,
[data-theme="dark"] #po-detail-container .dropdown-menu,
[data-theme="dark"] .po-sidebar .dropdown-menu {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
}

[data-theme="dark"] .po-detail-panel .dropdown-item,
[data-theme="dark"] #po-detail-container .dropdown-item,
[data-theme="dark"] .po-sidebar .dropdown-item {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel .dropdown-item:hover,
[data-theme="dark"] #po-detail-container .dropdown-item:hover,
[data-theme="dark"] .po-sidebar .dropdown-item:hover {
    background-color: #252a30 !important;
    color: #ffffff !important;
}

/* ============================================
   TEXT UTILITIES OVERRIDE
   ============================================ */

[data-theme="dark"] .po-detail-panel .text-muted,
[data-theme="dark"] #po-detail-container .text-muted,
[data-theme="dark"] .po-sidebar .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .po-detail-panel .text-dark,
[data-theme="dark"] #po-detail-container .text-dark {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .po-detail-panel small,
[data-theme="dark"] #po-detail-container small {
    color: #94a3b8 !important;
}

[data-theme="dark"] .po-detail-panel strong,
[data-theme="dark"] #po-detail-container strong {
    color: #e2e8f0 !important;
}

/* ============================================
   BACKGROUND UTILITIES OVERRIDE  
   ============================================ */

[data-theme="dark"] .po-detail-panel .bg-white,
[data-theme="dark"] #po-detail-container .bg-white {
    background-color: #1c1f23 !important;
}

[data-theme="dark"] .po-detail-panel .bg-light,
[data-theme="dark"] #po-detail-container .bg-light {
    background-color: #16191c !important;
}

[data-theme="dark"] .po-sidebar .bg-white {
    background-color: #1c1f23 !important;
}

[data-theme="dark"] .po-sidebar .bg-light {
    background-color: #1e2227 !important;
}

/* ============================================
   BORDER UTILITIES OVERRIDE
   ============================================ */

[data-theme="dark"] .po-detail-panel .border,
[data-theme="dark"] #po-detail-container .border,
[data-theme="dark"] .po-detail-panel .border-bottom,
[data-theme="dark"] #po-detail-container .border-bottom {
    border-color: #2d3238 !important;
}

/* ============================================
   SHADOW ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .po-detail-panel .shadow-sm,
[data-theme="dark"] #po-detail-container .shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4) !important;
}

/* ============================================
   STATUS BADGES - maintain visibility
   ============================================ */

[data-theme="dark"] .status-badge-draft {
    background-color: #374151 !important;
    color: #d1d5db !important;
    border-color: #4b5563 !important;
}

[data-theme="dark"] .status-badge-issued {
    background-color: #14532d !important;
    color: #86efac !important;
    border-color: #166534 !important;
}

[data-theme="dark"] .status-badge-cancelled {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #991b1b !important;
}

/* Inline badge overrides for dark mode */
[data-theme="dark"] .po-list-item .badge[style*="background-color: #F8F9FA"],
[data-theme="dark"] .po-list-item .badge[style*="background-color: #f8f9fa"] {
    background-color: #374151 !important;
    color: #d1d5db !important;
    border-color: #4b5563 !important;
}

[data-theme="dark"] .card-header .badge[style*="background-color: #f8f9fa"] {
    background-color: #374151 !important;
    color: #d1d5db !important;
    border-color: #4b5563 !important;
}

/* ============================================
   NOTES AREA
   ============================================ */

[data-theme="dark"] #po-notes-section,
[data-theme="dark"] .po-notes-area {
    background-color: #16191c !important;
    border-color: #2d3238 !important;
}

[data-theme="dark"] #po-notes-section textarea,
[data-theme="dark"] .po-notes-area textarea {
    background-color: #1c1f23 !important;
    border-color: #2d3238 !important;
    color: #e2e8f0 !important;
}

/* ============================================
   CHECKBOX STYLING
   ============================================ */

[data-theme="dark"] .po-detail-panel .form-check-input,
[data-theme="dark"] #po-detail-container .form-check-input,
[data-theme="dark"] .po-sidebar .form-check-input {
    background-color: #1c1f23 !important;
    border-color: #4b5563 !important;
}

[data-theme="dark"] .po-detail-panel .form-check-input:checked,
[data-theme="dark"] #po-detail-container .form-check-input:checked,
[data-theme="dark"] .po-sidebar .form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* ============================================
   ICONS
   ============================================ */

[data-theme="dark"] .po-detail-panel .bi,
[data-theme="dark"] #po-detail-container .bi,
[data-theme="dark"] .po-sidebar .bi {
    color: inherit;
}

[data-theme="dark"] .po-sidebar .bi-chevron-down,
[data-theme="dark"] .po-sidebar .toggle-icon {
    color: #94a3b8 !important;
}

/* ============================================
   ALERT BOXES IN PO WORKSPACE
   ============================================ */

[data-theme="dark"] .po-detail-panel .alert,
[data-theme="dark"] #po-detail-container .alert {
    border-color: #2d3238 !important;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

[data-theme="dark"] .po-sidebar::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] .po-sidebar::-webkit-scrollbar-track {
    background: #16191c;
}

[data-theme="dark"] .po-sidebar::-webkit-scrollbar-thumb {
    background-color: #2d3238;
    border-radius: 4px;
}

[data-theme="dark"] .po-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #4b5563;
}

/* ============================================
   RESIZER HANDLE
   ============================================ */

[data-theme="dark"] .resizer {
    border-right-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .resizer:hover,
[data-theme="dark"] .resizing {
    border-right-color: #ff6600 !important;
    background: rgba(255, 102, 0, 0.2) !important;
}

/* ============================================
   EXPAND/COLLAPSE + - BUTTONS
   ============================================ */

[data-theme="dark"] .po-sidebar .btn.btn-xs {
    color: #ffffff !important;
    border-color: #4b5563 !important;
    background-color: #374151 !important;
}

[data-theme="dark"] .po-sidebar .btn.btn-xs:hover {
    color: #ffffff !important;
    border-color: #6b7280 !important;
    background-color: #4b5563 !important;
}

/* Copy/Paste buttons - keep orange accent */
[data-theme="dark"] .po-sidebar #global-copy-btn,
[data-theme="dark"] .po-sidebar #global-paste-btn {
    color: #ff6600 !important;
    border-color: #ff6600 !important;
    background-color: transparent !important;
}

[data-theme="dark"] .po-sidebar #global-copy-btn:hover,
[data-theme="dark"] .po-sidebar #global-paste-btn:hover {
    color: #ffffff !important;
    background-color: #ff6600 !important;
}
