/* Frontend Styles for Vocabulary Matching Plugin */

.vmp-test-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 3px;
    box-shadow: 1px 1px 10px #888888;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Test Introduction */
.vmp-test-intro {
    text-align: center;
    padding: 20px 10px;
}

.vmp-test-title {
    font-size: 2.5em;
    margin-bottom: 8px;
    color: #1e293b;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vmp-test-description {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.vmp-test-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.vmp-info-item {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding: 8px 10px;
    border-radius: 3px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.vmp-info-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.vmp-info-item strong {
    display: block;
    color: #495057;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.vmp-info-item span {
    font-size: 1.3em;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.vmp-instructions {
    text-align: left;
    max-width: 600px;
    margin: 0 auto 20px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 3px;
    border-left: 4px solid #007cba;
}

.vmp-instructions h3 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #333;
}

.vmp-instructions ul {
    margin: 0;
    padding-left: 20px;
}

.vmp-instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Buttons */
.vmp-btn {
    display: inline-block;
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.vmp-btn-primary {
    background: #007cba;
    color: white;
}

.vmp-btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.vmp-btn-large {
    padding: 8px 16px;
    font-size: 18px;
}

/* Test Interface */
.vmp-test-interface {
    min-height: 450px;
}

.vmp-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0 5px 0;
    margin-bottom: 7px;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
}

/* Progress Bar */
.vmp-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #e9ecef;
    border-radius: 1px;
}

.vmp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #005a87);
    border-radius: 1px;
    transition: width 0.9s ease;
    width: 0%;
}

.vmp-progress {
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
}

.vmp-timer-container {
    text-align: center;
}

.vmp-timer {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 5px 5px;
    border-radius: 3px;
    font-size: 1.1em;
    font-weight: 400;
    min-width: 80px;
}

.vmp-lives {
    display: flex;
    align-items: center;
    gap: 5px;
}

.vmp-lives-label {
    font-weight: 600;
    color: #495057;
}

.vmp-lives-display {
    display: flex;
    gap: 5px;
}

.vmp-life {
    font-size: 1.5em;
    transition: all 0.3s ease;
}

.vmp-life.active {
    color: #dc3545;
}

.vmp-life.inactive {
    color: #dee2e6;
}

/* Question Area */
.vmp-question-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 350px;
    align-items: center;
}

.vmp-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.vmp-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vmp-question-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.vmp-question-image:hover {
    transform: scale(1.02);
}

.vmp-image-clue {
    margin-top: 8px;
    font-size: 1.1em;
    color: #666;
    font-style: italic;
    line-height: 1.4;
}

.vmp-words-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.vmp-words-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.vmp-word-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 8px 10px;
    border-radius: 3px;
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    /* Mobile touch improvements - allow scrolling */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.vmp-word-item:hover {
    background: #e9ecef;
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Mobile-specific hover state */
@media (hover: none) and (pointer: coarse) {
    .vmp-word-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .vmp-word-item:active {
        background: #e9ecef;
        border-color: #007cba;
        transform: scale(0.98);
    }
}

.vmp-word-item.used {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e9ecef;
}

/* Word selection styles for click interaction */
.vmp-word-item.selected {
    background: #007cba;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    border: 2px solid #005a87;
}

/* Click instruction styles */
.vmp-click-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    color: #007cba;
    padding: 8px 16px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    animation: flash 2s infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes flash {
    0%, 50% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1);
    }
    25%, 75% { 
        opacity: 0.3; 
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Select word message styles */
.vmp-select-word-message {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 3px;
    text-align: center;
    margin-bottom: 10px;
    border: 1px solid #ffeaa7;
    font-size: 14px;
}

/* Permanent correct feedback styles */
.vmp-permanent-feedback {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 3px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 200px;
    z-index: 100;
}

.vmp-correct-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding: 5px;
    background: #d4edda;
    border-radius: 3px;
    border-left: 4px solid #28a745;
}

.vmp-correct-item:last-child {
    margin-bottom: 0;
}

.vmp-correct-icon {
    color: #28a745;
    font-weight: bold;
    margin-right: 8px;
    font-size: 16px;
}

.vmp-correct-text {
    color: #155724;
    font-size: 14px;
    font-weight: 500;
}

/* Feedback */
.vmp-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    padding: 20px 40px;
    border-radius: 3px;
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    min-width: 200px;
    animation: vmp-feedback-show 0.5s ease;
}

.vmp-feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.vmp-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

@keyframes vmp-feedback-show {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Results */
.vmp-test-results {
    text-align: center;
    padding: 20px 10px;
}

.vmp-results-title {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #333;
}

.vmp-score-display {
    margin-bottom: 20px;
}

.vmp-score-circle {
    display: inline-block;
    width: 100px;
    height: 100px;
    border: 4px solid #007cba;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    margin: 0 auto;
}

.vmp-score-number {
    font-size: 2em;
    font-weight: 400;
    line-height: 1;
}

.vmp-score-label {
    font-size: 0.6em;
    font-weight: 500;
    margin-top: 5px;
}

.vmp-results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.vmp-stat-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 3px;
    border: 1px solid #e9ecef;
}

.vmp-stat-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.vmp-stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: 600;
    color: #007cba;
}

/* Responsive Design */
@media (max-width: 768px) {
    .vmp-test-container {
        padding: 15px;
        margin: 10px;
    }
    
    .vmp-test-title {
        font-size: 2em;
    }
    
    .vmp-test-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .vmp-test-header {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .vmp-question-area {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .vmp-words-list {
        max-width: 100%;
    }
    
    .vmp-score-circle {
        width: 75px;
        height: 75px;
    }
    
    .vmp-score-number {
        font-size: 2.2em;
    }
    
    .vmp-results-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .vmp-test-container {
        padding: 10px;
        margin: 5px;
    }
    
    .vmp-test-title {
        font-size: 1.8em;
    }
    
    .vmp-instructions {
        padding: 20px;
    }
    
    .vmp-btn-large {
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .vmp-feedback {
        font-size: 1.2em;
        padding: 15px 25px;
        min-width: 150px;
    }
}

/* Loading States */
.vmp-loading {
    opacity: 0.6;
    pointer-events: none;
}

.vmp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 3px;
    animation: vmp-spin 1s linear infinite;
}

@keyframes vmp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.vmp-word-item:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.vmp-question-image:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .vmp-test-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .vmp-btn {
        display: none;
    }
    
    .vmp-test-interface,
    .vmp-test-results {
        display: none;
    }
}

.vmp-restart-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s ease;
}