/* ====================================
   RIGHT SIDEBAR - FLUENT UI DESIGN
   F12 Console-Style Behavior
   ==================================== */

/* No backdrop needed - dashboard stays fully interactive */
.sidebar-backdrop {
    display: none; /* Remove backdrop completely */
}

/* Force queue detail sidebar header buttons to the standard style (white bg, grey border, grey icon). */
.right-sidebar-header .right-sidebar-expand,
.right-sidebar-header .right-sidebar-close {
    background: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.12) !important;
    color: #8a8886 !important;
}

.right-sidebar-header .right-sidebar-expand:hover,
.right-sidebar-header .right-sidebar-close:hover {
    background: #f3f2f1 !important;
}

/* Ensure primary buttons rendered inside the right panel always have white text (link styles can override). */
#appRightPanel .btn.btn-primary,
#appRightPanel .btn.btn-primary:visited,
#appRightPanel .btn.btn-primary:hover,
#appRightPanel .btn.btn-primary:active {
    color: #fff !important;
}

/* Right Sidebar Container - Fluent UI Style */
.right-sidebar {
    position: fixed;
    top: 78px; /* back up 24px (from 102px) */
    right: -768px; /* Start hidden off-screen to the right - increased by 192px */
    width: 768px; /* Fixed width - increased by 2 inches (192px) from 576px */
    height: calc(100vh - 78px); /* was calc(100vh - 78px) */
    background: var(--fluent-bg-primary, #ffffff);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12), -2px 0 8px rgba(0, 0, 0, 0.08);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top-left-radius: 12px; /* Fluent UI rounded corner - match dashboard */
    border-bottom-left-radius: 12px; /* Fluent UI rounded corner */
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    outline: none;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.right-sidebar.active {
    right: 0; /* Flush with right edge of viewport */
}

.right-sidebar.show {
    right: 0; /* Flush with right edge of viewport */
}

/* State 2: Full Expansion - slides to left sidebar edge, hides dashboard */
.right-sidebar.expanded-full {
    width: calc(100vw - 96px - 18px); /* Full width to left sidebar (96px) with gap (18px) */
    max-width: calc(100vw - 96px - 18px);
}

/* Dashboard adjustments are in dashboard-components.css */

body.sidebar-full footer {
    margin-right: calc(100vw - 96px - 18px);
}

/* State 1: Normal - Panel visible with 24px gap from dashboard */
body.sidebar-open .wip-card-wrapper {
    width: calc(100% - 768px - 24px); /* Shrink dashboard: total width minus sidebar (768px) minus gap (24px) */
    margin-right: 24px; /* Create the 24px gap */
}

body.sidebar-open footer {
    margin-right: 792px; /* 768px sidebar + 24px gap */
}

/* ====================================
   SIDEBAR HEADER - FLUENT UI
   ==================================== */

.right-sidebar-header {
    background: #ffffff;
    color: #323130;
    padding: 29px 24px; /* was 32px 24px; -3px (~1/16 in) */
    border-bottom: 1px solid #edebe9;
    flex-shrink: 0;
    min-height: 98px; /* was 104px; -6px (~1/16 in) */
}

.right-sidebar-header-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.right-sidebar-header-icon {
    width: 40px;
    height: 40px;
    background: #faf9f8 !important;
    background-image: none !important;
    border: 1px solid #edebe9 !important;
    border-radius: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    backdrop-filter: none;
    color: #ef4444 !important;
    padding: 0 !important;
    min-width: 40px !important;
    min-height: 40px !important;
}


.right-sidebar-header-text {
    flex: 1;
    min-width: 0;
}

.right-sidebar-title {
    color: #0f6cbd; /* Fluent-ish blue title (matches modal header intent) */
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.right-sidebar-subtitle {
    font-size: 12px;
    margin: 0;
    color: #605e5c;
    opacity: 1;
    line-height: 1.4;
}

/* Expansion Button - Fluent UI Style */
.right-sidebar-expand {
    width: 32px;
    height: 32px;
    border-radius: 6px; /* Fluent UI rounded corner */
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.12);
    color: #8a8886;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-right: 8px; /* Space before close button */
}

.right-sidebar-expand:hover {
    background: #f3f2f1;
    transform: none;
}

.right-sidebar-expand:active {
    transform: none;
}

/* Close Button - Fluent UI Style */
.right-sidebar-close {
    width: 32px;
    height: 32px;
    border-radius: 6px; /* Fluent UI rounded corner */
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.12);
    color: #8a8886;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.right-sidebar-close:hover {
    background: #f3f2f1;
    transform: none;
}

.right-sidebar-close:active {
    transform: none;
}

/* ====================================
   SIDEBAR BODY - FLUENT UI
   ==================================== */

.right-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #ffffff !important;
}

