/* ============================================================================
   PROJECT OVERVIEW SIDEBAR - ENHANCED STYLES
   ============================================================================

   This file contains the enhanced styling for the ProjectOverviewSidebar
   component, providing clear visual hierarchy and sticky positioning.

   Version: 2.0 (Enhanced)
   Reference: /docs/design/ui-design-system-spec.md

   IMPROVEMENTS:
   - Visual hierarchy with section labels and values
   - Elevation and border for prominence
   - Sticky positioning for persistent visibility
   - Status badges with semantic colors
   - Responsive behavior
   - Accessibility enhancements

   ============================================================================ */

/* ============================================================================
   SIDEBAR CONTAINER
   ============================================================================ */

.project-overview-sidebar {
    background-color: #F8F9FA; /* Light gray background */
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--medtronic-blue-primary); /* Prominent left border */
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md); /* COMPACT: Reduced from lg (24px) to md (16px) */

    /* Sticky positioning */
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;

    /* Smooth scrolling */
    scroll-behavior: smooth;
}

/* Dark mode support for sidebar container */
@media (prefers-color-scheme: dark) {
    .project-overview-sidebar {
        background-color: #1a1a2e;
        border-color: #2d2d44;
    }
}

/* Scrollbar styling for sidebar */
.project-overview-sidebar::-webkit-scrollbar {
    width: 6px;
}

.project-overview-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.project-overview-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--medtronic-gray-lighter);
    border-radius: 3px;
}

.project-overview-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--medtronic-gray-light);
}

/* ============================================================================
   SIDEBAR HEADER
   ============================================================================ */

.sidebar-header {
    margin-bottom: var(--spacing-sm); /* COMPACT: Reduced from lg (24px) to sm (8px) */
    padding-bottom: var(--spacing-xs); /* COMPACT: Reduced from md (16px) to xs (4px) */
    border-bottom: 2px solid var(--border-color);
}

.sidebar-title {
    font-size: 16px; /* COMPACT: Slightly smaller */
    font-weight: 700;
    color: var(--medtronic-blue-primary);
    margin: 0 0 2px 0; /* COMPACT: Minimal margin */
    display: flex;
    align-items: center;
    gap: var(--spacing-xs); /* COMPACT: Reduced gap */
}

.sidebar-title .icon {
    font-size: 18px; /* COMPACT: Slightly smaller */
}

.sidebar-subtitle {
    font-size: 12px; /* COMPACT: Slightly smaller */
    color: #555555; /* CONTRAST: Improved from #999999 */
    margin: 0;
}

/* Dark mode header */
@media (prefers-color-scheme: dark) {
    .sidebar-header {
        border-bottom-color: #3d3d5c;
    }

    .sidebar-title {
        color: #7eb8ff;
    }

    .sidebar-subtitle {
        color: #b0b0c0; /* CONTRAST: Light gray for dark mode */
    }
}

/* ============================================================================
   SIDEBAR SECTIONS
   ============================================================================ */

.sidebar-section {
    margin-bottom: var(--spacing-sm); /* COMPACT: Reduced from lg (24px) to sm (8px) */
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

/* Section Label (uppercase, small, bold) - IMPROVED CONTRAST */
.sidebar-label,
.section-label {
    font-size: 10px; /* COMPACT: Slightly smaller */
    font-weight: 700;
    color: #4a4a5a; /* CONTRAST: Much darker than #999999 for light mode */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px; /* COMPACT: Reduced from spacing-xs (4px) */
    display: block;
}

/* Section Value (larger, bold, dark) - COMPACT */
.sidebar-value,
.section-value {
    font-size: 14px; /* COMPACT: Reduced from 16px */
    font-weight: 600;
    color: var(--medtronic-gray-dark);
    margin-bottom: 0; /* COMPACT: Removed margin */
    display: block;
    word-break: break-word;
    line-height: 1.3; /* COMPACT: Tighter line height */
}

/* Empty value placeholder */
.sidebar-value.empty,
.section-value.empty {
    color: #777777; /* CONTRAST: Improved from text-muted */
    font-style: italic;
    font-weight: 400;
}

/* Dark mode for sections */
@media (prefers-color-scheme: dark) {
    .sidebar-label,
    .section-label {
        color: #a0a0b8; /* CONTRAST: Light gray for dark backgrounds */
    }

    .sidebar-value,
    .section-value {
        color: #e8e8f0; /* CONTRAST: Near-white for dark mode */
    }

    .sidebar-value.empty,
    .section-value.empty {
        color: #888899; /* CONTRAST: Muted but visible */
    }
}

/* ============================================================================
   DIVIDERS
   ============================================================================ */

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: var(--spacing-xs) 0; /* COMPACT: Reduced from md (16px) to xs (4px) */
    border: none;
}

