/* ===================================
   Enhanced Customer Portal Styles
   - Dark Mode Support with Bootstrap Variables
   - Well Drilling & Pump Industry Theme
   - Professional Proposal/Invoice Styling
   - Work Order Differentiation
   =================================== */

/* ===================================
   CSS Variables - Light Mode (Default)
   =================================== */
:root {
    /* Industry colors - water/earth tones */
    --industry-blue: #2E86AB;
    --industry-blue-dark: #1E5A7A;
    --industry-earth: #8B7355;
    --industry-water: #4A90E2;
    --industry-steel: #5A6C7D;
    
    /* Override Bootstrap variables for light mode */
    --bs-body-bg: #FAFBFC;
    --bs-body-color: #2C3E50;
    --bs-card-bg: #FFFFFF;
    --bs-border-color: #E1E4E8;
    
    /* Custom shadows */
    --custom-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --custom-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --custom-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.12);
}

/* ===================================
   Dark Mode Variables
   =================================== */
[data-theme="dark"] {
    /* Override Bootstrap variables for dark mode */
    --bs-body-bg: #0D1117 !important;
    --bs-body-color: #C9D1D9 !important;
    --bs-card-bg: #161B22 !important;
    --bs-border-color: #30363D !important;
    --bs-gray-100: #161B22 !important;
    --bs-gray-200: #1F2428 !important;
    --bs-gray-300: #30363D !important;
    --bs-gray-400: #484F58 !important;
    --bs-gray-500: #6E7681 !important;
    --bs-gray-600: #8B949E !important;
    --bs-gray-700: #B1BAC4 !important;
    --bs-gray-800: #C9D1D9 !important;
    --bs-gray-900: #F0F6FC !important;
    
    /* Adjust industry colors for dark mode */
    --industry-blue: #58A6FF;
    --industry-blue-dark: #388BFD;
    --industry-earth: #A68A6D;
    --industry-water: #79C0FF;
    --industry-steel: #8B949E;
    
    /* Dark mode shadows */
    --custom-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --custom-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --custom-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* ===================================
   Base Overrides
   =================================== */
body {
    background-color: #FAFBFC !important;
    color: #2C3E50 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
    background-color: #0D1117 !important;
    color: #C9D1D9 !important;
}

.container {
    background-color: #FFFFFF !important;
    border: 1px solid #E1E4E8 !important;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.12) !important;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    margin-bottom: 60px;
}

[data-theme="dark"] .container {
    background-color: #161B22 !important;
    border: 1px solid #30363D !important;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5) !important;
}

/* Ensure all text in container uses correct colors */
.container p,
.container span,
.container div,
.container label,
.container h1,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6,
.container dt,
.container dd {
    color: #2C3E50;
}

[data-theme="dark"] .container p,
[data-theme="dark"] .container span,
[data-theme="dark"] .container div,
[data-theme="dark"] .container label,
[data-theme="dark"] .container h1,
[data-theme="dark"] .container h2,
[data-theme="dark"] .container h3,
[data-theme="dark"] .container h4,
[data-theme="dark"] .container h5,
[data-theme="dark"] .container h6,
[data-theme="dark"] .container dt,
[data-theme="dark"] .container dd {
    color: #C9D1D9;
}

.print-button {
    display: block;
}

/* Links */
a {
    color: #2E86AB !important;
    text-decoration: none;
}

a:hover {
    color: #1E5A7A !important;
    text-decoration: underline;
}

[data-theme="dark"] a {
    color: #58A6FF !important;
}

[data-theme="dark"] a:hover {
    color: #79C0FF !important;
}

/* Text muted */
.text-muted {
    color: #6C757D !important;
}

[data-theme="dark"] .text-muted {
    color: #8B949E !important;
}

/* ===================================
   Professional Header
   =================================== */
.professional-header {
    background: linear-gradient(135deg, var(--industry-blue), var(--industry-blue-dark));
    color: white;
    padding: 30px;
    margin: -30px -30px 30px -30px;
    border-radius: 12px 12px 0 0;
}

.document-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
}

.document-type-badge i {
    font-size: 16px;
}

.header-content h1 {
    font-weight: 700;
    margin-bottom: 10px;
}

.company-from {
    font-size: 16px;
}




.industry-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
    margin-left: auto;
}

/* When showing logo instead of icon */
.industry-icon img {
    max-height: 60px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Fallback icon styling when no logo */
.industry-icon #headerFallbackIcon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 28px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .professional-header {
    background: linear-gradient(135deg, var(--industry-steel), var(--bs-gray-700));
}

