/**
 * BiRSAT Real-Time Results Styling
 */

/* Result containers */
.indicator-result {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
    background: #f9f9f9;
    transition: all 0.3s ease;
}

.indicator-result.result-green {
    border-color: #28a745;
    background: #d4edda;
}

.indicator-result.result-red {
    border-color: #dc3545;
    background: #f8d7da;
}

.indicator-result h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

/* Result details */
.result-details {
    font-size: 14px;
    line-height: 1.8;
}

.sub-result {
    margin: 8px 0;
    padding: 8px;
    background: white;
    border-radius: 4px;
}

.final-score {
    margin-top: 15px;
    padding: 12px;
    background: white;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    margin-left: 10px;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

/* Status badge in accordion headers */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    font-size: 0.9rem;
}

.status-badge i {
    font-size: 1.1rem;
}

.accordion-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-button .status-badge .badge {
    font-size: 0.75rem;
    padding: 3px 8px;
}

/* Overall Summary */
.overall-summary {
    position: sticky;
    top: 80px;
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 100;
}

.overall-summary h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-align: center;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
}

.stat-value.grade-A {
    color: #00ff88;
}

.stat-value.grade-B {
    color: #88ff00;
}

.stat-value.grade-C {
    color: #ffdd00;
}

.stat-value.grade-D {
    color: #ffaa00;
}

.stat-value.grade-F {
    color: #ff4444;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(255,255,255,0.3);
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88 0%, #00ddff 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-weight: bold;
}

/* Indicator Breakdown */
.indicator-breakdown {
    margin-top: 20px;
}

.indicator-breakdown h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.indicator-badge {
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.indicator-badge:hover {
    transform: scale(1.05);
}

.indicator-badge.pass {
    background: #28a745;
    color: white;
}

.indicator-badge.fail {
    background: #dc3545;
    color: white;
}

/* Result display area in accordion */
.accordion-result {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

/* Animation for results */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.indicator-result {
    animation: slideIn 0.3s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    .summary-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .indicator-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .overall-summary {
        position: relative;
        top: 0;
    }
}

@media (max-width: 576px) {
    .indicator-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* Floating summary button for mobile */
.summary-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    font-size: 24px;
}

@media (max-width: 768px) {
    .summary-toggle {
        display: block;
    }
    
    .overall-summary.mobile-hidden {
        display: none;
    }
}

/* Loading state */
.calculating {
    opacity: 0.6;
    pointer-events: none;
}

.calculating::after {
    content: "Calculating...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
}

/* Tooltip for explanations */
.info-tooltip {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    cursor: help;
    margin-left: 5px;
}

.info-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: 5px;
}

/* Table styling for E1 energy data */
.energy-table {
    width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
}

.energy-table th,
.energy-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.energy-table th {
    background: #f1f1f1;
    font-weight: bold;
}

.energy-table input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Highlight active accordion */
.accordion-item.active {
    border-left: 4px solid #007bff;
}

/* Score visualization */
.score-meter {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.score-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444 0%, #ffaa00 25%, #ffdd00 50%, #88ff00 75%, #00ff88 100%);
    transition: width 0.3s ease;
}

/* Print styles */
@media print {
    .overall-summary {
        position: relative;
        top: 0;
    }
    
    .summary-toggle {
        display: none;
    }
    
    .accordion-button {
        display: none;
    }
    
    .accordion-collapse {
        display: block !important;
    }
}
