/**
 * Quiz/Learning Mode Styles
 * Visual styles for the study modes feature
 */

/* Quiz Mode Banner */
.quiz-mode-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.quiz-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-target {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
}

.quiz-label {
    font-weight: 500;
    opacity: 0.9;
}

.quiz-drug-name {
    font-weight: 700;
    font-size: 1.3rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.quiz-progress {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Quiz Configuration Modal */
.quiz-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.quiz-modal.show {
    opacity: 1;
}

.quiz-config-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease-out;
}

.quiz-modal.show .quiz-config-content {
    transform: scale(1);
}

.quiz-config-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.quiz-config-content h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}


/* Drug Selection Section */
.selection-section {
    margin-bottom: 2rem;
}

.selection-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ecf0f1;
}

.drug-count-inline {
    margin-left: auto;
    color: #7f8c8d;
    font-weight: 500;
}

/* Drug Selection Tree */
.drug-selection-tree {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
}

.tree-select-node {
    margin: 0.25rem 0;
}

.tree-select-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.tree-select-header:hover {
    background: #e8eaf0;
}

.tree-expand-icon {
    cursor: pointer;
    font-size: 0.8rem;
    width: 16px;
    user-select: none;
    color: #7f8c8d;
}

.tree-expand-spacer {
    width: 16px;
}

.tree-node-checkbox,
.drug-tree-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tree-node-label {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

.tree-node-count {
    font-size: 0.85rem;
    color: #95a5a6;
    padding: 0.125rem 0.5rem;
    background: #ecf0f1;
    border-radius: 10px;
}

.tree-children {
    margin-left: 1.5rem;
    border-left: 2px solid #ecf0f1;
    padding-left: 0.5rem;
}

.tree-select-system .tree-node-label {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
}

.tree-select-therapeutic .tree-node-label {
    font-size: 0.95rem;
}

.tree-select-pharmacologic .tree-node-label {
    font-size: 0.9rem;
}

.tree-select-drug .tree-node-label {
    font-size: 0.9rem;
    font-weight: 400;
}

/* Settings Section */
.settings-section {
    margin-bottom: 1.5rem;
}

.mode-settings {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    background: #f8f9fa;
}

.mode-settings.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-row label {
    font-weight: 500;
    color: #2c3e50;
}

.settings-description {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.settings-note {
    color: #e67e22;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #fef5e7;
    border-radius: 4px;
    border-left: 3px solid #e67e22;
}

.number-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-row input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #d5dbdb;
    border-radius: 4px;
    font-size: 1rem;
}

.input-helper {
    color: #95a5a6;
    font-size: 0.9rem;
}

/* Checkbox Labels */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

/* Footer */
.quiz-config-footer {
    border-top: 1px solid #ecf0f1;
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drug-count {
    color: #7f8c8d;
    font-weight: 500;
}

.quiz-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #2c3e50;
}

/* Quiz Mode Active State */
body.quiz-mode-active .tree-node {
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Correct/Incorrect Feedback */
.tree-node.quiz-correct .tree-header,
.tree-node.quiz-correct .node-header {
    background-color: #2ecc71 !important;
    color: white !important;
    animation: correctFlash 0.6s ease-out;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.6) !important;
}

.tree-node.quiz-incorrect .tree-header,
.tree-node.quiz-incorrect .node-header {
    background-color: #e74c3c !important;
    color: white !important;
    animation: incorrectFlash 0.6s ease-out;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.6) !important;
}

@keyframes correctFlash {
    0% {
        background-color: #2ecc71;
        transform: scale(1);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
    }
    25% {
        background-color: #27ae60;
        transform: scale(1.08);
        box-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
    }
    50% {
        background-color: #2ecc71;
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(46, 204, 113, 0.6);
    }
    100% {
        background-color: #2ecc71;
        transform: scale(1);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
    }
}

@keyframes incorrectFlash {
    0% {
        background-color: #e74c3c;
        transform: translateX(0);
        box-shadow: 0 0 0 rgba(231, 76, 60, 0);
    }
    15% {
        background-color: #c0392b;
        transform: translateX(-12px);
        box-shadow: 0 0 30px rgba(231, 76, 60, 0.8);
    }
    30% {
        background-color: #e74c3c;
        transform: translateX(12px);
        box-shadow: 0 0 25px rgba(231, 76, 60, 0.6);
    }
    45% {
        background-color: #c0392b;
        transform: translateX(-8px);
        box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
    }
    60% {
        background-color: #e74c3c;
        transform: translateX(8px);
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
    }
    75% {
        transform: translateX(-4px);
    }
    90% {
        transform: translateX(4px);
    }
    100% {
        background-color: #e74c3c;
        transform: translateX(0);
        box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
    }
}

/* Success Modal */
.quiz-success-content {
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    max-width: 500px;
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.quiz-success-content h2 {
    color: #2ecc71;
    margin-bottom: 1rem;
}

.quiz-success-content p {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.quiz-score-display {
    margin: 1.5rem 0;
}

.score-large {
    font-size: 3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.score-percentage {
    font-size: 1.5rem;
    color: #7f8c8d;
    font-weight: 600;
}

.score-breakdown {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.score-item {
    font-size: 1.1rem;
    font-weight: 600;
}

.score-item.correct {
    color: #2ecc71;
}

.score-item.incorrect {
    color: #e74c3c;
}

.quiz-success-content .quiz-actions {
    margin-top: 2rem;
}

/* Mode Header */
.mode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.mode-header-icon {
    font-size: 2rem;
}

.mode-description {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Quiz/Learning Buttons in Header */
.quiz-mode-button,
.learning-mode-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.learning-mode-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.quiz-mode-button:hover,
.learning-mode-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.learning-mode-button:hover {
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-config-content {
        width: 95%;
        max-height: 95vh;
        padding: 1.5rem;
    }

    .quiz-mode-banner {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .quiz-info {
        width: 100%;
    }

    .quiz-target {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .quiz-config-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .quiz-actions {
        width: 100%;
        justify-content: stretch;
    }

    .quiz-actions .btn {
        flex: 1;
    }

    .selection-header {
        flex-wrap: wrap;
    }

    .drug-count-inline {
        flex-basis: 100%;
        margin-left: 0;
        text-align: right;
    }
}