/* ===================================
   Trust Banner (Simplified)
   =================================== */
.trust-banner {
    background: var(--bs-gray-100);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    border: 1px solid var(--bs-border-color);
}

[data-theme="dark"] .trust-banner {
    background: var(--bs-gray-200);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--bs-body-color);
}

.trust-item i {
    color: var(--industry-blue);
    font-size: 18px;
}

.trust-item a {
    color: inherit !important;
    text-decoration: underline;
    font-weight: 600;
}

.trust-item a:hover {
    color: var(--industry-blue) !important;
    text-decoration: underline;
}

[data-theme="dark"] .trust-item a:hover {
    color: #58A6FF !important;
}

/* ===================================
   Cards & Tables - Bootstrap Compatible
   =================================== */
/* Light mode card styles */
.card {
    background-color: #FFFFFF !important;
    border: 1px solid #E1E4E8 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    margin-bottom: 25px;
    border-radius: 10px;
    overflow: hidden;
}

.card * {
    color: #2C3E50 !important;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.card-header {
    background: linear-gradient(135deg, #2E86AB, #1E5A7A) !important;
    color: white !important;
    font-weight: 600;
    padding: 15px 20px;
    border-bottom: none !important;
}

.card-header * {
    color: white !important;
}

.card-body {
    background-color: #FFFFFF !important;
    color: #2C3E50 !important;
    padding: 25px !important;
}

/* Customer/Company Info Improvements */
.card-body .row {
    margin-bottom: 0;
}

.card-body dl {
    margin-bottom: 0;
}

.card-body dt {
    font-weight: 600;
    color: #6C757D !important;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.card-body dd {
    font-size: 16px;
    color: #2C3E50 !important;
    margin-bottom: 16px;
    font-weight: 500;
}

/* Verified Badge */
.badge.bg-success,
.verified-badge {
    background-color: #27AE60 !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}

.badge.bg-success i,
.verified-badge i {
    font-size: 14px;
}

/* Company logo styling */
#proposal-drillingCompanyLogo,
#invoice-drillingCompanyLogo {
    max-height: 100px !important;
    width: auto;
    display: block !important;
    margin: 0 auto 20px !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Customer Information heading with badge */
h5.text-muted {
    color: #495057 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-bottom: 20px !important;
    display: flex;
    align-items: center;
}

/* Better spacing for info sections */
.card-body .col-md-6 {
    padding: 0 20px;
}

.card-body .col-md-6:first-child {
    border-right: 1px solid #E1E4E8;
}

[data-theme="dark"] .card-body .col-md-6:first-child {
    border-right-color: #30363D;
}

/* Dark mode card styles */
[data-theme="dark"] .card {
    background-color: #161B22 !important;
    border: 1px solid #30363D !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .card * {
    color: #C9D1D9 !important;
}

[data-theme="dark"] .card-header {
    background: linear-gradient(135deg, #30363D, #484F58) !important;
    color: #C9D1D9 !important;
}

[data-theme="dark"] .card-header * {
    color: #C9D1D9 !important;
}

[data-theme="dark"] .card-body {
    background-color: #161B22 !important;
    color: #C9D1D9 !important;
}

[data-theme="dark"] #companyFrom span.text-muted {
    color: white !important;
}


/* Table styles */
.table {
    background-color: #FFFFFF !important;
}

.table tbody * {
    color: #2C3E50 !important;
}

.table thead {
    background-color: #2C3E50 !important;
}

.table thead th {
    color: #FFFFFF !important;
    background-color: #2C3E50 !important;
}

.table th,
.table td {
    border-color: #E1E4E8 !important;
    padding: 12px 15px !important;
}

.table tbody td {
    color: #2C3E50 !important;
}

.table th {
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 13px !important;
    letter-spacing: 0.5px;
    color: #FFFFFF !important;
}

/* Down Payment Row Styling */
.table tr.down-payment-row {
    background-color: #E8F4F8 !important;
}

.table tr.down-payment-row td {
    font-weight: 600 !important;
    color: #2E86AB !important;
}

.table tr.down-payment-row .badge {
    background-color: #27AE60 !important;
    color: white !important;
    padding: 4px 10px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Total Row Styling */
.table tfoot tr,
.table tr.total-row {
    background-color: #F8F9FA !important;
    font-weight: 700 !important;
}

.table tfoot td,
.table tr.total-row td {
    font-size: 18px !important;
    padding: 15px !important;
    border-top: 2px solid #2E86AB !important;
}

.table-primary {
    background-color: #E8F4F8 !important;
}

.table-primary td {
    color: #1E5A7A !important;
    font-weight: 600 !important;
}

/* Dark mode table styles */
[data-theme="dark"] .table {
    background-color: #161B22 !important;
}

[data-theme="dark"] .table tbody * {
    color: #C9D1D9 !important;
}

[data-theme="dark"] .table thead {
    background-color: #0D1117 !important;
}

[data-theme="dark"] .table thead th {
    color: #F0F6FC !important;
    background-color: #0D1117 !important;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-color: #30363D !important;
}

[data-theme="dark"] .table tbody td {
    color: #C9D1D9 !important;
}

[data-theme="dark"] .table tbody td strong {
    color: #000000 !important;
}

[data-theme="dark"] .table th {
    color: #F0F6FC !important;
}

[data-theme="dark"] .table tr.down-payment-row {
    background-color: #1A3A47 !important;
}

[data-theme="dark"] .table tr.down-payment-row td {
    color: #58A6FF !important;
}

[data-theme="dark"] .table tfoot tr,
[data-theme="dark"] .table tr.total-row {
    background-color: #1F2428 !important;
}

[data-theme="dark"] .table-primary {
    background-color: #1A3A47 !important;
}

[data-theme="dark"] .table-primary td {
    color: #79C0FF !important;
}

/* ===================================
   Forms - Bootstrap Compatible
   =================================== */
.form-control,
.form-select {
    background-color: var(--bs-body-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
    border-radius: 8px;
    padding: 12px 15px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bs-card-bg) !important;
    border-color: var(--industry-blue) !important;
    color: var(--bs-body-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(46, 134, 171, 0.25) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0D1117 !important;
    border-color: #30363D !important;
    color: #C9D1D9 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #161B22 !important;
    border-color: #58A6FF !important;
    color: #C9D1D9 !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #8B949E !important;
    opacity: 1;
}

/* ===================================
   Buttons - Industry Themed
   =================================== */
.btn {
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--industry-blue), var(--industry-blue-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--industry-blue-dark), var(--industry-blue));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 134, 171, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #27AE60, #229954);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954, #27AE60);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* ===================================
   Theme Toggle Button
   =================================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    background: var(--bs-card-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 50px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--custom-shadow-md);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--custom-shadow-lg);
}

.theme-toggle i {
    font-size: 20px;
    color: var(--bs-body-color);
}

/* Mobile-specific theme toggle improvements */
@media (max-width: 768px) {
    .theme-toggle {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 6px 12px;
        border-radius: 30px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }
    
    [data-theme="dark"] .theme-toggle {
        background: rgba(22, 27, 34, 0.95);
    }
    
    .theme-toggle i {
        font-size: 18px;
    }
}

/* ===================================
   Security Badges (Simplified)
   =================================== */
.security-badges {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 20px 0;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bs-text-secondary);
    font-size: 14px;
}