.sidebar-divider.thick {
    height: 1px; /* COMPACT: Reduced from 2px */
    background-color: var(--medtronic-gray-lighter);
    margin: var(--spacing-sm) 0; /* COMPACT: Slightly more space for thick dividers */
}

/* Dark mode dividers */
@media (prefers-color-scheme: dark) {
    .sidebar-divider {
        background-color: #3d3d5c;
    }

    .sidebar-divider.thick {
        background-color: #4d4d6c;
    }
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px; /* COMPACT: Reduced from 6px */
    padding: 3px 8px; /* COMPACT: Reduced from 6px 12px */
    border-radius: var(--radius-sm);
    font-size: 11px; /* COMPACT: Reduced from 12px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Status variants */
.status-badge.status-draft {
    background-color: rgba(108, 117, 125, 0.15);
    color: var(--status-neutral);
    border: 1px solid var(--status-neutral);
}

.status-badge.status-active {
    background-color: rgba(40, 167, 69, 0.15);
    color: var(--status-success);
    border: 1px solid var(--status-success);
}

.status-badge.status-on-hold {
    background-color: rgba(255, 193, 7, 0.15);
    color: #856404;
    border: 1px solid var(--status-warning);
}

.status-badge.status-completed {
    background-color: rgba(0, 75, 135, 0.15);
    color: var(--medtronic-blue-medium);
    border: 1px solid var(--medtronic-blue-medium);
}

.status-badge.status-delayed {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--status-error);
    border: 1px solid var(--status-error);
}

/* ============================================================================
   PRIORITY BADGES
   ============================================================================ */

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px; /* COMPACT: Reduced from 6px */
    padding: 3px 8px; /* COMPACT: Reduced from 6px 12px */
    border-radius: var(--radius-sm);
    font-size: 11px; /* COMPACT: Reduced from 12px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Priority variants */
.priority-badge.priority-critical {
    background-color: var(--status-error);
    color: var(--text-light);
}

.priority-badge.priority-high {
    background-color: var(--medtronic-yellow);
    color: var(--medtronic-gray-dark);
}

.priority-badge.priority-medium {
    background-color: var(--medtronic-blue-interactive);
    color: var(--text-light);
}

.priority-badge.priority-low {
    background-color: var(--medtronic-gray-light);
    color: var(--text-light);
}

/* Badge icon */
.status-badge .icon,
.priority-badge .icon {
    font-size: 12px; /* COMPACT: Reduced from 14px */
}

/* ============================================================================
   METADATA DISPLAY
   ============================================================================ */

.sidebar-metadata {
    display: flex;
    flex-direction: column;
    gap: 2px; /* COMPACT: Reduced from spacing-sm (8px) */
}

.metadata-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px; /* COMPACT: Reduced from 13px */
    padding: 2px 0; /* COMPACT: Reduced from spacing-xs (4px) */
}

.metadata-row .label {
    color: #5a5a6a; /* CONTRAST: Improved from text-muted (#999) */
    font-weight: 500; /* CONTRAST: Slightly bolder */
}

.metadata-row .value {
    color: var(--medtronic-gray-dark);
    font-weight: 600;
    text-align: right;
}

/* Dark mode metadata */
@media (prefers-color-scheme: dark) {
    .metadata-row .label {
        color: #a0a0b8; /* CONTRAST: Visible on dark backgrounds */
    }

    .metadata-row .value {
        color: #e0e0f0; /* CONTRAST: Light for dark mode */
    }
}

/* Highlight important metadata */
.metadata-row.highlight {
    background-color: rgba(16, 16, 235, 0.05);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    margin: var(--spacing-xs) calc(-1 * var(--spacing-sm));
}

/* ============================================================================
   QUICK ACTIONS (Optional)
   ============================================================================ */

