/* Root variables */
:root {
    --primary-color: #2d5016;
    --secondary-color: #5a8c2e;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-muted: #6c757d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Alerts */
.messages {
    margin: 1rem 0;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
}

/* Info section */
.info-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.info-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Admin styles */
.admin-header {
    margin: 2rem 0;
}

.admin-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.mushroom-section {
    margin: 2rem 0;
}

.mushroom-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-bg);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #333;
}

/* Image grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--light-bg);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.source-link {
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

/* Test styles */
.test-header {
    text-align: center;
    margin: 2rem 0;
}

.test-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.test-info {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.test-questions {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.question-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.question-number {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.question-image {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1.5rem;
}

.question-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.question-input {
    max-width: 500px;
    margin: 0 auto;
}

.test-submit {
    text-align: center;
    margin: 2rem 0;
}

/* Results styles */
.results-header {
    text-align: center;
    margin: 2rem 0;
}

.results-header h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.score-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.score-main {
    text-align: center;
    margin-bottom: 1.5rem;
}

.score-value {
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary-color);
}

.score-label {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.score-details {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-icon {
    font-size: 1.5rem;
}

.results-details {
    margin: 2rem 0;
}

.results-details h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.results-list {
    display: grid;
    gap: 1rem;
}

.result-item {
    display: flex;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    gap: 1rem;
}

.result-item.correct {
    border-left: 4px solid var(--success-color);
}

.result-item.incorrect {
    border-left: 4px solid var(--danger-color);
}

.result-image {
    flex-shrink: 0;
    width: 150px;
    height: 100px;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.result-content {
    flex: 1;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.result-icon {
    font-size: 2rem;
}

.result-info {
    flex: 1;
}

.result-correct-answer,
.result-user-answer {
    margin-bottom: 0.5rem;
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-muted {
    color: var(--text-muted);
}

.results-actions {
    text-align: center;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Login container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-container .card {
    max-width: 400px;
    width: 100%;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .score-value {
        font-size: 3rem;
    }
    
    .result-item {
        flex-direction: column;
    }
    
    .result-image {
        width: 100%;
        height: 200px;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}