.security-badge i {
    color: var(--industry-blue);
    font-size: 20px;
}

/* ===================================
   Alerts - Bootstrap Enhanced
   =================================== */
.alert {
    border-radius: 10px;
    border: none;
    padding: 15px 20px;
    box-shadow: var(--custom-shadow-sm);
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    color: #27AE60;
    border-left: 4px solid #27AE60;
}

[data-theme="dark"] .alert-success {
    background: rgba(39, 174, 96, 0.2);
}

/* ===================================
   Loading States
   =================================== */
.skeleton-loader {
    background: linear-gradient(90deg, var(--bs-gray-100) 25%, var(--bs-gray-200) 50%, var(--bs-gray-100) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

[data-theme="dark"] .skeleton-loader {
    background: linear-gradient(90deg, var(--bs-gray-200) 25%, var(--bs-gray-300) 50%, var(--bs-gray-200) 75%);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===================================
   Responsive Table Improvements
   =================================== */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E1E4E8;
}

[data-theme="dark"] .table-responsive {
    border-color: #30363D;
}

/* Ensure table striping works */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* ===================================
   Mobile Responsiveness
   =================================== */
@media (max-width: 768px) {
    .container {
        margin: 15px;
        padding: 20px;
        border-radius: 8px;
    }
    
    .professional-header {
        padding: 20px;
        margin: -20px -20px 20px -20px;
    }
    
    .professional-header h1 {
        font-size: 24px;
    }
    
    .document-type-badge {
        font-size: 12px;
        padding: 4px 12px;
    }
    
    .industry-icon {
        min-width: 50px;
        height: 50px;
    }
    
    .industry-icon img {
        max-height: 50px;
    }
    
    .industry-icon #headerFallbackIcon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .trust-banner {
        flex-direction: column;
        gap: 10px;
    }
    
    .security-badges {
        flex-direction: column;
        gap: 15px;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
    }
    
    
    /* Remove border between columns on mobile */
    .card-body .col-md-6:first-child {
        border-right: none;
        padding-bottom: 20px;
        margin-bottom: 20px;
        border-bottom: 1px solid #E1E4E8;
    }
    
    [data-theme="dark"] .card-body .col-md-6:first-child {
        border-bottom-color: #30363D;
    }
    
    /* Table adjustments for mobile */
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px !important;
    }
    
    .table tfoot td,
    .table tr.total-row td {
        font-size: 16px !important;
        padding: 12px !important;
    }
}

