/* Custom CSS for Agent Ledger - Minimal overrides to Bootstrap theme */

/* CRITICAL: Button override styles - ABSOLUTE MAXIMUM SPECIFICITY */
html body div.d-flex.gap-2 div.dropdown:nth-child(1) button#settingsDropdown,
html body div.d-flex.gap-2 div.dropdown:nth-child(1) button#settingsDropdown:hover,
html body div.d-flex.gap-2 div.dropdown:nth-child(1) button#settingsDropdown:active,
html body div.d-flex.gap-2 div.dropdown:nth-child(1) button#settingsDropdown:focus,
html body div.d-flex.gap-2 div.dropdown:nth-child(2) button#profileDropdown,
html body div.d-flex.gap-2 div.dropdown:nth-child(2) button#profileDropdown:hover,
html body div.d-flex.gap-2 div.dropdown:nth-child(2) button#profileDropdown:active,
html body div.d-flex.gap-2 div.dropdown:nth-child(2) button#profileDropdown:focus {
    background: #0d6efd !important;
    background-color: #0d6efd !important;
    color: white !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Dropdown menu fix - escape clipping containers for HERO SECTION ONLY */
.dashboard-hero {
    overflow: visible !important;
}

.dashboard-hero .dropdown {
    overflow: visible !important;
}

/* Dropdown menus in dashboard hero - use absolute positioning for proper anchoring */
.dashboard-hero .dropdown-menu {
    z-index: 10000 !important;
}

/* Ensure navigation dropdowns work normally */
.navbar .dropdown-menu,
nav .dropdown-menu {
    position: absolute !important;
    z-index: 1050 !important;
}