.sidebar-actions {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.sidebar-action-btn {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: transparent;
    border: 1px solid var(--medtronic-blue-interactive);
    color: var(--medtronic-blue-interactive);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.sidebar-action-btn:hover {
    background-color: var(--medtronic-blue-interactive);
    color: var(--text-light);
}

.sidebar-action-btn.secondary {
    border-color: var(--medtronic-gray-lighter);
    color: var(--medtronic-gray-dark);
}

.sidebar-action-btn.secondary:hover {
    background-color: var(--bg-light);
    border-color: var(--medtronic-gray-light);
}

/* ============================================================================
   SCORE/RANK DISPLAY (Visual Enhancement)
   ============================================================================ */

.score-display {
    background: linear-gradient(135deg, #E7F3FF 0%, #D0E7FF 100%);
    border: 1px solid var(--medtronic-blue-interactive);
    border-radius: var(--radius-sm); /* COMPACT: Smaller radius */
    padding: var(--spacing-sm); /* COMPACT: Reduced from md (16px) to sm (8px) */
    text-align: center;
    margin-bottom: var(--spacing-xs); /* COMPACT: Reduced from md to xs */
}

.score-label {
    font-size: 10px; /* COMPACT: Reduced from 11px */
    font-weight: 700;
    color: #5a5a6a; /* CONTRAST: Improved from text-muted */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px; /* COMPACT: Reduced from spacing-xs */
}

.score-value {
    font-size: 24px; /* COMPACT: Reduced from 32px */
    font-weight: 700;
    color: var(--medtronic-blue-interactive);
    line-height: 1;
    margin-bottom: 2px; /* COMPACT: Reduced from spacing-xs */
}

.score-subtitle {
    font-size: 11px; /* COMPACT: Reduced from 12px */
    color: #666666; /* CONTRAST: Improved from text-secondary */
}

/* Dark mode score display */
@media (prefers-color-scheme: dark) {
    .score-display {
        background: linear-gradient(135deg, #1a2a4a 0%, #2a3a5a 100%);
        border-color: #4a6aaa;
    }

    .score-label {
        color: #b0b0c0;
    }

    .score-value {
        color: #7eb8ff;
    }

    .score-subtitle {
        color: #a0a0b0;
    }
}

/* ============================================================================
   PHASE INDICATOR (Mini Progress)
   ============================================================================ */

.phase-indicator {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs); /* COMPACT: Reduced from sm (8px) to xs (4px) */
    margin-bottom: var(--spacing-xs); /* COMPACT: Reduced from md to xs */
}

.phase-indicator .current-phase {
    font-size: 12px; /* COMPACT: Reduced from 13px */
    font-weight: 600;
    color: var(--medtronic-blue-primary);
    margin-bottom: 2px; /* COMPACT: Reduced from spacing-xs */
}

.phase-indicator .progress-mini {
    width: 100%;
    height: 3px; /* COMPACT: Reduced from 4px */
    background-color: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
}

.phase-indicator .progress-mini-fill {
    height: 100%;
    background-color: var(--medtronic-blue-interactive);
    border-radius: 2px;
    transition: width var(--transition-base);
}

/* Dark mode phase indicator */
@media (prefers-color-scheme: dark) {
    .phase-indicator {
        background-color: #1a1a2e;
        border-color: #3d3d5c;
    }

    .phase-indicator .current-phase {
        color: #7eb8ff;
    }

    .phase-indicator .progress-mini {
        background-color: #2d2d44;
    }
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 1199px) {
    .project-overview-sidebar {
        padding: var(--spacing-sm); /* COMPACT: More compact on smaller screens */
    }

    .sidebar-value,
    .section-value {
        font-size: 13px; /* COMPACT: Reduced from 15px */
    }
}

@media (max-width: 1023px) {
    .project-overview-sidebar {
        position: relative !important;
        top: 0 !important;
        max-height: none !important;
        margin-top: var(--spacing-md); /* COMPACT: Reduced from lg */
    }
}

@media (max-width: 767px) {
    .project-overview-sidebar {
        padding: var(--spacing-sm); /* COMPACT: Reduced from md */
    }

    .sidebar-title {
        font-size: 14px; /* COMPACT: Reduced from 16px */
    }

    .sidebar-value,
    .section-value {
        font-size: 13px; /* COMPACT: Reduced from 14px */
    }

    .metadata-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px; /* COMPACT: Reduced from 4px */
    }

    .metadata-row .value {
        text-align: left;
    }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* Focus visible for interactive elements */
.sidebar-action-btn:focus-visible {
    outline: 2px solid var(--medtronic-blue-interactive);
    outline-offset: 2px;
}

/* Screen reader only text */
.sidebar .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .project-overview-sidebar {
        border-width: 2px;
        border-left-width: 6px;
    }

    .status-badge,
    .priority-badge {
        border-width: 2px;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .project-overview-sidebar {
        position: relative !important;
        top: 0 !important;
        max-height: none !important;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .sidebar-actions {
        display: none;
    }
}