/* ===================================
   Microdeposit Verification Styles
   =================================== */
   
/* Light mode - alert-info has light background, needs dark text */
.alert-info {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
    color: #0c5460 !important;
}

.alert-info * {
    color: #0c5460 !important;
}

/* Dark mode - ensure alert-info remains light with dark text */
[data-theme="dark"] .alert-info {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
    color: #0c5460 !important;
}

[data-theme="dark"] .alert-info * {
    color: #0c5460 !important;
}

/* Microdeposit specific inputs - additional specificity if needed */
[data-theme="dark"] #amt1,
[data-theme="dark"] #amt2,
[data-theme="dark"] #descriptorCode {
    background-color: #0D1117 !important;
    border-color: #30363D !important;
    color: #C9D1D9 !important;
}

[data-theme="dark"] #amt1::placeholder,
[data-theme="dark"] #amt2::placeholder,
[data-theme="dark"] #descriptorCode::placeholder {
    color: #8B949E !important;
}

[data-theme="dark"] #amt1:focus,
[data-theme="dark"] #amt2:focus,
[data-theme="dark"] #descriptorCode:focus {
    background-color: #161B22 !important;
    border-color: #58A6FF !important;
    color: #C9D1D9 !important;
}

/* Option sections in microdeposit form */
[data-theme="dark"] .option-section h6 {
    color: #C9D1D9 !important;
}

[data-theme="dark"] .verification-options {
    color: #C9D1D9 !important;
}


/* ===================================
   Print Styles - Compact for Single Page
   =================================== */
