/* Plant ID Quiz Tool - Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #2d5a2d;
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.loading,
.error-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-config {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.quiz-config h2 {
    color: #2d5a2d;
    margin-bottom: 2rem;
    text-align: center;
}

.config-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.config-section:last-of-type {
    border-bottom: none;
}

.config-section h3 {
    color: #2d5a2d;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.selection-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.selection-controls button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.selection-controls button:hover {
    background: #5a6268;
}

.random-selection {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.random-selection label {
    font-size: 0.9rem;
    color: #495057;
    margin: 0;
}

.random-selection input[type="number"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.random-selection button {
    background: #28a745 !important;
}

.random-selection button:hover {
    background: #218838 !important;
}

.selection-count {
    margin-left: auto;
    font-weight: 600;
    color: #2d5a2d;
}

.species-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.species-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.species-item:hover {
    background: #e8f5e8;
}

.species-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.species-item label {
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.2;
    margin: 0;
    flex: 1;
}

.species-latin {
    font-style: italic;
    color: #2d5a2d;
    font-weight: 600;
}

.species-common {
    color: #666;
    font-size: 0.85rem;
}

.species-family {
    color: #6f42c1;
    font-size: 0.8rem;
    font-style: italic;
}


.question-count-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-count-selection label {
    font-weight: 600;
    color: #2d5a2d;
}

.question-count-selection input[type="number"] {
    width: 150px;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.question-count-selection input[type="number"]:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.config-actions {
    text-align: center;
    margin-top: 2rem;
}

.start-quiz-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-quiz-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.start-quiz-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.quiz-interface {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.progress {
    font-weight: 600;
    color: #2d5a2d;
}

.score {
    font-weight: 600;
    color: #2d5a2d;
}

.image-container {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    overflow: hidden;
}

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

.dual-images {
    display: flex;
    gap: 10px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10px;
}

.image-with-location {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-height: 100%;
}

.dual-images .plant-image {
    width: 100%;
    max-width: 100%;
    flex-shrink: 1;
    object-fit: contain;
    max-height: calc(100% - 30px);
}

.image-location {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.plant-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-loading,
.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 1.1rem;
}

.no-image {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 20px;
}

.question-section {
    padding: 2rem 1.5rem;
}

.question-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #2d5a2d;
    font-size: 1.1rem;
}

.question-section input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.question-section input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.question-section input:disabled {
    background-color: #f8f9fa;
    color: #666;
}

.questions-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.progressive-question {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.progressive-question.current {
    border-color: #007bff;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.progressive-question.completed {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.progressive-question.completed::before {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progressive-question.incorrect {
    border-color: #dc3545;
    background: linear-gradient(135deg, #fff8f8 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.progressive-question .question-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
    line-height: 1.4;
}

.progressive-question .question-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    margin-bottom: 0.75rem;
}

.progressive-question input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.progressive-question input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background: #fafbff;
}

.progressive-question input:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    border-color: #e9ecef;
    cursor: not-allowed;
}

.progressive-question button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #007bff;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 100px;
}

.progressive-question button:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.progressive-question button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.progressive-question .feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    border-left: 4px solid;
}

.progressive-question .feedback.correct {
    background: linear-gradient(135deg, #d4edda 0%, #f8fff9 100%);
    color: #155724;
    border-left-color: #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.1);
}

.progressive-question .feedback.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #fff8f8 100%);
    color: #721c24;
    border-left-color: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.progressive-question .feedback button {
    margin-top: 0.75rem;
    background: #28a745;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.progressive-question .feedback button:hover {
    background: #1e7e34;
}

.class-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.class-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.class-input-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.class-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.class-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

button {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

button:hover {
    background: #218838;
    transform: translateY(-1px);
}

button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.feedback {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-correct {
    color: #28a745;
    font-weight: 600;
}

.feedback-incorrect {
    color: #dc3545;
    font-weight: 600;
}

.current-answer {
    padding: 1rem 1.5rem;
    background: #e8f5e8;
    border-top: 1px solid #d4edda;
    font-style: italic;
    color: #155724;
}

.current-answer .hidden {
    display: none;
}

.question-type-indicator {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #007bff;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 0.75rem;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid white;
    position: relative;
    top: -1px;
}

.question-type-latin {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.question-type-common {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

.question-type-family {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    box-shadow: 0 2px 6px rgba(111, 66, 193, 0.3);
}

.question-type-class {
    background: linear-gradient(135deg, #e91e63 0%, #fd7e14 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(233, 30, 99, 0.3);
}

/* Responsive Design for Progressive Questions */
@media (max-width: 768px) {
    .questions-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .progressive-question {
        padding: 1rem;
    }
    
    .progressive-question .question-label {
        font-size: 1rem;
    }
    
    .progressive-question .question-input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .progressive-question input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .progressive-question button {
        padding: 0.75rem 1rem;
        width: 100%;
        min-width: auto;
    }
    
    .question-type-indicator {
        display: block;
        margin: 0.5rem 0 0 0;
        text-align: center;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }
}

.quiz-complete {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-complete h2 {
    color: #2d5a2d;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.quiz-complete p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.quiz-complete button {
    margin-top: 1rem;
}

footer {
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #28a745;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    /* Configuration screen mobile styles */
    .quiz-config {
        padding: 1rem;
    }
    
    .species-list {
        grid-template-columns: 1fr;
    }
    
    .selection-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .selection-controls button {
        width: 100%;
    }
    
    .random-selection {
        justify-content: center;
    }
    
    .random-selection input[type="number"] {
        width: 80px;
    }
    
    .selection-count {
        margin-left: 0;
        text-align: center;
    }
    
    .question-count-selection input[type="number"] {
        width: 100%;
    }
    
    .config-section h3 {
        font-size: 1.1rem;
    }
    
    .species-item {
        padding: 0.75rem 0.5rem;
    }
    
    .species-item label {
        font-size: 0.85rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .image-container {
        height: 300px;
    }
    
    .question-section {
        padding: 1.5rem 1rem;
    }
    
    .feedback {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Observation links */
.observation-links {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.observation-links-header {
    margin-bottom: 0.8rem;
    color: #2d5a2d;
}

.observation-link {
    margin-bottom: 0.6rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.observation-link:last-child {
    margin-bottom: 0;
}

.observation-link a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    display: block;
    margin-bottom: 0.2rem;
}

.observation-link a:hover {
    text-decoration: underline;
}

.observation-details {
    color: #6c757d;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .image-container {
        height: 250px;
    }
    
    .quiz-complete h2 {
        font-size: 1.5rem;
    }
}
