/* =====================================================
   BATCH MODAL - VERTICAL BAR GRAPH DESIGN (RESTORED)
   Field of Practice Distribution - Matching Reference Image
   ===================================================== */

/* Main container - Glass morphism design matching theme */
.batch-field-graph {
    margin: 2rem 0;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, 
        rgba(30, 58, 138, 0.15) 0%, 
        rgba(30, 64, 175, 0.20) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Decorative top border gradient */
.batch-field-graph::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.6) 20%, 
        rgba(147, 51, 234, 0.6) 50%, 
        rgba(59, 130, 246, 0.6) 80%, 
        transparent 100%
    );
    border-radius: 20px 20px 0 0;
}

/* Title */
.batch-field-graph-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    padding-bottom: 1rem;
}

.batch-field-graph-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(59, 130, 246, 0.8), 
        transparent
    );
    border-radius: 2px;
}

/* ========================================
   LEGEND AT TOP - Enhanced pills design
   ======================================== */

.batch-legend-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Legend pill items - Glassmorphism */
.batch-legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.08) 0%, 
        rgba(255, 255, 255, 0.04) 100%
    );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.batch-legend-pill:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.12) 0%, 
        rgba(255, 255, 255, 0.08) 100%
    );
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    border-color: rgba(59, 130, 246, 0.3);
}

.batch-legend-pill-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.batch-legend-pill:hover .batch-legend-pill-color {
    box-shadow: 
        0 3px 10px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.batch-legend-pill-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========================================
   VERTICAL BARS GRID - Matching Reference Image
   ======================================== */

.batch-bars-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.75rem;
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    min-height: 280px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

/* Subtle grid lines for better readability */
.batch-bars-grid::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.batch-bars-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

/* Individual bar wrapper */
.batch-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.batch-bar-wrapper:hover {
    transform: translateY(-4px);
}

/* Bar container (background track for the bar) */
.batch-bar-container {
    width: 100%;
    height: 200px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.1) 100%
    );
    border-radius: 10px 10px 4px 4px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.batch-bar-wrapper:hover .batch-bar-container {
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.25);
}

/* Bar fill - The actual colored bar */
.batch-bar-fill {
    width: 100%;
    height: 0%;
    border-radius: 8px 8px 0 0;
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 
        0 -2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.75rem;
}

/* Count value on top of bar */
.batch-bar-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Shimmer effect on bar fill */
.batch-bar-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%
    );
    animation: barShimmer 3s infinite;
}

@keyframes barShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.batch-bar-wrapper:hover .batch-bar-fill {
    filter: brightness(1.15) saturate(1.1);
}

/* Label section below bar */
.batch-bar-label-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    width: 100%;
    padding: 0.5rem 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
}

.batch-bar-wrapper:hover .batch-bar-label-section {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    transform: scale(1.02);
}

/* Bar label text */
.batch-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.batch-bar-wrapper:hover .batch-bar-label {
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Total badge - Enhanced glassmorphism */
.batch-total-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: linear-gradient(135deg, 
        rgba(148, 163, 184, 0.25) 0%, 
        rgba(148, 163, 184, 0.15) 100%
    );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(148, 163, 184, 0.35);
    padding: 0.65rem 1.25rem;
    border-radius: 12px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.batch-total-badge:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, 
        rgba(148, 163, 184, 0.35) 0%, 
        rgba(148, 163, 184, 0.25) 100%
    );
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Large Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .batch-field-graph {
        padding: 2rem 1.5rem;
    }

    .batch-field-graph-title {
        font-size: 1.2rem;
    }

    .batch-bars-grid {
        gap: 1.5rem;
        padding: 2rem 1.25rem 1.25rem 1.25rem;
        min-height: 240px;
    }

    .batch-bar-container {
        height: 180px;
    }

    .batch-bar-value {
        font-size: 1.1rem;
    }

    .batch-total-badge {
        font-size: 1.4rem;
        padding: 0.55rem 1rem;
    }
}