@media print {
    /* Hide non-essential elements FIRST */
    .theme-toggle,
    .trust-banner,
    .security-badges,
    .btn,
    button,
    footer,
    .skeleton-loader,
    .professional-header,
    #invoiceInfo,
    #proposalLoading,
    #invoiceLoading,
    .payment-security,
    .ripple,
    .print-button,
    #approvalCard form,
    #approvalCard .card-header,
    #approvalCard .card-body > *:not(#proposalResponse),
    /* Hide ActionPrompt and related elements */
    .action-prompt-container,
    .action-prompt,
    .action-prompt-content,
    .action-prompt-icon,
    .action-prompt-text,
    .action-prompt-title,
    .action-prompt-subtitle,
    .action-prompt-buttons,
    .action-prompt-btn,
    .action-prompt-close,
    /* Hide payment areas and forms */
    #proposalPaymentArea,
    #invoicePaymentArea,
    #paymentMethodChoice,
    .payment-method-selection,
    .payment-form,
    .stripe-element,
    #card-element,
    /* Hide network error alerts */
    #network-error-alert,
    /* Hide any SweetAlert modals */
    .swal2-container,
    .swal2-popup,
    /* Hide any Bootstrap modals */
    .modal,
    .modal-backdrop,
    /* Hide loading spinners */
    .spinner-border,
    .loading-overlay {
        display: none !important;
    }
    
    /* Show payment/approval status in print */
    #proposalPaymentArea .alert-success,
    #invoicePaymentArea .alert-success,
    #proposalResponse .alert-success,
    #proposalResponse,
    #paymentMethodChoice .alert-success {
        display: block !important;
        border: 2px solid #198754 !important;
        background-color: #d1e7dd !important;
        color: #000 !important;
        padding: 12px 15px !important;
        margin: 15px 0 10px 0 !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        page-break-inside: avoid !important;
        border-radius: 4px !important;
    }

    /* Ensure proposalResponse container is visible if it has content */
    #proposalResponse:not(:empty) {
        display: block !important;
        font-size: 9pt !important;
    }

    /* Show approval card when it contains approved status or signed confirmation */
    #approvalCard:has(.alert-success),
    #approvalCard.signed-confirmation,
    .signed-confirmation {
        display: block !important;
        border: 2px solid #198754 !important;
        background-color: #d1e7dd !important;
        padding: 10px 12px !important;
        margin: 15px 0 10px 0 !important;
        border-radius: 4px !important;
        page-break-inside: avoid !important;
    }

    /* Show approval card header when approved */
    #approvalCard:has(.alert-success) .card-header,
    #approvalCard.signed-confirmation .card-header,
    .signed-confirmation .card-header {
        display: block !important;
        background: #198754 !important;
        color: #fff !important;
        padding: 6px 10px !important;
        margin: -10px -12px 6px -12px !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        border-radius: 2px 2px 0 0 !important;
    }

    /* Show approval card body when approved */
    #approvalCard:has(.alert-success) .card-body,
    #approvalCard.signed-confirmation .card-body,
    .signed-confirmation .card-body {
        display: block !important;
        padding: 6px 2px !important;
        font-size: 9pt !important;
    }

    /* Show invoice paid status prominently */
    .invoice-paid-status,
    #invoicePaymentArea:has(.alert-success) {
        display: block !important;
        border: 2px solid #198754 !important;
        background-color: #d1e7dd !important;
        color: #000 !important;
        padding: 10px 12px !important;
        margin: 15px 0 10px 0 !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        border-radius: 4px !important;
        page-break-inside: avoid !important;
    }

    /* Show payment success messages prominently */
    #invoicePaymentArea .alert-success h4,
    #proposalPaymentArea .alert-success h4,
    .alert-success .alert-heading {
        display: block !important;
        font-size: 11pt !important;
        font-weight: bold !important;
        margin: 0 0 5px 0 !important;
        color: #000 !important;
    }

    /* Ensure status icons and check marks print prominently */
    .alert-success i.bi-check-circle,
    .alert-success i.bi-check-circle-fill,
    .alert-success i.fas,
    .bi-check-circle-fill,
    .bi-check-circle,
    .status-badge,
    .payment-status {
        display: inline !important;
        color: #198754 !important;
        font-size: 12pt !important;
    }

    /* Show signature information in print */
    .signature-display,
    .signed-by-info,
    #approvalCard .form-label {
        display: block !important;
        font-size: 9pt !important;
        color: #000 !important;
        margin: 3px 0 !important;
    }

    /* Show payment dates and transaction info */
    .payment-date,
    .transaction-id,
    .payment-method {
        display: block !important;
        font-size: 8pt !important;
        color: #666 !important;
        margin: 2px 0 !important;
    }

    /* Ensure all invoice status indicators are visible */
    .invoice-status,
    .payment-status-badge,
    .invoice-paid-indicator,
    [class*="status-paid"],
    [class*="paid-status"] {
        display: inline-block !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        color: #198754 !important;
    }

    /* Show invoice summary with payment status */
    .invoice-summary,
    .invoice-total-row,
    .amount-paid-row {
        display: table-row !important;
        font-size: 9pt !important;
    }

    /* Ensure any dynamically added paid status messages show */
    #invoiceDetails .alert-success,
    .invoice-payment-success,
    .payment-confirmation {
        display: block !important;
        border: 2px solid #198754 !important;
        background-color: #d1e7dd !important;
        color: #000 !important;
        padding: 10px 12px !important;
        margin: 12px 0 8px 0 !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        border-radius: 4px !important;
    }

    /* Show receipt/confirmation numbers prominently */
    .receipt-number,
    .confirmation-number,
    .reference-number {
        display: block !important;
        font-weight: bold !important;
        font-size: 9pt !important;
        margin: 3px 0 !important;
    }
    
    /* Style the status text for better print visibility */
    .alert-success small {
        display: block !important;
        margin-top: 5px !important;
        font-style: italic !important;
    }

    #invoice-drillingCompanyLogo {
        display: none !important;
    }
    
    /* Then apply print styles */
    * {
        color: #000 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    @page {
        margin: 0.3in;  /* Reduced margin for more space */
        size: letter;
        /* Avoid orphans and widows */
        orphans: 3;
        widows: 3;
    }
    
    body {
        font-size: 10pt;  /* Smaller font size */
        line-height: 1.2;  /* Tighter line height */
        margin: 0;
        padding: 0;
        /* Ensure ActionPrompt and other floating elements don't affect layout */
        overflow: visible !important;
    }

    /* Ensure main container uses full space efficiently */
    .container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Force any remaining action prompt elements to have no dimensions */
    .action-prompt-container,
    .action-prompt-container * {
        height: 0 !important;
        width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }

    /* Ensure document content starts immediately */
    #documentContent,
    .container > *:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Remove any top spacing from first elements */
    body > *:first-child,
    .container > *:first-child,
    .professional-header,
    .trust-banner,
    .header-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Container styling already defined above - remove duplicate */
    
    /* Compact headings */
    h1 { font-size: 14pt !important; margin: 3px 0 !important; }
    h2 { font-size: 12pt !important; margin: 3px 0 !important; }
    h3 { font-size: 11pt !important; margin: 3px 0 !important; }
    h4 { font-size: 10pt !important; margin: 2px 0 !important; }
    h5, h6 { font-size: 9pt !important; margin: 2px 0 !important; }
    
    /* Compact logo and header area */
    .water-logo,
    img[src*="logo"],
    img[src*="android-chrome"] {
        max-height: 40px !important;
        width: auto !important;
        margin: 0 !important;
    }
    
    /* Invoice header compact layout */
    #invoice > h1:first-child,
    #proposal > h1:first-child {
        font-size: 12pt !important;
        margin: 2px 0 5px 0 !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        color: #000 !important;
    }
    
    /* Compact cards */
    .card {
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
        margin-bottom: 8px !important;  /* Less margin between cards */
        padding: 0 !important;
    }
    
    .card-header {
        background-color: #f5f5f5 !important;
        border-bottom: 1px solid #ccc !important;
        padding: 4px 8px !important;  /* Smaller padding */
        font-weight: bold !important;
        color: #000 !important;
        font-size: 11pt !important;
    }
    
    .card-body {
        padding: 8px !important;  /* Smaller padding */
    }
    
    /* Compact description lists */
    dl {
        margin: 0 !important;
    }
    
    dt {
        font-weight: bold !important;
        margin-top: 3px !important;
        font-size: 9pt !important;
    }
    
    dd {
        margin-left: 0 !important;
        margin-bottom: 3px !important;
        font-size: 9pt !important;
    }
    
    /* Two-column layout for invoice details and bill-to/from */
    .row {
        display: flex !important;
        flex-direction: row !important;
    }
    
    .col-md-6 {
        width: 50% !important;
        padding: 0 5px !important;
        display: inline-block !important;
    }
    
    /* Force bill-to and from sections to be side by side */
    #invoiceDetails .row,
    #proposalDetails .row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    #invoiceDetails .col-md-6:first-child,
    #proposalDetails .col-md-6:first-child {
        border-right: 1px solid #ccc !important;
        padding-right: 10px !important;
        margin-right: 10px !important;
    }
    
    /* Ensure Bill To and From headers are inline with content */
    #invoiceDetails h4,
    #proposalDetails h4 {
        margin: 0 0 3px 0 !important;
        font-size: 10pt !important;
    }
    
    /* Make the entire details card more compact */
    #invoiceDetails .card,
    #proposalDetails .card {
        margin-bottom: 5px !important;
    }
    
    #invoiceDetails .card-body,
    #proposalDetails .card-body {
        padding: 5px !important;
    }
    
    /* Compact table */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
        font-size: 9pt !important;  /* Smaller table font */
        margin-top: 5px !important;
    }
    
    table, th, td {
        border: 1px solid #ccc !important;
    }
    
    th {
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
        padding: 3px 5px !important;  /* Smaller padding */
        text-align: left !important;
    }
    
    td {
        padding: 2px 5px !important;  /* Smaller padding */
    }
    
    /* Right-align numeric columns */
    .text-end {
        text-align: right !important;
    }
    
    .text-center {
        text-align: center !important;
    }
    
    /* Compact totals */
    .table tfoot td,
    .table tr.total-row td {
        font-size: 10pt !important;
        padding: 3px 5px !important;
        font-weight: bold !important;
    }
    
    /* Invoice specific adjustments - ensure visibility */
    #invoice,
    #invoiceContent,
    #invoiceDetails,
    #invoiceItemsTable {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #proposal,
    #proposalContent,
    #proposalDetails,
    #proposalItemsTable {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Hide empty sections */
    #invoiceNotes:empty,
    #proposalNotes:empty {
        display: none !important;
    }
    
    /* Ensure items table stays compact */
    #invoiceItemsTable,
    #proposalItemsTable {
        margin-bottom: 5px !important;
    }
    
    /* Compact spacing utilities */
    .mb-4 { margin-bottom: 8px !important; }
    .mb-3 { margin-bottom: 6px !important; }
    .mb-2 { margin-bottom: 4px !important; }
    .mt-4 { margin-top: 8px !important; }
    .mt-3 { margin-top: 6px !important; }
    .mt-2 { margin-top: 4px !important; }
    .p-3 { padding: 6px !important; }
    .p-2 { padding: 4px !important; }
    

    
    /* Prevent page breaks in critical areas */
    #invoiceDetails,
    #invoiceItemsTable,
    #proposalDetails,
    #proposalItemsTable {
        page-break-inside: avoid !important;
    }
    
    /* Force single page if possible */
    .container > * {
        page-break-inside: avoid !important;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }


}