/* Custom scrollbar - Fluent UI style */
.right-sidebar-body::-webkit-scrollbar {
    width: 8px;
}

.right-sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.right-sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.right-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ====================================
   LOADING STATE - FLUENT UI
   ==================================== */

.right-sidebar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 16px;
    color: #605e5e;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 120, 212, 0.1);
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====================================
   DETAIL SECTIONS - FLUENT UI CARDS
   ==================================== */

.detail-section {
    background: #ffffff;
    border-radius: 8px; /* Fluent UI rounded corner */
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.04), 
                0 0.3px 0.9px rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.detail-section:hover {
    box-shadow: 0 3.2px 7.2px rgba(0, 0, 0, 0.06), 
                0 0.6px 1.8px rgba(0, 0, 0, 0.035);
    transform: translateY(-1px);
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f2f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====================================
   DETAIL ROWS - FLUENT UI LAYOUT
   ==================================== */

.detail-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f3f2f1;
    gap: 16px;
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-row:first-child {
    padding-top: 0;
}

.detail-label {
    font-size: 13px;
    color: #605e5c;
    font-weight: 500;
    min-width: 140px;
    flex-shrink: 0;
}

.detail-value {
    font-size: 14px;
    color: #323130;
    flex: 1;
    word-break: break-word;
}

.detail-value-highlight {
    font-weight: 600;
    color: #0078d4;
    font-size: 16px;
}

/* ====================================
   STATUS BADGES - FLUENT UI
   ==================================== */

.detail-value-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px; /* Fluent UI pill shape */
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value-status.status-new {
    background: #e1f5fe;
    color: #01579b;
    border: 1px solid #b3e5fc;
}

.detail-value-status.status-pending {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.detail-value-status.status-completed {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.detail-value-status.status-cancelled {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 1200px) {
    .right-sidebar.active {
        width: 640px; /* Smaller on medium screens */
    }
    
    body.sidebar-open .wip-card-wrapper {
        width: calc(100% - 640px - 24px);
    }
    
    body.sidebar-open footer {
        margin-right: 664px; /* 640px + 24px */
    }
}

@media (max-width: 768px) {
    .right-sidebar {
        top: 0; /* Full height on mobile */
        height: 100vh;
        border-radius: 0; /* No rounded corners on mobile */
    }
    
    .right-sidebar.active {
        width: 100%; /* Full width on mobile */
    }

    .detail-row {
        flex-direction: column;
        gap: 4px;
    }

    .detail-label {
        min-width: auto;
        font-size: 12px;
    }
}

/* ====================================
   DARK MODE SUPPORT
   ==================================== */

@media (prefers-color-scheme: dark) {
    .right-sidebar {
        background: #292827;
        border-left: 1px solid #3b3a39;
    }

    .right-sidebar-body {
        background: #201f1e;
    }

    .detail-section {
        background: #292827;
        border-color: #3b3a39;
    }

    .detail-section-title {
        color: #ffffff;
        border-bottom-color: #3b3a39;
    }

    .detail-label {
        color: #c8c6c4;
    }

    .detail-value {
        color: #f3f2f1;
    }

    .right-sidebar-body::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }

    .right-sidebar-body::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* ====================================
   ANIMATION ENHANCEMENTS
   ==================================== */

.detail-section {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple sections */
.detail-section:nth-child(1) { animation-delay: 0.05s; }
.detail-section:nth-child(2) { animation-delay: 0.1s; }
.detail-section:nth-child(3) { animation-delay: 0.15s; }
.detail-section:nth-child(4) { animation-delay: 0.2s; }
.detail-section:nth-child(5) { animation-delay: 0.25s; }
.detail-section:nth-child(6) { animation-delay: 0.3s; }

/* ====================================
   NEW SETTINGS: RIGHT PANEL "CARD" FRAME (NO IFRAME)
   ==================================== */

body.new-settings-page #appRightPanel.right-sidebar {
    background: transparent;
    border-left: none;
}

/* ====================================
   INSURANCE COVERAGE RIGHT PANEL HEADER
   ==================================== */

/* Icon color styling - ensure icon displays */
.right-sidebar-header-icon i,
.right-sidebar-header-icon [class*="fa"] {
    color: #0078d4 !important;
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
    line-height: 18px !important;
    display: inline-block !important;
    background: none !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-weight: 400 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.right-sidebar-header-icon i::before,
.right-sidebar-header-icon [class*="fa"]::before {
    color: #0078d4 !important;
    font-size: 18px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Also target SVG icons if Font Awesome uses them */
.right-sidebar-header-icon svg {
    color: #0078d4 !important;
    width: 18px !important;
    height: 18px !important;
    opacity: 1 !important;
    visibility: visible !important;
    fill: #0078d4 !important;
}

/* Header title styling */
.right-sidebar-header {
    background: #ffffff !important;
    border-bottom: 1px solid #edebe9 !important;
}

.right-sidebar-title {
    color: #323130 !important;
    font-weight: 700 !important;
    font-size: 16px !important;
}
    box-shadow: none;
}

body.new-settings-page #appRightPanel .right-sidebar-header {
    background: #ffffff;
    border-bottom: 1px solid #edebe9;
}

/* NewSettings overrides make the header white; ensure header text/icons are dark so they remain visible */
body.new-settings-page #appRightPanel .right-sidebar-header-icon {
    background: rgba(0, 0, 0, 0.05);
    color: #0f6cbd;
}

body.new-settings-page #appRightPanel .right-sidebar-title {
    color: #323130;
}

body.new-settings-page #appRightPanel .right-sidebar-subtitle {
    color: #605e5c;
    opacity: 1;
}