/* Mobile (480px - 768px) */
@media (max-width: 768px) {
    .batch-field-graph {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    .batch-field-graph-title {
        font-size: 1.05rem;
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
    }

    .batch-legend-top {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        padding: 0.85rem 0.6rem;
        flex-wrap: wrap;
    }

    .batch-legend-pill {
        padding: 0.35rem 0.7rem;
    }

    .batch-legend-pill-color {
        width: 10px;
        height: 10px;
    }

    .batch-legend-pill-label {
        font-size: 0.725rem;
    }

    .batch-bars-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
        padding: 1.5rem 0.75rem 0.75rem 0.75rem;
        min-height: 200px;
    }

    .batch-bar-wrapper {
        gap: 0.6rem;
    }

    .batch-bar-container {
        height: 160px;
        border-radius: 8px 8px 3px 3px;
    }

    .batch-bar-value {
        font-size: 0.95rem;
        padding-top: 0.5rem;
    }

    .batch-bar-label {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .batch-bar-label-section {
        padding: 0.4rem 0.2rem;
    }

    .batch-total-badge {
        font-size: 1.2rem;
        padding: 0.45rem 0.85rem;
        top: 1rem;
        right: 1rem;
    }
}

/* Small Mobile (<480px) */
@media (max-width: 480px) {
    .batch-field-graph {
        padding: 1.25rem 0.75rem;
        margin: 1.5rem 0;
    }

    .batch-field-graph-title {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .batch-legend-top {
        gap: 0.4rem;
        padding: 0.75rem 0.5rem;
        margin-bottom: 1.25rem;
    }

    .batch-legend-pill {
        padding: 0.3rem 0.6rem;
    }

    .batch-legend-pill-color {
        width: 9px;
        height: 9px;
    }

    .batch-legend-pill-label {
        font-size: 0.675rem;
    }

    .batch-bars-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.6rem;
        padding: 1.25rem 0.5rem 0.5rem 0.5rem;
        min-height: 180px;
    }

    .batch-bar-wrapper {
        gap: 0.5rem;
    }

    .batch-bar-container {
        height: 140px;
    }

    .batch-bar-value {
        font-size: 0.85rem;
        padding-top: 0.4rem;
    }

    .batch-bar-label {
        font-size: 0.625rem;
        font-weight: 700;
    }

    .batch-bar-label-section {
        padding: 0.3rem 0.15rem;
        gap: 0.25rem;
    }

    .batch-total-badge {
        font-size: 1.05rem;
        padding: 0.4rem 0.7rem;
        top: 0.75rem;
        right: 0.75rem;
        border-radius: 10px;
    }
}

/* Extra Small Mobile (<380px) */
@media (max-width: 380px) {
    .batch-bars-grid {
        gap: 0.4rem;
        padding: 1rem 0.35rem 0.35rem 0.35rem;
        min-height: 160px;
    }

    .batch-bar-container {
        height: 120px;
    }

    .batch-bar-value {
        font-size: 0.75rem;
    }

    .batch-bar-label {
        font-size: 0.575rem;
    }

    .batch-legend-pill-label {
        font-size: 0.625rem;
    }
}

/* ========================================
   ANIMATIONS - Smooth and Professional
   ======================================== */

@keyframes batchGraphFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.batch-field-graph {
    animation: batchGraphFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-legend-pill {
    animation: legendPillFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes legendPillFadeIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Stagger animation for legend pills */
.batch-legend-pill:nth-child(1) { animation-delay: 0.05s; }
.batch-legend-pill:nth-child(2) { animation-delay: 0.1s; }
.batch-legend-pill:nth-child(3) { animation-delay: 0.15s; }
.batch-legend-pill:nth-child(4) { animation-delay: 0.2s; }
.batch-legend-pill:nth-child(5) { animation-delay: 0.25s; }

.batch-bar-wrapper {
    animation: barFadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes barFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for bars */
.batch-bar-wrapper:nth-child(1) { animation-delay: 0.15s; }
.batch-bar-wrapper:nth-child(2) { animation-delay: 0.2s; }
.batch-bar-wrapper:nth-child(3) { animation-delay: 0.25s; }
.batch-bar-wrapper:nth-child(4) { animation-delay: 0.3s; }
.batch-bar-wrapper:nth-child(5) { animation-delay: 0.35s; }

.batch-total-badge {
    animation: badgePop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.4s backwards;
}

@keyframes badgePop {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ========================================
   ACCESSIBILITY - WCAG 2.1 AA Compliant
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .batch-field-graph {
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    .batch-legend-pill {
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
    
    .batch-bar-container {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .batch-total-badge {
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .batch-field-graph,
    .batch-legend-pill,
    .batch-bar-wrapper,
    .batch-total-badge {
        animation: none;
    }
    
    .batch-bar-fill {
        transition: height 0.2s linear;
    }
    
    .batch-bar-fill::before {
        animation: none;
    }
    
    * {
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for keyboard navigation */
.batch-legend-pill:focus-visible,
.batch-bar-wrapper:focus-visible,
.batch-total-badge:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.8);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Screen reader only text */
.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;
}

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

@media print {
    .batch-field-graph {
        break-inside: avoid;
        page-break-inside: avoid;
        background: white;
        border: 2px solid #333;
    }
    
    .batch-field-graph-title,
    .batch-legend-pill-label,
    .batch-bar-label {
        color: #000;
    }
    
    .batch-bars-grid {
        min-height: 200px;
    }
    
    .batch-bar-container {
        height: 160px;
        border: 1px solid #333;
    }

    .batch-total-badge {
        border: 2px solid #333;
        color: #000;
    }
}