/* ===================================
   Accessibility
   =================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--industry-blue);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   Voided Proposal/Invoice Styles
   =================================== */
.voided-overlay {
    position: relative;
    opacity: 0.7;
}

.voided-overlay::after {
    content: "VOIDED";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 4rem;
    font-weight: bold;
    color: rgba(220, 53, 69, 0.3);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 10;
}

/* Voided status badge */
.bg-danger.document-type-badge,
#documentTypeBadge.bg-danger {
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Voided card styling */
.card.border-danger.voided-card {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.05) 0%, rgba(220, 53, 69, 0.02) 100%);
}

/* Dark mode adjustments for voided elements */
[data-theme="dark"] .voided-overlay::after {
    color: rgba(220, 53, 69, 0.5);
}

[data-theme="dark"] .card.border-danger.voided-card {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
}

/* Additional print optimizations for ActionPrompt issue */
@media print {
    /* Force any absolutely positioned elements to be hidden (includes ActionPrompt) */
    [style*="position: absolute"],
    [style*="position: fixed"],
    .position-absolute,
    .position-fixed {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
    }

    /* Optimize row spacing in customer info sections */
    .row {
        margin: 0 !important;
    }

    .col-md-6,
    .col-md-4,
    .col-md-8 {
        padding: 0 5px !important;
    }

    /* Ensure clean page breaks and no orphaned content */
    .card-header + .card-body {
        page-break-before: avoid;
    }

    /* Hide any toast notifications or alerts that might appear */
    .toast,
    .notification,
    .alert-warning,
    .alert-danger {
        display: none !important;
    }

    /* Make sure only document content is visible */
    #documentContent {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
    }

    /* Force table to display as proper table (override mobile responsive styles) */
    .table-responsive {
        display: block !important;
        overflow: visible !important;
        margin: 0 !important;
    }

    .table {
        display: table !important;
        border-collapse: collapse !important;
        font-size: 8pt !important;
        width: 100% !important;
        margin: 0 !important;
        table-layout: fixed !important;
    }

    .table thead {
        display: table-header-group !important;
    }

    .table tbody {
        display: table-row-group !important;
    }

    .table tfoot {
        display: table-footer-group !important;
    }

    .table tr {
        display: table-row !important;
        page-break-inside: avoid;
    }

    .table th,
    .table td {
        display: table-cell !important;
        border: 1px solid #ccc !important;
        padding: 2px 3px !important;
        vertical-align: top !important;
        font-size: 8pt !important;
        word-wrap: break-word;
    }

    /* Override any mobile responsive table styles */
    .table th[data-label],
    .table td[data-label] {
        display: table-cell !important;
    }

    .table th[data-label]::before,
    .table td[data-label]::before {
        display: none !important;
        content: none !important;
    }

    /* Compact customer and contractor info sections */
    .card-body .row {
        margin: 0 !important;
        font-size: 8pt !important;
    }

    .card-body .col-md-6 {
        padding: 0 3px !important;
        margin: 0 !important;
    }

    .card-body dl {
        margin: 0 !important;
        font-size: 8pt !important;
    }

    .card-body dt {
        font-size: 8pt !important;
        font-weight: bold !important;
        margin: 0 !important;
        width: 30% !important;
        float: left !important;
        clear: left !important;
    }

    .card-body dd {
        font-size: 8pt !important;
        margin: 0 0 2px 30% !important;
        padding-left: 5px !important;
    }

    /* Make customer/contractor info cards more compact */
    .card-header {
        padding: 2px 5px !important;
        font-size: 9pt !important;
        margin: 0 !important;
    }

    .card-body {
        padding: 3px 5px !important;
        margin: 0 !important;
    }

    /* Ensure items table gets proper column widths */
    .table th:nth-child(1), .table td:nth-child(1) { width: 50%; }  /* Description */
    .table th:nth-child(2), .table td:nth-child(2) { width: 15%; }  /* Quantity */
    .table th:nth-child(3), .table td:nth-child(3) { width: 17.5%; } /* Unit Price */
    .table th:nth-child(4), .table td:nth-child(4) { width: 17.5%; } /* Total */

    /* Force all content to start higher on page */
    .container {
        margin-top: -10px !important;
    }

    /* Additional space-saving optimizations */

    /* Make cards even more compact */
    .card {
        margin-bottom: 3px !important;
        border-width: 1px !important;
    }

    /* Remove excessive spacing from Bootstrap rows/cols */
    .row > * {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    /* Make headers more compact */
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.1 !important;
        margin: 2px 0 !important;
    }

    /* Compact the terms section if present */
    #proposalTerms,
    #invoiceNotes {
        font-size: 7pt !important;
        line-height: 1.2 !important;
    }

    /* Reduce spacing around totals section */
    .table tfoot {
        margin-top: 0 !important;
    }

    /* Make the invoice/proposal number more compact */
    #invoiceTitle,
    #proposalTitle {
        font-size: 10pt !important;
        margin: 0 !important;
    }

    /* Compact business name and address formatting */
    .card-body h5 {
        font-size: 9pt !important;
        margin: 1px 0 2px 0 !important;
        color: #333 !important;
    }

    /* If there are any remaining large gaps, reduce them */
    .mb-4, .my-4, .m-4 { margin: 2px 0 !important; }
    .mb-3, .my-3, .m-3 { margin: 2px 0 !important; }
    .mb-2, .my-2, .m-2 { margin: 1px 0 !important; }
    .mt-4, .my-4 { margin-top: 2px !important; }
    .mt-3, .my-3 { margin-top: 2px !important; }
    .mt-2, .my-2 { margin-top: 1px !important; }

    /* Optimize the two-column customer/contractor layout */
    .col-md-6:first-child {
        border-right: 1px solid #ddd !important;
        padding-right: 5px !important;
    }

    /* Force table text to be smaller and more compact */
    .table-hover tbody tr:hover {
        background-color: transparent !important;
    }

    /* Remove any padding/margins from definition lists */
    .card-body .row > .col-md-6 > dl {
        margin-bottom: 0 !important;
    }
}

