/* 题目选择弹窗样式 */
.question-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        background: rgba(0, 0, 0, 0);
    }
    to {
        opacity: 1;
        background: rgba(0, 0, 0, 0.85);
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    margin: 0;
    color: #2634b5;
    font-size: 24px;
    font-weight: 600;
}

.close-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

.image-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.image-container img {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    border-radius: 12px;
}

.question-boxes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.question-box {
    position: absolute;
    border: 3px solid #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    z-index: 999;
}

.question-box:hover {
    border-color: #ff5252;
    background: rgba(255, 82, 82, 0.2);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transform: scale(1.02);
}

.question-box.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transform: scale(1.02);
}

.question-box.calculation {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.15);
}

.question-box.calculation:hover {
    border-color: #1976D2;
    background: rgba(25, 118, 210, 0.2);
}

.question-box.calculation.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.question-label {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border-radius: 8px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    line-height: 1.2;
    text-align: center;
}

.question-box.calculation .question-label {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.question-box.selected .question-label {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    transform: scale(1.1);
}

.detection-info {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border-left: 4px solid #2634b5;
}

.detection-count {
    font-size: 18px;
    color: #2634b5;
    margin-bottom: 8px;
    font-weight: 600;
}

.instruction {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.rotate-info {
    color: #28a745;
    font-size: 13px;
    font-style: italic;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
}

.btn-primary, .btn-secondary {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5CBF60, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7a8288, #6c757d);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.3);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .modal-content {
        padding: 20px;
        margin: 20px;
        max-width: 95%;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .question-label {
        min-width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        padding: 16px 24px;
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        padding: 16px;
        margin: 10px;
        border-radius: 12px;
    }
    
    .modal-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .close-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .image-container img {
        max-height: 50vh;
    }
    
    .question-label {
        min-width: 24px;
        height: 24px;
        font-size: 10px;
        margin: 2px;
    }
    
    .detection-info {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    .detection-count {
        font-size: 16px;
    }
    
    .instruction {
        font-size: 13px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 14px 20px;
        font-size: 14px;
    }
}

/* 横屏优化 */
@media (orientation: landscape) and (max-height: 600px) {
    .modal-content {
        max-height: 95%;
        padding: 12px;
    }
    
    .image-container img {
        max-height: 40vh;
    }
    
    .detection-info {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .modal-actions {
        margin-top: 16px;
    }
    
    .modal-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
}

/* 动画效果 */
.question-box {
    animation: questionBoxAppear 0.3s ease forwards;
    opacity: 0;
}

.question-box:nth-child(1) { animation-delay: 0.1s; }
.question-box:nth-child(2) { animation-delay: 0.2s; }
.question-box:nth-child(3) { animation-delay: 0.3s; }
.question-box:nth-child(4) { animation-delay: 0.4s; }
.question-box:nth-child(5) { animation-delay: 0.5s; }

@keyframes questionBoxAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 加载状态 */
.question-boxes.loading::after {
    content: "🔍 正在检测题目...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