/* Fix for Help Section - Ensure white text on dark backgrounds in BOTH light and dark modes */
/* Override Bootstrap theme system by resetting CSS variables AND setting color directly */
[data-bs-theme="light"] .bg-dark,
[data-bs-theme="light"] .card.bg-dark,
[data-bs-theme="light"] .card.bg-dark .card-body {
    --bs-body-color: #ffffff !important;
    --bs-emphasis-color: #ffffff !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] .bg-dark *,
[data-bs-theme="light"] .card.bg-dark *,
[data-bs-theme="light"] .card.bg-dark .card-body * {
    --bs-body-color: #ffffff !important;
    color: #ffffff !important;
}

/* Same for dark mode to ensure consistency */
[data-bs-theme="dark"] .bg-dark,
[data-bs-theme="dark"] .card.bg-dark,
[data-bs-theme="dark"] .card.bg-dark .card-body,
.bg-dark,
.card.bg-dark,
.card.bg-dark .card-body {
    --bs-body-color: #ffffff !important;
    --bs-emphasis-color: #ffffff !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-dark *,
[data-bs-theme="dark"] .card.bg-dark *,
.bg-dark *,
.card.bg-dark * {
    --bs-body-color: #ffffff !important;
    color: #ffffff !important;
}

/* EXCEPTION: Deal Name helper text in light mode must be black, not white */
[data-bs-theme="light"] .bg-dark .helper-text-light,
[data-bs-theme="light"] .helper-text-light,
[data-bs-theme="light"] .accordion-body .helper-text-light,
[data-bs-theme="light"] div.mb-3 .helper-text-light,
[data-bs-theme="light"] .accordion-collapse .helper-text-light,
.helper-text-light {
    color: #000000 !important;
    background-color: transparent !important;
}

/* Override any parent color inheritance on helper text */
[data-bs-theme="light"] .helper-text-light,
[data-bs-theme="light"] .helper-text-light * {
    color: #000000 !important;
}

/* Ensure code blocks and pre elements are also white on dark backgrounds */
[data-bs-theme="light"] .bg-dark code,
[data-bs-theme="light"] .bg-dark pre,
[data-bs-theme="dark"] .bg-dark code,
[data-bs-theme="dark"] .bg-dark pre,
.bg-dark code,
.bg-dark pre {
    color: #ffffff !important;
}

/* Custom responsive layout for navigation headers */
@media (max-width: 767px) {
    :root {
        --header-height-mobile: 110px;
    }
}

/* Deal stage container with flexbox for horizontal scrolling */
.deal-stages-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem;
}

.deal-stage {
    flex: 0 0 auto;
    min-width: 200px;
}

/* Notification badge styling */
.notification-badge {
    position: relative;
    display: inline-block;
}

.notification-badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Task badge styling */
.task-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Email task badge with envelope icon */
.email-task-badge {
    background-color: #e7f3ff;
    color: #0066cc;
    border: 1px solid #99ccff;
}

[data-bs-theme="dark"] .email-task-badge {
    background-color: #1a3a52;
    color: #66b3ff;
    border: 1px solid #3366cc;
}

/* Kanban board styling */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.kanban-column {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    min-height: 500px;
}

[data-bs-theme="dark"] .kanban-column {
    background-color: #2d2d2d;
}

.kanban-card {
    background-color: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.2s;
}

[data-bs-theme="dark"] .kanban-card {
    background-color: #3d3d3d;
}

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

.kanban-card.dragging {
    opacity: 0.5;
}

/* Response content styling for AI responses */
.response-content {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.response-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #0d6efd;
}

.response-content h2:first-child {
    margin-top: 0;
}

.response-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.response-content ul, .response-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.response-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.response-content hr {
    margin: 1.5rem 0;
    border-top: 1px solid #dee2e6;
}

/* Analysis content styling */
.analysis-content {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.analysis-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #0d6efd;
}

.analysis-content h2:first-child {
    margin-top: 0;
}

.analysis-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.analysis-content ul, .analysis-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.analysis-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.analysis-content hr {
    margin: 1.5rem 0;
    border-top: 1px solid #dee2e6;
}

/* Print media queries */
@media print {
    /* Hide navigation and buttons */
    .btn, nav, .sidebar, .btn-group, .btn-back-dashboard { display: none !important; }
    
    /* Hide sidebar columns */
    .col-lg-4, .col-md-3, .col-md-4 { display: none !important; }
    
    /* Make main content full width */
    .col-lg-8, .col-md-8, .col-md-9 { 
        width: 100% !important; 
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* Show print header */
    #printHeader {
        display: block !important;
        font-size: 10pt;
        line-height: 1.4;
        padding: 0.2rem;
    }
    
    /* Hide screen header for contract analysis */
    #contractInfo { display: none !important; }
    #analysisDisclaimer { display: none; }
    
    /* Email print styles - show email content */
    .email-content, .card-body {
        display: block !important;
        visibility: visible !important;
    }
    
    .card { 
        border: 1px solid #dee2e6 !important;
        margin: 0;
        padding: 0;
        page-break-after: avoid;
        box-shadow: none !important;
    }
    
    /* Keep card headers visible for emails */
    .card-header { 
        display: block !important;
        background: #f8f9fa !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .card-footer { display: none; }
    .alert { display: none; }
    
    body {
        font-size: 10pt;
        line-height: 1.3;
        margin: 0;
        padding: 0;
    }
    
    .container-fluid {
        max-width: 100%;
        margin: 0;
        padding: 0.2rem;
    }
    
    .row {
        margin: 0;
        padding: 0;
    }
    
    .col-lg-9, .col-lg-3 {
        padding: 0;
    }
    
    .card-body {
        padding: 0.25rem;
    }
    
    .mb-4, .mt-4 {
        margin-bottom: 0.2rem !important;
        margin-top: 0 !important;
    }
    
    .d-flex {
        margin: 0;
        padding: 0;
    }
    
    .analysis-content {
        font-size: 10pt;
        line-height: 1.3;
    }
    
    .analysis-content h2 {
        font-size: 11pt;
        font-weight: 600;
        margin-top: 0.3rem;
        margin-bottom: 0.15rem;
    }
    
    .analysis-content h3 {
        font-size: 10pt;
        font-weight: 600;
        margin-top: 0.2rem;
        margin-bottom: 0.15rem;
    }
    
    .analysis-content p {
        margin-bottom: 0.15rem;
        line-height: 1.3;
    }
    
    .analysis-content ul, .analysis-content ol {
        margin-left: 0.6rem;
        margin-bottom: 0.15rem;
        padding-left: 0.4rem;
    }
    
    .analysis-content li {
        margin-bottom: 0.1rem;
        line-height: 1.3;
        font-size: 10pt;
    }
    
    .analysis-content hr {
        margin: 0.3rem 0;
        border-top: 1px solid #ccc;
    }
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .response-content h2,
[data-bs-theme="dark"] .analysis-content h2 {
    color: #66b3ff;
}

/* AI Broker Response - Dark mode text visibility fix */
[data-bs-theme="dark"] .response-content,
[data-bs-theme="dark"] .response-content p,
[data-bs-theme="dark"] .response-content li,
[data-bs-theme="dark"] .response-content span,
[data-bs-theme="dark"] .response-content strong,
[data-bs-theme="dark"] .response-content ul,
[data-bs-theme="dark"] .response-content ol,
[data-bs-theme="dark"] .response-content div {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .response-content h1,
[data-bs-theme="dark"] .response-content h2,
[data-bs-theme="dark"] .response-content h3,
[data-bs-theme="dark"] .response-content h4,
[data-bs-theme="dark"] .response-content h5,
[data-bs-theme="dark"] .response-content h6 {
    color: #66b3ff !important;
}

/* Analysis content dark mode fix */
[data-bs-theme="dark"] .analysis-content,
[data-bs-theme="dark"] .analysis-content p,
[data-bs-theme="dark"] .analysis-content li,
[data-bs-theme="dark"] .analysis-content span,
[data-bs-theme="dark"] .analysis-content strong,
[data-bs-theme="dark"] .analysis-content ul,
[data-bs-theme="dark"] .analysis-content ol,
[data-bs-theme="dark"] .analysis-content div {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .analysis-content h1,
[data-bs-theme="dark"] .analysis-content h3,
[data-bs-theme="dark"] .analysis-content h4,
[data-bs-theme="dark"] .analysis-content h5,
[data-bs-theme="dark"] .analysis-content h6 {
    color: #66b3ff !important;
}

/* Dashboard AI Search Results - Dark mode text visibility fix */
[data-bs-theme="dark"] #aiSearchResults,
[data-bs-theme="dark"] #aiSearchResults p,
[data-bs-theme="dark"] #aiSearchResults h6,
[data-bs-theme="dark"] #aiSearchResults span,
[data-bs-theme="dark"] #aiSearchResults div,
[data-bs-theme="dark"] #aiSearchAnswer {
    color: #1b5e20 !important;
}

/* Dashboard AI Appointment result text */
[data-bs-theme="dark"] #appointmentResult,
[data-bs-theme="dark"] #appointmentResult p,
[data-bs-theme="dark"] #appointmentResult h6,
[data-bs-theme="dark"] #appointmentResult span,
[data-bs-theme="dark"] #appointmentResult div,
[data-bs-theme="dark"] #appointmentSuccessText {
    color: #1b5e20 !important;
}

[data-bs-theme="dark"] .kanban-card {
    color: #e9ecef;
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Button focus state styling */
button:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Link hover effects */
a {
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: none;
}

/* Form control styling */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #66b3ff;
    box-shadow: 0 0 0 0.2rem rgba(102, 179, 255, 0.25);
}

/* Alert styling in dark mode */
[data-bs-theme="dark"] .alert {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e9ecef;
}

/* Badge styling in dark mode */
[data-bs-theme="dark"] .badge {
    background-color: #0d6efd;
    color: white;
}

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

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

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #2d2d2d;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Placeholder text styling */
::placeholder {
    opacity: 0.7;
}

/* Selection styling */
::selection {
    background-color: #0d6efd;
    color: white;
}

[data-bs-theme="dark"] ::selection {
    background-color: #66b3ff;
    color: #1a1a1a;
}

/* 3D Border Effect for Vendor Listings */
.item-3d-box-full {
    border: 2px solid;
    border-image: linear-gradient(135deg, #ffffff, #cccccc, #999999, #666666) 1;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbfbfb 0%, #f5f5f5 50%, #efefef 100%);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.2),
        6px 6px 0px rgba(0, 0, 0, 0.1),
        inset -1px -1px 0px rgba(255, 255, 255, 0.3),
        inset 1px 1px 0px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #212529;
}

.item-3d-box-full h6,
.item-3d-box-full h5,
.item-3d-box-full h4,
.item-3d-box-full p,
.item-3d-box-full span,
.item-3d-box-full small,
.item-3d-box-full label,
.item-3d-box-full .fw-semibold,
.item-3d-box-full .fw-bold {
    color: #212529 !important;
}

.item-3d-box-full .text-muted {
    color: #555555 !important;
}

.item-3d-box-full a {
    color: #0d6efd !important;
}

.item-3d-box-full a:hover {
    color: #0a58ca !important;
}

[data-bs-theme="dark"] .item-3d-box-full {
    border-image: linear-gradient(135deg, #505050, #303030, #101010) 1;
    background: linear-gradient(135deg, #545454 0%, #424242 50%, #2d2d2d 100%);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.5),
        6px 6px 0px rgba(0, 0, 0, 0.3),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.4);
    color: #ffffff;
}

[data-bs-theme="dark"] .item-3d-box-full h6,
[data-bs-theme="dark"] .item-3d-box-full h5,
[data-bs-theme="dark"] .item-3d-box-full h4,
[data-bs-theme="dark"] .item-3d-box-full p,
[data-bs-theme="dark"] .item-3d-box-full span,
[data-bs-theme="dark"] .item-3d-box-full small,
[data-bs-theme="dark"] .item-3d-box-full label,
[data-bs-theme="dark"] .item-3d-box-full .fw-semibold,
[data-bs-theme="dark"] .item-3d-box-full .fw-bold {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .item-3d-box-full .text-muted {
    color: #b0b0b0 !important;
}

[data-bs-theme="dark"] .item-3d-box-full a {
    color: #7cb3ff !important;
}

[data-bs-theme="dark"] .item-3d-box-full a:hover {
    color: #9fc5ff !important;
}

.item-3d-box-full:hover {
    transform: translate(-2px, -2px);
    box-shadow: 
        5px 5px 0px rgba(0, 0, 0, 0.25),
        8px 8px 0px rgba(0, 0, 0, 0.15),
        inset -1px -1px 0px rgba(255, 255, 255, 0.4),
        inset 1px 1px 0px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .item-3d-box-full:hover {
    box-shadow: 
        5px 5px 0px rgba(0, 0, 0, 0.6),
        8px 8px 0px rgba(0, 0, 0, 0.4),
        inset -1px -1px 0px rgba(255, 255, 255, 0.15),
        inset 1px 1px 0px rgba(0, 0, 0, 0.5);
}

/* 3D Box for Commission Summary and Deals */
.item-3d-box {
    border: 1px solid;
    border-image: linear-gradient(135deg, #ffffff, #e0e0e0, #c0c0c0) 1;
    border-radius: 8px;
    padding: 1rem;
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f4 50%, #eeeeee 100%);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.15),
        4px 4px 0px rgba(0, 0, 0, 0.08),
        inset -1px -1px 0px rgba(255, 255, 255, 0.4),
        inset 1px 1px 0px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #212529;
}

.item-3d-box h6,
.item-3d-box h5,
.item-3d-box h4,
.item-3d-box p,
.item-3d-box span,
.item-3d-box small,
.item-3d-box label,
.item-3d-box .fw-semibold,
.item-3d-box .fw-bold {
    color: #212529 !important;
}

.item-3d-box .text-muted {
    color: #555555 !important;
}

.item-3d-box a {
    color: #0d6efd !important;
}

.item-3d-box a:hover {
    color: #0a58ca !important;
}

[data-bs-theme="dark"] .item-3d-box {
    border-image: linear-gradient(135deg, #505050, #303030, #101010) 1;
    background: linear-gradient(135deg, #535353 0%, #414141 50%, #2f2f2f 100%);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.4),
        4px 4px 0px rgba(0, 0, 0, 0.25),
        inset -1px -1px 0px rgba(255, 255, 255, 0.05),
        inset 1px 1px 0px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

[data-bs-theme="dark"] .item-3d-box h6,
[data-bs-theme="dark"] .item-3d-box h5,
[data-bs-theme="dark"] .item-3d-box h4,
[data-bs-theme="dark"] .item-3d-box p,
[data-bs-theme="dark"] .item-3d-box span,
[data-bs-theme="dark"] .item-3d-box small,
[data-bs-theme="dark"] .item-3d-box label,
[data-bs-theme="dark"] .item-3d-box .fw-semibold,
[data-bs-theme="dark"] .item-3d-box .fw-bold {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .item-3d-box .text-muted {
    color: #b0b0b0 !important;
}

[data-bs-theme="dark"] .item-3d-box a {
    color: #7cb3ff !important;
}

[data-bs-theme="dark"] .item-3d-box a:hover {
    color: #9fc5ff !important;
}

.item-3d-box:hover {
    transform: translate(-1px, -1px);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.2),
        6px 6px 0px rgba(0, 0, 0, 0.1),
        inset -1px -1px 0px rgba(255, 255, 255, 0.5),
        inset 1px 1px 0px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .item-3d-box:hover {
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.5),
        6px 6px 0px rgba(0, 0, 0, 0.3),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.4);
}

/* 3D Quick Action Button Wrapper */
.quick-action-3d-wrapper {
    border: 1px solid;
    border-image: linear-gradient(135deg, #ffffff, #e8e8e8, #d0d0d0) 1;
    border-radius: 6px;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f9f9f9 0%, #f2f2f2 50%, #ebebeb 100%);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.12),
        4px 4px 0px rgba(0, 0, 0, 0.06),
        inset -1px -1px 0px rgba(255, 255, 255, 0.5),
        inset 1px 1px 0px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    display: block;
    color: #212529;
}

.quick-action-3d-wrapper h6,
.quick-action-3d-wrapper h5,
.quick-action-3d-wrapper h4,
.quick-action-3d-wrapper p,
.quick-action-3d-wrapper span,
.quick-action-3d-wrapper small,
.quick-action-3d-wrapper .fw-semibold,
.quick-action-3d-wrapper .fw-bold {
    color: #212529 !important;
}

.quick-action-3d-wrapper .text-muted {
    color: #555555 !important;
}

[data-bs-theme="dark"] .quick-action-3d-wrapper {
    border-image: linear-gradient(135deg, #505050, #303030, #101010) 1;
    background: linear-gradient(135deg, #525252 0%, #414141 50%, #303030 100%);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.4),
        4px 4px 0px rgba(0, 0, 0, 0.25),
        inset -1px -1px 0px rgba(255, 255, 255, 0.05),
        inset 1px 1px 0px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

[data-bs-theme="dark"] .quick-action-3d-wrapper h6,
[data-bs-theme="dark"] .quick-action-3d-wrapper h5,
[data-bs-theme="dark"] .quick-action-3d-wrapper h4,
[data-bs-theme="dark"] .quick-action-3d-wrapper p,
[data-bs-theme="dark"] .quick-action-3d-wrapper span,
[data-bs-theme="dark"] .quick-action-3d-wrapper small,
[data-bs-theme="dark"] .quick-action-3d-wrapper .fw-semibold,
[data-bs-theme="dark"] .quick-action-3d-wrapper .fw-bold {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .quick-action-3d-wrapper .text-muted {
    color: #b0b0b0 !important;
}

.quick-action-3d-wrapper:hover {
    transform: translate(-1px, -1px);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.15),
        5px 5px 0px rgba(0, 0, 0, 0.08),
        inset -1px -1px 0px rgba(255, 255, 255, 0.6),
        inset 1px 1px 0px rgba(0, 0, 0, 0.12);
}

[data-bs-theme="dark"] .quick-action-3d-wrapper:hover {
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.5),
        5px 5px 0px rgba(0, 0, 0, 0.3),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.4);
}

/* Light Mode Quick Action Button Fixes for iPad/Mobile */
.quick-action-3d-wrapper .btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-primary:hover {
    color: #fff !important;
    background-color: #0d6efd !important;
}

.quick-action-3d-wrapper .btn-outline-info {
    color: #0dcaf0 !important;
    border-color: #0dcaf0 !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-info:hover {
    color: #000 !important;
    background-color: #0dcaf0 !important;
}

.quick-action-3d-wrapper .btn-outline-success {
    color: #198754 !important;
    border-color: #198754 !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-success:hover {
    color: #fff !important;
    background-color: #198754 !important;
}

.quick-action-3d-wrapper .btn-outline-warning {
    color: #ffc107 !important;
    border-color: #ffc107 !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-warning:hover {
    color: #000 !important;
    background-color: #ffc107 !important;
}

.quick-action-3d-wrapper .btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-secondary:hover {
    color: #fff !important;
    background-color: #6c757d !important;
}

.quick-action-3d-wrapper .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: transparent !important;
}
.quick-action-3d-wrapper .btn-outline-danger:hover {
    color: #fff !important;
    background-color: #dc3545 !important;
}

/* Explicit light mode - ensure visibility on all devices including iPad */
[data-bs-theme="light"] .quick-action-3d-wrapper,
html:not([data-bs-theme="dark"]) .quick-action-3d-wrapper {
    background: linear-gradient(135deg, #f9f9f9 0%, #f2f2f2 50%, #ebebeb 100%) !important;
    border: 1px solid #d0d0d0 !important;
}

[data-bs-theme="light"] .quick-action-3d-wrapper .btn,
html:not([data-bs-theme="dark"]) .quick-action-3d-wrapper .btn {
    font-weight: 600 !important;
}

/* 3D Stat Cards with Rounded Corners */
.stat-card-brand {
    border-radius: 12px !important;
    border: 2px solid;
    border-image: linear-gradient(135deg, #ffffff, #e0e0e0, #b0b0b0) 1;
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.18),
        6px 6px 0px rgba(0, 0, 0, 0.1),
        inset -1px -1px 0px rgba(255, 255, 255, 0.25),
        inset 1px 1px 0px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .stat-card-brand {
    border-image: linear-gradient(135deg, #606060, #404040, #1a1a1a) 1;
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.45),
        6px 6px 0px rgba(0, 0, 0, 0.28),
        inset -1px -1px 0px rgba(255, 255, 255, 0.08),
        inset 1px 1px 0px rgba(0, 0, 0, 0.35);
}

.stat-card-brand:hover {
    transform: translate(-2px, -2px);
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.22),
        8px 8px 0px rgba(0, 0, 0, 0.12),
        inset -1px -1px 0px rgba(255, 255, 255, 0.3),
        inset 1px 1px 0px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .stat-card-brand:hover {
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.55),
        8px 8px 0px rgba(0, 0, 0, 0.35),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.42);
}

/* 3D Border for Agent List Items */
.list-item-3d {
    border: 2px solid #d0d0d0 !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f4 50%, #eeeeee 100%) !important;
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.08),
        4px 4px 0px rgba(0, 0, 0, 0.04),
        inset -1px -1px 0px rgba(255, 255, 255, 0.3),
        inset 1px 1px 0px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease;
}

.list-item-3d td {
    border: none !important;
    background: transparent !important;
}

[data-bs-theme="dark"] .list-item-3d {
    border: 2px solid #505050 !important;
    background: linear-gradient(135deg, #535353 0%, #414141 50%, #2f2f2f 100%) !important;
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.3),
        4px 4px 0px rgba(0, 0, 0, 0.15),
        inset -1px -1px 0px rgba(255, 255, 255, 0.05),
        inset 1px 1px 0px rgba(0, 0, 0, 0.2) !important;
}

.list-item-3d:hover {
    transform: translate(-1px, -1px) !important;
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.12),
        5px 5px 0px rgba(0, 0, 0, 0.06),
        inset -1px -1px 0px rgba(255, 255, 255, 0.4),
        inset 1px 1px 0px rgba(0, 0, 0, 0.1) !important;
}

[data-bs-theme="dark"] .list-item-3d:hover {
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.4),
        5px 5px 0px rgba(0, 0, 0, 0.2),
        inset -1px -1px 0px rgba(255, 255, 255, 0.08),
        inset 1px 1px 0px rgba(0, 0, 0, 0.3) !important;
}

/* 3D Border for Activity Cards (Upcoming Closings, Recent Deals) */
.activity-card-3d {
    border: 2px solid;
    border-image: linear-gradient(135deg, #ffffff, #e0e0e0, #b0b0b0) 1;
    border-radius: 12px;
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f4 50%, #eeeeee 100%);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.18),
        6px 6px 0px rgba(0, 0, 0, 0.1),
        inset -1px -1px 0px rgba(255, 255, 255, 0.25),
        inset 1px 1px 0px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .activity-card-3d {
    border-image: linear-gradient(135deg, #505050, #303030, #101010) 1;
    background: linear-gradient(135deg, #535353 0%, #414141 50%, #2f2f2f 100%);
    box-shadow: 
        3px 3px 0px rgba(0, 0, 0, 0.45),
        6px 6px 0px rgba(0, 0, 0, 0.28),
        inset -1px -1px 0px rgba(255, 255, 255, 0.08),
        inset 1px 1px 0px rgba(0, 0, 0, 0.35);
}

.activity-card-3d:hover {
    transform: translate(-2px, -2px);
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.22),
        8px 8px 0px rgba(0, 0, 0, 0.12),
        inset -1px -1px 0px rgba(255, 255, 255, 0.3),
        inset 1px 1px 0px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .activity-card-3d:hover {
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.55),
        8px 8px 0px rgba(0, 0, 0, 0.35),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.42);
}

/* Light mode - ensure solid opaque background to cover backdrop pattern */
[data-bs-theme="light"] .activity-card-3d {
    background: #ffffff !important;
    position: relative;
    z-index: 1;
}

[data-bs-theme="light"] .activity-card-3d .card-body {
    background: #ffffff !important;
}

[data-bs-theme="light"] .item-3d-box-full {
    background: #ffffff !important;
    position: relative;
    z-index: 1;
    color: #212529 !important;
}

[data-bs-theme="light"] .item-3d-box-full h6,
[data-bs-theme="light"] .item-3d-box-full h5,
[data-bs-theme="light"] .item-3d-box-full h4,
[data-bs-theme="light"] .item-3d-box-full p,
[data-bs-theme="light"] .item-3d-box-full span:not(.badge),
[data-bs-theme="light"] .item-3d-box-full small,
[data-bs-theme="light"] .item-3d-box-full div {
    color: #212529 !important;
}

[data-bs-theme="light"] .item-3d-box-full .text-muted {
    color: #6c757d !important;
}

/* Section Header 3D - Enhanced card headers with 3D gradient border effect and rounded corners */
.section-header-3d {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    border: none;
    border-radius: 12px 12px 0 0;
    padding: 0.85rem 1.25rem;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.section-header-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    padding: 3px;
    background: linear-gradient(135deg, #6c757d, #adb5bd, #ced4da, #adb5bd, #6c757d);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.section-header-3d .card-title {
    font-weight: 600;
    color: #212529;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 1;
}

.section-header-3d .card-title i {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

[data-bs-theme="dark"] .section-header-3d {
    background: linear-gradient(135deg, #3d3d3d 0%, #343a40 50%, #2d2d2d 100%);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .section-header-3d::before {
    background: linear-gradient(135deg, #6c757d, #5a6268, #495057, #5a6268, #6c757d);
}

[data-bs-theme="dark"] .section-header-3d .card-title {
    color: #f8f9fa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Call History Cards - Theme-aware styling */
.call-history-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}

.call-history-card .card-body {
    color: #212529;
}

.call-history-card h5 {
    color: #212529;
}

.call-history-card .call-summary-box {
    background-color: #f8f9fa;
    color: #212529;
}

.call-history-card .call-summary-box p {
    color: #212529;
}

.call-history-card .text-muted-custom {
    color: #6c757d;
}

[data-bs-theme="dark"] .call-history-card {
    background-color: #2d2d2d;
    border: 1px solid #404040;
}

[data-bs-theme="dark"] .call-history-card .card-body {
    color: #e9ecef;
}

[data-bs-theme="dark"] .call-history-card h5 {
    color: #ffffff;
}

[data-bs-theme="dark"] .call-history-card .call-summary-box {
    background-color: #3d3d3d;
    color: #e9ecef;
}

[data-bs-theme="dark"] .call-history-card .call-summary-box p {
    color: #e9ecef;
}

[data-bs-theme="dark"] .call-history-card .text-muted-custom {
    color: #adb5bd;
}

/* Classic Blue Gradient Page Header */
.page-header-blue-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 25%, #0a58ca 50%, #084298 75%, #0d6efd 100%);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        0 4px 15px rgba(13, 110, 253, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.page-header-blue-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.page-header-blue-gradient h1,
.page-header-blue-gradient h2,
.page-header-blue-gradient h3 {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.page-header-blue-gradient p {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

.page-header-blue-gradient .badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.page-header-blue-gradient i {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Light mode override for page-header-blue-gradient text */
[data-bs-theme="light"] .page-header-blue-gradient h1,
[data-bs-theme="light"] .page-header-blue-gradient h2,
[data-bs-theme="light"] .page-header-blue-gradient h3,
[data-bs-theme="light"] .page-header-blue-gradient h4,
[data-bs-theme="light"] .page-header-blue-gradient h5,
[data-bs-theme="light"] .page-header-blue-gradient h6,
[data-bs-theme="light"] .page-header-blue-gradient p,
[data-bs-theme="light"] .page-header-blue-gradient span,
[data-bs-theme="light"] .page-header-blue-gradient small,
[data-bs-theme="light"] .page-header-blue-gradient i,
[data-bs-theme="light"] .page-header-blue-gradient .bi {
    color: #ffffff !important;
}

/* Light mode override for rental-hero text */
[data-bs-theme="light"] .rental-hero h1,
[data-bs-theme="light"] .rental-hero h2,
[data-bs-theme="light"] .rental-hero h3,
[data-bs-theme="light"] .rental-hero p,
[data-bs-theme="light"] .rental-hero span,
[data-bs-theme="light"] .rental-hero i,
[data-bs-theme="light"] .rental-hero .bi {
    color: #ffffff !important;
}

/* Light mode - preserve kpi-card backgrounds and text */
[data-bs-theme="light"] .kpi-card .card-body {
    background: transparent !important;
}

/* Light mode - cards with Bootstrap bg-* classes */
[data-bs-theme="light"] .card.bg-primary .card-body,
[data-bs-theme="light"] .card.bg-secondary .card-body,
[data-bs-theme="light"] .card.bg-success .card-body,
[data-bs-theme="light"] .card.bg-danger .card-body,
[data-bs-theme="light"] .card.bg-info .card-body {
    background: transparent !important;
}

[data-bs-theme="light"] .card.bg-primary h1,
[data-bs-theme="light"] .card.bg-primary h2,
[data-bs-theme="light"] .card.bg-primary h3,
[data-bs-theme="light"] .card.bg-primary h4,
[data-bs-theme="light"] .card.bg-primary div,
[data-bs-theme="light"] .card.bg-primary small,
[data-bs-theme="light"] .card.bg-primary i,
[data-bs-theme="light"] .card.bg-secondary h1,
[data-bs-theme="light"] .card.bg-secondary h2,
[data-bs-theme="light"] .card.bg-secondary h3,
[data-bs-theme="light"] .card.bg-secondary h4,
[data-bs-theme="light"] .card.bg-secondary div,
[data-bs-theme="light"] .card.bg-secondary small,
[data-bs-theme="light"] .card.bg-secondary i,
[data-bs-theme="light"] .card.bg-success h1,
[data-bs-theme="light"] .card.bg-success h2,
[data-bs-theme="light"] .card.bg-success h3,
[data-bs-theme="light"] .card.bg-success h4,
[data-bs-theme="light"] .card.bg-success div,
[data-bs-theme="light"] .card.bg-success small,
[data-bs-theme="light"] .card.bg-success i,
[data-bs-theme="light"] .card.bg-danger h1,
[data-bs-theme="light"] .card.bg-danger h2,
[data-bs-theme="light"] .card.bg-danger h3,
[data-bs-theme="light"] .card.bg-danger h4,
[data-bs-theme="light"] .card.bg-danger div,
[data-bs-theme="light"] .card.bg-danger small,
[data-bs-theme="light"] .card.bg-danger i {
    color: #ffffff !important;
}

[data-bs-theme="light"] .card.bg-warning h1,
[data-bs-theme="light"] .card.bg-warning h2,
[data-bs-theme="light"] .card.bg-warning h3,
[data-bs-theme="light"] .card.bg-warning h4,
[data-bs-theme="light"] .card.bg-warning div,
[data-bs-theme="light"] .card.bg-warning small,
[data-bs-theme="light"] .card.bg-warning i,
[data-bs-theme="light"] .card.bg-info h1,
[data-bs-theme="light"] .card.bg-info h2,
[data-bs-theme="light"] .card.bg-info h3,
[data-bs-theme="light"] .card.bg-info h4,
[data-bs-theme="light"] .card.bg-info div,
[data-bs-theme="light"] .card.bg-info small,
[data-bs-theme="light"] .card.bg-info i {
    color: #212529 !important;
}

/* Dark mode adjustments for blue gradient header */
[data-bs-theme="dark"] .page-header-blue-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 25%, #0a58ca 50%, #084298 75%, #0d6efd 100%);
    box-shadow: 
        0 4px 20px rgba(13, 110, 253, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Property form file upload buttons - Blue with white text for visibility */
#document_files::file-selector-button,
#property_photos::file-selector-button {
    background-color: #0d6efd !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
}

#document_files::file-selector-button:hover,
#property_photos::file-selector-button:hover {
    background-color: #0b5ed7 !important;
}

/* Webkit browsers (Chrome, Safari, Edge) */
#document_files::-webkit-file-upload-button,
#property_photos::-webkit-file-upload-button {
    background-color: #0d6efd !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
}

#document_files::-webkit-file-upload-button:hover,
#property_photos::-webkit-file-upload-button:hover {
    background-color: #0b5ed7 !important;
}

/* Guest Detail Page - Force dark text for visibility in light mode */
[data-bs-theme="light"] .card-body .table td,
[data-bs-theme="light"] .card-body .table th,
.card-body .table td,
.card-body .table th {
    color: #212529 !important;
    background-color: transparent !important;
}

/* Specifically for guest contact information - override any conflicting styles */
.card-body table.table-borderless td {
    color: #212529 !important;
}

.card-body table.table-borderless th {
    color: #6c757d !important;
}

/* Guest detail table icons and text visibility */
.card-body .table i,
.card-body .table .bi {
    color: #212529 !important;
}

.card-body .table tr {
    color: #212529 !important;
}

.card-body .table td,
.card-body .table th {
    color: #212529 !important;
    background: transparent !important;
    text-shadow: none !important;
    opacity: 1 !important;
    font-weight: normal;
}

.card-body .table td a {
    color: #0d6efd !important;
    text-decoration: underline;
    opacity: 1 !important;
}

.card-body .table tbody tr {
    background-color: transparent !important;
    color: #212529 !important;
}

.card-body .table thead tr {
    background-color: transparent !important;
    color: #212529 !important;
}

/* No reservations icon visibility */
.card-body .bi-calendar-x {
    color: #6c757d !important;
}

/* Force table text visibility for table-hover specifically */
.table.table-hover tbody tr {
    color: #212529 !important;
}

.table.table-hover tbody tr td {
    color: #212529 !important;
    font-size: 1rem !important;
    letter-spacing: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.table.table-hover tbody tr:hover {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

.table.table-hover thead tr th {
    color: #212529 !important;
    font-size: 1rem !important;
}

/* CRITICAL: Light mode table text override - must defeat Bootstrap dark theme */
[data-bs-theme="light"] .table,
[data-bs-theme="light"] .table td,
[data-bs-theme="light"] .table th,
[data-bs-theme="light"] .table tr {
    color: #212529 !important;
    background-color: transparent !important;
}

[data-bs-theme="light"] .table.table-hover tbody tr {
    color: #212529 !important;
}

[data-bs-theme="light"] .table.table-hover tbody tr td {
    color: #212529 !important;
}

[data-bs-theme="light"] .table-hover tbody tr:hover {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* MAXIMUM SPECIFICITY: Guest detail reservation history table */
html[data-bs-theme="light"] div.card-body div.table-responsive table.table.table-hover tbody tr td,
html[data-bs-theme="light"] div.card-body div.table-responsive table.table.table-hover thead tr th {
    color: #212529 !important;
    background-color: transparent !important;
    text-shadow: none !important;
}

html[data-bs-theme="light"] div.card-body div.table-responsive table.table.table-hover tbody tr {
    background-color: transparent !important;
    color: #212529 !important;
}

html[data-bs-theme="light"] div.card-body div.table-responsive table.table.table-hover tbody tr:hover {
    background-color: #f0f0f0 !important;
}

/* Ensure text in badges still shows */
html[data-bs-theme="light"] .badge {
    color: white !important;
}

/* FALLBACK: Add subtle background if text is still invisible */
html[data-bs-theme="light"] div.card-body table.table tbody td {
    background-color: rgba(255, 255, 255, 0.7) !important;
    color: #212529 !important;
}

/* DARK MODE: Ensure text is visible in dark mode */
[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th,
[data-bs-theme="dark"] .table tr {
    color: #e9ecef !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .table.table-hover tbody tr {
    color: #e9ecef !important;
}

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

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table td a {
    color: #66b3ff !important;
}

/* Dark mode card text visibility */
[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card-body p,
[data-bs-theme="dark"] .card-body span,
[data-bs-theme="dark"] .card-body small,
[data-bs-theme="dark"] .card-body label,
[data-bs-theme="dark"] .card-body strong {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .card-body .text-muted {
    color: #adb5bd !important;
}

/* Dark mode form elements */
[data-bs-theme="dark"] .form-label {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .form-check-label {
    color: #e9ecef !important;
}

/* Guest profile dark mode - ensure all text is visible */
[data-bs-theme="dark"] .card-body table {
    color: #e9ecef;
}

[data-bs-theme="dark"] .card-body table th,
[data-bs-theme="dark"] .card-body table td {
    color: #e9ecef !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .card-body table .text-secondary {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .card-header {
    color: #e9ecef;
}

[data-bs-theme="dark"] .card-header .bi {
    color: #e9ecef !important;
}

/* ===== PROFILE DROPDOWN STYLING ===== */
/* Light mode - profile dropdown menu */
[data-bs-theme="light"] .profile-dropdown-menu {
    background-color: #ffffff !important;
}

[data-bs-theme="light"] .profile-dropdown-menu .dropdown-header {
    color: #6c757d !important;
}

[data-bs-theme="light"] .profile-dropdown-menu .dropdown-item {
    color: #212529 !important;
}

[data-bs-theme="light"] .profile-dropdown-menu .dropdown-item .bi {
    color: #212529 !important;
}

/* CRITICAL: Light mode dropdown-item-text must be visible */
[data-bs-theme="light"] .profile-dropdown-menu li.dropdown-item-text,
[data-bs-theme="light"] #profileDropdownWrapper li.dropdown-item-text,
[data-bs-theme="light"] .dropdown-menu li.dropdown-item-text {
    color: #212529 !important;
    background-color: #ffffff !important;
    display: block !important;
    padding: 0.5rem 1rem !important;
    opacity: 1 !important;
}

[data-bs-theme="light"] .profile-dropdown-menu li.dropdown-item-text .bi,
[data-bs-theme="light"] #profileDropdownWrapper li.dropdown-item-text .bi {
    color: #0d6efd !important;
}

/* Dark mode - profile dropdown menu */
[data-bs-theme="dark"] .profile-dropdown-menu {
    background-color: #212529 !important;
}

[data-bs-theme="dark"] .profile-dropdown-menu .dropdown-header {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-dropdown-menu .dropdown-item {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .profile-dropdown-menu .dropdown-item .bi {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .profile-dropdown-menu li.dropdown-item-text,
[data-bs-theme="dark"] #profileDropdownWrapper li.dropdown-item-text {
    color: #e9ecef !important;
    background-color: #212529 !important;
    display: block !important;
    padding: 0.5rem 1rem !important;
    opacity: 1 !important;
}

[data-bs-theme="dark"] .profile-dropdown-menu li.dropdown-item-text .bi,
[data-bs-theme="dark"] #profileDropdownWrapper li.dropdown-item-text .bi {
    color: #0d6efd !important;
}

/* iPad/iOS Light Mode Fix - Enhanced visibility for light grey backgrounds */
/* iPad Safari has known rendering issues with subtle gradients and pseudo-elements */

/* Target iPads specifically using multiple detection methods */
@media only screen 
    and (min-device-width: 768px) 
    and (max-device-width: 1366px) 
    and (-webkit-min-device-pixel-ratio: 1) {
    
    /* Light mode body background - more visible grey */
    [data-bs-theme="light"] body {
        background-color: #e9ecef !important;
        background-image: none !important;
    }
    
    [data-bs-theme="light"] body::before {
        display: none !important;
        content: none !important;
    }
    
    /* Container backgrounds */
    [data-bs-theme="light"] .container-fluid {
        background-color: #e9ecef !important;
    }
    
    [data-bs-theme="light"] .dashboard-brand-bg {
        background-color: #e9ecef !important;
    }
    
    /* 3D boxes - more visible gradient with stronger contrast */
    [data-bs-theme="light"] .item-3d-box-full,
    [data-bs-theme="light"] .item-3d-box {
        background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%) !important;
        border: 2px solid #d0d0d0 !important;
        box-shadow: 
            3px 3px 0px rgba(0, 0, 0, 0.15),
            6px 6px 0px rgba(0, 0, 0, 0.08),
            inset -1px -1px 0px rgba(255, 255, 255, 0.5),
            inset 1px 1px 0px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Cards inside containers - solid white (exclude theme preview cards) */
    [data-bs-theme="light"] .card:not(.theme-preview-card),
    [data-bs-theme="light"] .brand-pattern-card,
    [data-bs-theme="light"] .activity-card-3d {
        background-color: #ffffff !important;
        background: #ffffff !important;
        border: 1px solid #dee2e6 !important;
    }
    
    [data-bs-theme="light"] .card:not(.stat-card-primary):not(.stat-card-warning):not(.stat-card-success):not(.stat-card-danger):not(.stat-card-info):not(.kpi-card):not([style*="background"]) .card-body:not(.theme-preview-body) {
        background-color: #ffffff !important;
    }
    
    /* Section headers - more visible */
    [data-bs-theme="light"] .section-header-3d {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%) !important;
    }
}

/* Touch device detection fallback */
@media (pointer: coarse) and (min-width: 768px) and (max-width: 1400px) {
    [data-bs-theme="light"] body {
        background-color: #e9ecef !important;
        background-image: none !important;
    }
    
    [data-bs-theme="light"] body::before {
        display: none !important;
    }
    
    [data-bs-theme="light"] .item-3d-box-full,
    [data-bs-theme="light"] .item-3d-box {
        background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%) !important;
        border: 2px solid #d0d0d0 !important;
    }
    
    [data-bs-theme="light"] .card:not(.theme-preview-card),
    [data-bs-theme="light"] .container-fluid {
        background-color: #ffffff !important;
    }
}

/* iOS Safari specific using -webkit-touch-callout */
@supports (-webkit-touch-callout: none) {
    @media (min-width: 768px) and (max-width: 1400px) {
        [data-bs-theme="light"] body {
            background-color: #e9ecef !important;
            background-image: none !important;
        }
        
        [data-bs-theme="light"] body::before {
            display: none !important;
            content: none !important;
        }
        
        [data-bs-theme="light"] .item-3d-box-full,
        [data-bs-theme="light"] .item-3d-box {
            background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%) !important;
            border: 2px solid #d0d0d0 !important;
        }
        
        [data-bs-theme="light"] .dashboard-brand-bg,
        [data-bs-theme="light"] .brand-pattern-card,
        [data-bs-theme="light"] .activity-card-3d,
        [data-bs-theme="light"] .container-fluid,
        [data-bs-theme="light"] .card:not(.theme-preview-card) {
            background-color: #ffffff !important;
        }
    }
}

/* General light mode card transparency fix for all devices */
[data-bs-theme="light"] .card[style*="transparent"] {
    background-color: rgba(255, 255, 255, 0.95) !important;
}

[data-bs-theme="light"] .card[style*="transparent"] .card-body {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border-radius: inherit;
}

/* ===== THEME PREVIEW CARDS - PRESERVE CUSTOM BACKGROUNDS ===== */
/* These cards show theme previews and must keep their gradient/image backgrounds */
.theme-preview-card,
[data-bs-theme="light"] .theme-preview-card,
[data-bs-theme="dark"] .theme-preview-card {
    background: inherit !important;
}

.theme-preview-body,
[data-bs-theme="light"] .theme-preview-body,
[data-bs-theme="dark"] .theme-preview-body {
    background: inherit !important;
    background-color: transparent !important;
}

[data-bs-theme="light"] .theme-preview-card,
[data-bs-theme="light"] .theme-preview-card.card {
    background-color: transparent !important;
}

[data-bs-theme="light"] .theme-preview-body,
[data-bs-theme="light"] .theme-preview-body.card-body {
    background-color: transparent !important;
    background: transparent !important;
}

/* Ensure theme preview text remains white */
.theme-preview-body small,
[data-bs-theme="light"] .theme-preview-body small,
[data-bs-theme="light"] .theme-preview-body .text-white {
    color: #ffffff !important;
}

/* ===== PROPERTIES LIST 3D BOX VISIBILITY FIX ===== */
/* Ensure text is always visible in item-3d-box-full cards in light mode */
[data-bs-theme="light"] .card.item-3d-box-full,
[data-bs-theme="light"] .card.item-3d-box-full .card-body {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f0f0 50%, #e8e8e8 100%) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .card.item-3d-box-full .card-title,
[data-bs-theme="light"] .card.item-3d-box-full .card-text,
[data-bs-theme="light"] .card.item-3d-box-full h5,
[data-bs-theme="light"] .card.item-3d-box-full h6,
[data-bs-theme="light"] .card.item-3d-box-full p,
[data-bs-theme="light"] .card.item-3d-box-full span:not(.badge),
[data-bs-theme="light"] .card.item-3d-box-full strong,
[data-bs-theme="light"] .card.item-3d-box-full .fw-bold,
[data-bs-theme="light"] .card.item-3d-box-full .fw-semibold {
    color: #212529 !important;
}

[data-bs-theme="light"] .card.item-3d-box-full .text-muted,
[data-bs-theme="light"] .card.item-3d-box-full .small.text-muted {
    color: #6c757d !important;
}

[data-bs-theme="light"] .card.item-3d-box-full a:not(.btn) {
    color: #0d6efd !important;
}

/* Fix price and all headings in property cards */
[data-bs-theme="light"] .card.item-3d-box-full .h5,
[data-bs-theme="light"] .card.item-3d-box-full .h4,
[data-bs-theme="light"] .card.item-3d-box-full .h3,
[data-bs-theme="light"] .card.item-3d-box-full strong.h5,
[data-bs-theme="light"] .card.item-3d-box-full .row strong,
[data-bs-theme="light"] .card.item-3d-box-full .col-6 strong {
    color: #212529 !important;
}

/* Ensure icons are visible */
[data-bs-theme="light"] .card.item-3d-box-full i.bi {
    color: #495057 !important;
}

/* ===== DOCUMENT CENTER VISIBILITY FIXES ===== */
/* Light mode - ensure dark text on white backgrounds */
/* Exclude theme preview cards AND kpi-cards from white background override */
[data-bs-theme="light"] .card:not(.theme-preview-card):not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.item-3d-box-full) {
    background-color: #ffffff !important;
}
html:not([data-bs-theme="dark"]) .card:not(.theme-preview-card):not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.item-3d-box-full) {
    background-color: #ffffff !important;
}

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header {
    color: #212529 !important;
}

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header h5,
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header h4,
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header h6 {
    color: #212529 !important;
}

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header i,
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-header .bi {
    color: #212529 !important;
}

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not([style*="background"]) .card-body:not(.theme-preview-body) {
    background-color: #ffffff !important;
}
html:not([data-bs-theme="dark"]) .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not([style*="background"]) .card-body:not(.theme-preview-body) {
    background-color: #ffffff !important;
}

/* Preserve text-white class on elements inside cards with colored backgrounds */
[data-bs-theme="light"] .text-white,
[data-bs-theme="light"] .text-white *,
[data-bs-theme="light"] .card[style*="background"] .text-white,
[data-bs-theme="light"] .card[style*="background"] h1,
[data-bs-theme="light"] .card[style*="background"] h2,
[data-bs-theme="light"] .card[style*="background"] h3,
[data-bs-theme="light"] .card[style*="background"] span,
[data-bs-theme="light"] .card[style*="background"] p {
    color: #ffffff !important;
}

/* Preserve text-dark class on elements inside cards with colored backgrounds */
[data-bs-theme="light"] .text-dark,
[data-bs-theme="light"] .text-dark * {
    color: #212529 !important;
}

/* Stat-card color classes for 1099 dashboard and similar pages */
[data-bs-theme="light"] .stat-card-primary,
[data-bs-theme="light"] .stat-card-warning,
[data-bs-theme="light"] .stat-card-success,
[data-bs-theme="light"] .stat-card-danger,
[data-bs-theme="light"] .stat-card-info {
    background-color: transparent;
}
[data-bs-theme="light"] .stat-card-primary .card-body,
[data-bs-theme="light"] .stat-card-warning .card-body,
[data-bs-theme="light"] .stat-card-success .card-body,
[data-bs-theme="light"] .stat-card-danger .card-body,
[data-bs-theme="light"] .stat-card-info .card-body {
    background: transparent !important;
    background-color: transparent !important;
}

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card):not(.stat-card-primary):not(.stat-card-warning):not(.stat-card-success):not(.stat-card-danger):not(.stat-card-info) .card-body:not(.theme-preview-body) h5:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) h4:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) h6:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) p:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) span:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) label:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) strong:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) h1:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) h2:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card):not(.stat-card) .card-body:not(.theme-preview-body) h3:not(.text-white):not(.text-light):not(.text-primary):not(.text-success):not(.text-danger):not(.text-warning):not(.text-info):not(.text-secondary):not(.text-dark):not([class*="text-"]) {
    color: #212529 !important;
}

/* Light mode - preserve Bootstrap text color utility classes */
[data-bs-theme="light"] .text-primary { color: #0d6efd !important; }
[data-bs-theme="light"] .text-success { color: #198754 !important; }
[data-bs-theme="light"] .text-danger { color: #dc3545 !important; }
[data-bs-theme="light"] .text-warning { color: #ffc107 !important; }
[data-bs-theme="light"] .text-info { color: #0dcaf0 !important; }
[data-bs-theme="light"] .text-secondary { color: #6c757d !important; }
[data-bs-theme="light"] .text-dark { color: #212529 !important; }
[data-bs-theme="light"] .text-muted { color: #6c757d !important; }

/* Light mode - stat-card specific overrides */
[data-bs-theme="light"] .stat-card .card-body {
    background: transparent !important;
}
[data-bs-theme="light"] .stat-card h2.text-primary,
[data-bs-theme="light"] .stat-card h3.text-primary { color: #0d6efd !important; }
[data-bs-theme="light"] .stat-card h2.text-success,
[data-bs-theme="light"] .stat-card h3.text-success { color: #198754 !important; }
[data-bs-theme="light"] .stat-card h2.text-danger,
[data-bs-theme="light"] .stat-card h3.text-danger { color: #dc3545 !important; }
[data-bs-theme="light"] .stat-card h2.text-warning,
[data-bs-theme="light"] .stat-card h3.text-warning { color: #ffc107 !important; }
[data-bs-theme="light"] .stat-card h2.text-info,
[data-bs-theme="light"] .stat-card h3.text-info { color: #0dcaf0 !important; }
[data-bs-theme="light"] .stat-card small.text-muted { color: #6c757d !important; }

[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-body:not(.theme-preview-body) i:not(.text-white):not(.text-light),
[data-bs-theme="light"] .card:not(.kpi-card):not(.stat-card-brand):not(.report-stat-card) .card-body:not(.theme-preview-body) .bi:not(.text-white):not(.text-light) {
    color: #212529 !important;
}

/* Fix for table text in light mode cards */
[data-bs-theme="light"] .card .table thead th {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

[data-bs-theme="light"] .card .table tbody td {
    color: #212529 !important;
}

[data-bs-theme="light"] .card .table tbody td strong {
    color: #212529 !important;
}

[data-bs-theme="light"] .card .table tbody td small {
    color: #6c757d !important;
}

/* KPI Cards - preserve colored backgrounds and white text in light mode */
/* Base styles without theme selector for iPad/fallback compatibility */
.kpi-card,
.kpi-card.card {
    background-color: inherit !important;
}

.kpi-card .card-body,
.kpi-card.card .card-body {
    background-color: transparent !important;
    color: inherit !important;
}

.kpi-card .card-body i,
.kpi-card .card-body .bi,
.kpi-card.card .card-body i,
.kpi-card.card .card-body .bi {
    color: inherit !important;
}

.kpi-card .card-body div,
.kpi-card .card-body span,
.kpi-card.card .card-body div,
.kpi-card.card .card-body span {
    color: inherit !important;
}

.kpi-card.text-white,
.kpi-card.text-white .card-body,
.kpi-card.text-white .card-body *,
.kpi-card.text-white i,
.kpi-card.text-white .bi {
    color: #ffffff !important;
}

.kpi-card.text-dark,
.kpi-card.text-dark .card-body,
.kpi-card.text-dark .card-body *,
.kpi-card.text-dark i,
.kpi-card.text-dark .bi {
    color: #212529 !important;
}

/* Light mode explicit selectors */
[data-bs-theme="light"] .kpi-card,
[data-bs-theme="light"] .kpi-card.card,
html:not([data-bs-theme="dark"]) .kpi-card,
html:not([data-bs-theme="dark"]) .kpi-card.card {
    background-color: inherit !important;
}

[data-bs-theme="light"] .kpi-card .card-body,
[data-bs-theme="light"] .kpi-card.card .card-body,
html:not([data-bs-theme="dark"]) .kpi-card .card-body,
html:not([data-bs-theme="dark"]) .kpi-card.card .card-body {
    background-color: transparent !important;
    color: inherit !important;
}

[data-bs-theme="light"] .kpi-card.text-white,
[data-bs-theme="light"] .kpi-card.text-white .card-body,
[data-bs-theme="light"] .kpi-card.text-white .card-body *,
[data-bs-theme="light"] .kpi-card.text-white i,
[data-bs-theme="light"] .kpi-card.text-white .bi,
html:not([data-bs-theme="dark"]) .kpi-card.text-white,
html:not([data-bs-theme="dark"]) .kpi-card.text-white .card-body,
html:not([data-bs-theme="dark"]) .kpi-card.text-white .card-body *,
html:not([data-bs-theme="dark"]) .kpi-card.text-white i,
html:not([data-bs-theme="dark"]) .kpi-card.text-white .bi {
    color: #ffffff !important;
}

[data-bs-theme="light"] .kpi-card.text-dark,
[data-bs-theme="light"] .kpi-card.text-dark .card-body,
[data-bs-theme="light"] .kpi-card.text-dark .card-body *,
[data-bs-theme="light"] .kpi-card.text-dark i,
[data-bs-theme="light"] .kpi-card.text-dark .bi,
html:not([data-bs-theme="dark"]) .kpi-card.text-dark,
html:not([data-bs-theme="dark"]) .kpi-card.text-dark .card-body,
html:not([data-bs-theme="dark"]) .kpi-card.text-dark .card-body *,
html:not([data-bs-theme="dark"]) .kpi-card.text-dark i,
html:not([data-bs-theme="dark"]) .kpi-card.text-dark .bi {
    color: #212529 !important;
}

/* AI Appointment Center Manual Entry button - white icon in light mode */
[data-bs-theme="light"] #toggleAppointmentFormBtn i,
[data-bs-theme="light"] #toggleAppointmentFormBtn .bi,
#toggleAppointmentFormBtn i,
#toggleAppointmentFormBtn .bi {
    color: #ffffff !important;
}

/* Report Stat Cards - preserve colored backgrounds in light mode */
[data-bs-theme="light"] .report-stat-card,
[data-bs-theme="light"] .report-stat-card.card,
.report-stat-card,
.report-stat-card.card {
    background-color: inherit !important;
}

[data-bs-theme="light"] .report-stat-card .card-body,
[data-bs-theme="light"] .report-stat-card.card .card-body,
.report-stat-card .card-body,
.report-stat-card.card .card-body {
    background-color: transparent !important;
    color: inherit !important;
}

/* Report stat cards with white text */
[data-bs-theme="light"] .report-stat-white,
[data-bs-theme="light"] .report-stat-white .card-body,
[data-bs-theme="light"] .report-stat-white .card-body *,
[data-bs-theme="light"] .report-stat-white i,
[data-bs-theme="light"] .report-stat-white .bi,
[data-bs-theme="light"] .report-stat-white .h4,
[data-bs-theme="light"] .report-stat-white .small,
.report-stat-white,
.report-stat-white .card-body,
.report-stat-white .card-body *,
.report-stat-white i,
.report-stat-white .bi,
.report-stat-white .h4,
.report-stat-white .small {
    color: #ffffff !important;
}

/* Report stat cards with dark text */
[data-bs-theme="light"] .report-stat-dark,
[data-bs-theme="light"] .report-stat-dark .card-body,
[data-bs-theme="light"] .report-stat-dark .card-body *,
[data-bs-theme="light"] .report-stat-dark i,
[data-bs-theme="light"] .report-stat-dark .bi,
[data-bs-theme="light"] .report-stat-dark .h4,
[data-bs-theme="light"] .report-stat-dark .small,
.report-stat-dark,
.report-stat-dark .card-body,
.report-stat-dark .card-body *,
.report-stat-dark i,
.report-stat-dark .bi,
.report-stat-dark .h4,
.report-stat-dark .small {
    color: #212529 !important;
}

/* Fix for badge text visibility in light mode */
[data-bs-theme="light"] .badge.bg-info {
    color: #ffffff !important;
}

[data-bs-theme="light"] .badge.bg-secondary {
    color: #ffffff !important;
}

[data-bs-theme="light"] .badge.bg-success {
    color: #ffffff !important;
}

[data-bs-theme="light"] .badge.bg-warning {
    color: #212529 !important;
}

[data-bs-theme="light"] .badge.bg-danger {
    color: #ffffff !important;
}

[data-bs-theme="light"] .badge.bg-primary {
    color: #ffffff !important;
}

/* Document Center specific empty state */
[data-bs-theme="light"] .card .text-center.py-5 h5 {
    color: #212529 !important;
}

[data-bs-theme="light"] .card .text-center.py-5 p {
    color: #6c757d !important;
}

[data-bs-theme="light"] .card .text-center.py-5 .display-1 {
    color: #6c757d !important;
}

/* Form labels and inputs visibility */
[data-bs-theme="light"] .form-label {
    color: #212529 !important;
}

[data-bs-theme="light"] .form-select,
[data-bs-theme="light"] .form-control {
    color: #212529 !important;
    background-color: #ffffff !important;
    border-color: #ced4da !important;
}

/* Breadcrumb visibility */
[data-bs-theme="light"] .breadcrumb-item a {
    color: #0d6efd !important;
}

[data-bs-theme="light"] .breadcrumb-item.active {
    color: #6c757d !important;
}

/* Page heading visibility */
[data-bs-theme="light"] h2 {
    color: #212529 !important;
}

[data-bs-theme="light"] .text-muted {
    color: #6c757d !important;
}

/* ===========================================
   Email Generator - Radio Button Visibility
   Make clickable circles more visible in both modes
   =========================================== */

/* LIGHT MODE - Enhanced visibility for radio buttons */
[data-bs-theme="light"] .form-check-input[type="radio"] {
    width: 1.25em !important;
    height: 1.25em !important;
    border: 2px solid #0d6efd !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .form-check-input[type="radio"]:hover {
    border-color: #0b5ed7 !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .form-check-input[type="radio"]:checked {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35) !important;
}

[data-bs-theme="light"] .form-check-input[type="radio"]:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.35) !important;
}

/* DARK MODE - Enhanced visibility for radio buttons */
[data-bs-theme="dark"] .form-check-input[type="radio"] {
    width: 1.25em !important;
    height: 1.25em !important;
    border: 2px solid #6ea8fe !important;
    background-color: #212529 !important;
    cursor: pointer !important;
    box-shadow: 0 0 0 1px rgba(110, 168, 254, 0.3) !important;
}

[data-bs-theme="dark"] .form-check-input[type="radio"]:hover {
    border-color: #9ec5fe !important;
    box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.35) !important;
}

[data-bs-theme="dark"] .form-check-input[type="radio"]:checked {
    background-color: #0d6efd !important;
    border-color: #6ea8fe !important;
    box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.4) !important;
}

[data-bs-theme="dark"] .form-check-input[type="radio"]:focus {
    border-color: #9ec5fe !important;
    box-shadow: 0 0 0 4px rgba(110, 168, 254, 0.4) !important;
}

/* LIGHT MODE - Enhanced visibility for checkboxes */
[data-bs-theme="light"] .form-check-input[type="checkbox"] {
    width: 1.25em !important;
    height: 1.25em !important;
    border: 2px solid #0d6efd !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .form-check-input[type="checkbox"]:hover {
    border-color: #0b5ed7 !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .form-check-input[type="checkbox"]:checked {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35) !important;
}

[data-bs-theme="light"] .form-check-input[type="checkbox"]:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.35) !important;
}

/* DARK MODE - Enhanced visibility for checkboxes */
[data-bs-theme="dark"] .form-check-input[type="checkbox"] {
    width: 1.25em !important;
    height: 1.25em !important;
    border: 2px solid #6ea8fe !important;
    background-color: #212529 !important;
    cursor: pointer !important;
    box-shadow: 0 0 0 1px rgba(110, 168, 254, 0.3) !important;
}

[data-bs-theme="dark"] .form-check-input[type="checkbox"]:hover {
    border-color: #9ec5fe !important;
    box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.35) !important;
}

[data-bs-theme="dark"] .form-check-input[type="checkbox"]:checked {
    background-color: #0d6efd !important;
    border-color: #6ea8fe !important;
    box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.4) !important;
}

[data-bs-theme="dark"] .form-check-input[type="checkbox"]:focus {
    border-color: #9ec5fe !important;
    box-shadow: 0 0 0 4px rgba(110, 168, 254, 0.4) !important;
}

/* Quarterly Tax Card Hover Effects */
.quarterly-tax-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.3) !important;
}

.quarterly-tax-card .badge {
    transition: transform 0.2s;
}

.quarterly-tax-card:hover .badge {
    transform: scale(1.1);
}

/* Notes Center Section 3D Cards */
.notes-section-3d {
    position: relative;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #fbfbfb 0%, #f5f5f5 50%, #efefef 100%);
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.15),
        8px 8px 0px rgba(0, 0, 0, 0.08),
        inset -1px -1px 0px rgba(255, 255, 255, 0.5),
        inset 1px 1px 0px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.notes-section-3d::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 10px 0 0 10px;
}

.notes-section-3d:hover {
    transform: translate(-2px, -2px);
    box-shadow: 
        6px 6px 0px rgba(0, 0, 0, 0.18),
        10px 10px 0px rgba(0, 0, 0, 0.1),
        inset -1px -1px 0px rgba(255, 255, 255, 0.6),
        inset 1px 1px 0px rgba(0, 0, 0, 0.12);
}

/* Smart Views - Yellow/Warning */
.notes-section-3d.notes-section-smart-views::before {
    background: linear-gradient(180deg, #ffc107 0%, #e0a800 100%);
    box-shadow: 2px 0 8px rgba(255, 193, 7, 0.4);
}

/* My Saved Views - Info/Cyan */
.notes-section-3d.notes-section-saved-views::before {
    background: linear-gradient(180deg, #0dcaf0 0%, #0aa2c0 100%);
    box-shadow: 2px 0 8px rgba(13, 202, 240, 0.4);
}

/* File Drawer - Purple */
.notes-section-3d.notes-section-file-drawer::before {
    background: linear-gradient(180deg, #6f42c1 0%, #5a32a3 100%);
    box-shadow: 2px 0 8px rgba(111, 66, 193, 0.4);
}

/* Filters & Search - Teal */
.notes-section-3d.notes-section-filters::before {
    background: linear-gradient(180deg, #20c997 0%, #1aa179 100%);
    box-shadow: 2px 0 8px rgba(32, 201, 151, 0.4);
}

/* Dark mode for Notes Section 3D */
[data-bs-theme="dark"] .notes-section-3d {
    background: linear-gradient(135deg, #3a3a3a 0%, #2d2d2d 50%, #242424 100%);
    border: 2px solid #404040;
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.4),
        8px 8px 0px rgba(0, 0, 0, 0.25),
        inset -1px -1px 0px rgba(255, 255, 255, 0.08),
        inset 1px 1px 0px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .notes-section-3d:hover {
    box-shadow: 
        6px 6px 0px rgba(0, 0, 0, 0.5),
        10px 10px 0px rgba(0, 0, 0, 0.3),
        inset -1px -1px 0px rgba(255, 255, 255, 0.1),
        inset 1px 1px 0px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .notes-section-3d.notes-section-smart-views::before {
    box-shadow: 2px 0 10px rgba(255, 193, 7, 0.5);
}

[data-bs-theme="dark"] .notes-section-3d.notes-section-saved-views::before {
    box-shadow: 2px 0 10px rgba(13, 202, 240, 0.5);
}

[data-bs-theme="dark"] .notes-section-3d.notes-section-file-drawer::before {
    box-shadow: 2px 0 10px rgba(111, 66, 193, 0.5);
}

[data-bs-theme="dark"] .notes-section-3d.notes-section-filters::before {
    box-shadow: 2px 0 10px rgba(32, 201, 151, 0.5);
}

/* Notes Center Export Buttons - Bold Borders */
.notes-export-btn-bold {
    border-width: 3px !important;
    font-weight: 600 !important;
}

.notes-export-btn-bold:hover {
    border-width: 3px !important;
}

/* Notes Center Header - White Text in Light Mode */
[data-bs-theme="light"] .page-header-blue-gradient h2.text-white,
[data-bs-theme="light"] .page-header-blue-gradient p.text-white,
.page-header-blue-gradient h2.text-white,
.page-header-blue-gradient p.text-white {
    color: #ffffff !important;
}

/* ============================================= */
/* GLOBAL LIGHT MODE VISIBILITY FIXES           */
/* Ensures all elements are visible on white    */
/* backgrounds in light mode                    */
/* ============================================= */

/* Cards and Card Bodies */
[data-bs-theme="light"] .card:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-warning):not(.bg-info):not(.bg-secondary):not(.bg-dark) {
    background-color: #ffffff;
}

[data-bs-theme="light"] .card-header:not([class*="bg-"]) {
    background-color: #f8f9fa;
    color: #212529;
}

[data-bs-theme="light"] .card:not(.stat-card-primary):not(.stat-card-warning):not(.stat-card-success):not(.stat-card-danger):not(.stat-card-info):not(.kpi-card):not([style*="background"]) .card-body:not([class*="bg-"]) {
    background-color: #ffffff;
}

/* Typography in Light Mode */
[data-bs-theme="light"] h1:not(.text-white):not([class*="text-"]),
[data-bs-theme="light"] h2:not(.text-white):not([class*="text-"]),
[data-bs-theme="light"] h3:not(.text-white):not([class*="text-"]),
[data-bs-theme="light"] h4:not(.text-white):not([class*="text-"]),
[data-bs-theme="light"] h5:not(.text-white):not([class*="text-"]),
[data-bs-theme="light"] h6:not(.text-white):not([class*="text-"]) {
    color: #212529;
}

/* Form Elements */
[data-bs-theme="light"] .form-label {
    color: #212529;
}

[data-bs-theme="light"] .form-control:not(.is-invalid):not(.is-valid),
[data-bs-theme="light"] .form-select:not(.is-invalid):not(.is-valid),
[data-bs-theme="light"] textarea.form-control {
    background-color: #ffffff;
    border-color: #ced4da;
    color: #212529;
}

[data-bs-theme="light"] .form-control::placeholder {
    color: #6c757d;
}

[data-bs-theme="light"] .input-group-text {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #212529;
}

[data-bs-theme="light"] .form-text {
    color: #6c757d;
}

/* Tables */
[data-bs-theme="light"] .table:not(.table-dark) th,
[data-bs-theme="light"] .table:not(.table-dark) td {
    color: #212529;
}

[data-bs-theme="light"] .table:not(.table-dark) a {
    color: #0d6efd;
}

[data-bs-theme="light"] .table:not(.table-dark) strong {
    color: #212529;
}

/* Text utilities override */
[data-bs-theme="light"] .text-muted {
    color: #6c757d !important;
}

[data-bs-theme="light"] .text-secondary:not(.badge) {
    color: #6c757d !important;
}

/* Navigation */
[data-bs-theme="light"] .nav-link:not(.active):not([class*="text-"]) {
    color: #495057;
}

/* List Groups */
[data-bs-theme="light"] .list-group-item:not([class*="bg-"]) {
    background-color: #ffffff;
    color: #212529;
}

/* Modals */
[data-bs-theme="light"] .modal-content {
    background-color: #ffffff;
}

[data-bs-theme="light"] .modal-header {
    color: #212529;
}

[data-bs-theme="light"] .modal-body {
    color: #212529;
}

/* Accordion */
[data-bs-theme="light"] .accordion-button:not(.collapsed) {
    color: #0c63e4;
    background-color: #e7f1ff;
}

[data-bs-theme="light"] .accordion-body {
    background-color: #ffffff;
    color: #212529;
}

/* Dropdowns */
[data-bs-theme="light"] .dropdown-menu {
    background-color: #ffffff;
}

[data-bs-theme="light"] .dropdown-item {
    color: #212529;
}

[data-bs-theme="light"] .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* Alerts with visibility */
[data-bs-theme="light"] .alert {
    color: inherit;
}

/* Section headers */
[data-bs-theme="light"] .section-header-3d {
    background-color: #f8f9fa;
    color: #212529;
}

/* General paragraphs */
[data-bs-theme="light"] p:not(.text-white):not([class*="text-"]) {
    color: #495057;
}