/* ===================================
   Work Order Specific Styles
   =================================== */

/* Work Order Badge Styling */
.document-type-badge.work-order {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
}

.document-type-badge.work-order i {
    color: white;
}

/* Work Order Indicator */
.work-order-indicator {
    background-color: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 8px;
    display: inline-block;
}

[data-theme="dark"] .work-order-indicator {
    background-color: rgba(243, 156, 18, 0.2);
    border-color: rgba(243, 156, 18, 0.4);
}

/* Work Order Card Headers */
.work-order .card-header {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border-bottom: 2px solid #d68910;
}

.work-order .card-header h2,
.work-order .card-header h3,
.work-order .card-header h4,
.work-order .card-header h5 {
    color: white;
}

/* Work Order Title Icons */
.work-order #proposalTitleIcon,
.work-order #invoiceTitleIcon {
    color: #f39c12;
}

/* Work Order Badge Variants */
.badge.bg-work-order {
    background-color: #f39c12 !important;
    color: white;
}

.badge.bg-work-order-dark {
    background-color: #e67e22 !important;
    color: white;
}

/* Professional Header Work Order Styling */
.professional-header.work-order {
    border-left: 4px solid #f39c12;
    background: linear-gradient(90deg, rgba(243, 156, 18, 0.05), transparent);
}

/* Work Order Service Icon */
.work-order-service-icon {
    color: #f39c12;
    font-size: 1.2em;
    margin-right: 0.5rem;
}

/* Work Order Status Indicators */
.work-order-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.work-order-status i {
    color: #f39c12;
}

[data-theme="dark"] .work-order-status {
    background-color: rgba(243, 156, 18, 0.2);
    border-color: rgba(243, 156, 18, 0.4);
    color: #f8f9fa;
}

/* Work Order Project Number Styling */
.work-order .project-number::before {
    content: "WO-";
    color: #f39c12;
    font-weight: bold;
}

/* Work Order Approval Styling */
.work-order #approvalCard .card-header {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* Print-specific work order styles */
@media print {
    .work-order-indicator,
    .work-order-status {
        color: #000 !important;
        background-color: #f8f8f8 !important;
        border: 1px solid #ddd !important;
    }

    .work-order .card-header {
        background-color: #f8f8f8 !important;
        color: #000 !important;
        border-bottom: 2px solid #ddd !important;
    }
}