body.new-settings-page #appRightPanel .right-sidebar-expand,
body.new-settings-page #appRightPanel .right-sidebar-close {
    background: rgba(0, 0, 0, 0.05);
    color: #323130;
}

body.new-settings-page #appRightPanel .right-sidebar-expand:hover,
body.new-settings-page #appRightPanel .right-sidebar-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-header {
    background: #111827;
    border-bottom-color: #374151;
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-header-icon {
    background: rgba(255, 255, 255, 0.08);
    color: #60a5fa;
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-title {
    color: #f3f4f6;
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-subtitle {
    color: #cbd5e1;
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-expand,
[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-close {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-expand:hover,
[data-theme="dark"] body.new-settings-page #appRightPanel .right-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Right sidebar frame: match Fluent UI modal chrome (subtle border + soft elevation) */
.right-sidebar {
    /* keep existing layout props above */
    border: 1px solid rgba(0, 0, 0, 0.08);
    outline: none;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

/* Remove the previous override that forced no border (we want Fluent UI-style border now) */
.right-sidebar {
    /* override the later !important declarations */
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    outline: none !important;
}

/* Keep body/content from adding inner frames */
.right-sidebar .right-sidebar-body {
    border: none !important;
}

.right-sidebar .right-sidebar-body #appRightPanelContent,
.right-sidebar .right-sidebar-body #appRightPanelContent > * {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Dark theme: same chrome language as Fluent UI modal */
[data-theme="dark"] .right-sidebar {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
    .right-sidebar {
        border-color: rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    }
}
