/* Initial Survey Panel - Right Side Vertical Display */

.study-page-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    position: relative;
}

.study-page-container:not(:has(.initial-survey-panel[style*="display: none"])) {
    grid-template-columns: 1fr 350px;
}

.study-page-container:has(.initial-survey-panel[style*="display: none"]) {
    grid-template-columns: 1fr;
}

/* Initial Survey Panel */
.initial-survey-panel {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--theme-primary, #2196F3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.survey-header {
    background: linear-gradient(135deg, var(--theme-primary, #2196F3), var(--theme-accent, #1976d2));
    color: white;
    padding: 20px;
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
}

.survey-header h3 {
    margin: 0 0 12px 0;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.survey-header h3 i {
    font-size: 1.2em;
}

.survey-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    opacity: 0.95;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    margin-top: 10px;
}

.survey-date i {
    font-size: 1.1em;
}

/* Survey Scores Container */
.survey-scores {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.survey-scores::-webkit-scrollbar {
    width: 8px;
}

.survey-scores::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.survey-scores::-webkit-scrollbar-thumb {
    background: var(--theme-primary, #2196F3);
    border-radius: 4px;
}

.survey-scores::-webkit-scrollbar-thumb:hover {
    background: var(--theme-accent, #1976d2);
}

/* Individual Score Card */
.score-card {
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 5px solid var(--theme-primary, #2196F3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    animation: scoreCardSlideIn 0.4s ease-out;
}

@keyframes scoreCardSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.score-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.score-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.score-name {
    font-weight: 600;
    font-size: 1em;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-name i {
    color: var(--theme-primary, #2196F3);
    font-size: 1.1em;
}

.score-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--theme-primary, #2196F3);
    line-height: 1;
}

.score-max {
    font-size: 0.9em;
    color: #666;
    margin-left: 2px;
}

.score-interpretation {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-style: italic;
}

.score-interpretation.perfect {
    color: #4caf50;
    font-weight: 600;
}

.score-interpretation.good {
    color: #8bc34a;
    font-weight: 600;
}

.score-interpretation.moderate {
    color: #ff9800;
    font-weight: 600;
}

.score-interpretation.severe {
    color: #f44336;
    font-weight: 600;
}

/* Empty State */
.survey-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.survey-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.survey-empty p {
    margin: 8px 0;
    font-size: 0.95em;
}

/* Close Button */
.btn-close-survey {
    margin: 15px 20px 20px;
    padding: 12px;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.btn-close-survey:hover {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
    transform: translateY(-2px);
}

.btn-close-survey i {
    font-size: 1.1em;
}

/* Show Survey Button (when hidden) */
.btn-show-survey {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    padding: 15px;
    background: linear-gradient(135deg, var(--theme-primary, #2196F3), var(--theme-accent, #1976d2));
    color: white;
    border: none;
    border-radius: 12px 0 0 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.2);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    z-index: 900;
}

.btn-show-survey:hover {
    right: 25px;
    box-shadow: -6px 6px 16px rgba(0, 0, 0, 0.25);
}

.btn-show-survey i {
    display: block;
    margin-bottom: 8px;
    font-size: 1.3em;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .study-page-container {
        grid-template-columns: 1fr;
    }
    
    .initial-survey-panel {
        position: fixed;
        right: -370px;
        top: 60px;
        height: calc(100vh - 60px);
        max-height: none;
        width: 350px;
        z-index: 1000;
        transition: right 0.3s ease;
        border-radius: 0;
    }
    
    .initial-survey-panel.show {
        right: 0;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 768px) {
    .initial-survey-panel {
        width: 100%;
        right: -100%;
    }
    
    .initial-survey-panel.show {
        right: 0;
    }
    
    .survey-header h3 {
        font-size: 1.1em;
    }
    
    .score-card {
        padding: 12px;
    }
    
    .score-value {
        font-size: 1.5em;
    }
}

/* Print Styles */
@media print {
    .initial-survey-panel {
        position: static !important;
        display: block !important;
        page-break-before: always;
        box-shadow: none;
        border: 2px solid #ccc;
    }
    
    .btn-close-survey,
    .btn-show-survey {
        display: none !important;
    }
    
    .survey-scores {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Accessibility */
.score-card:focus-within {
    outline: 3px solid var(--theme-primary, #2196F3);
    outline-offset: 2px;
}

/* Animation for score updates */
@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.score-value.updating {
    animation: scoreUpdate 0.5s ease;
}

/* Badge for completed status */
.score-card.completed::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4);
}

.score-card {
    position: relative;
}
