/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: url('/static/image/achtergrond.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    z-index: -1;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.team-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.team-info h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.score {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-admin {
    background: #e74c3c;
    color: white;
}

.btn-admin:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-danger {
    background: #d32f2f;
    color: white;
    border: 2px solid #b71c1c;
}

.btn-danger:hover {
    background: #b71c1c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(211, 47, 47, 0.4);
}

/* Teams List */
#teamsList {
    margin-top: 20px;
}

.teams-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.team-item-manage {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.team-item-manage:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.team-item-info h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 5px;
}

.team-item-info p {
    color: #666;
    margin: 0;
}

.team-item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-edit:hover {
    background: #e0a800;
}

.team-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s;
    text-decoration: none;
    display: block;
}

.team-item:hover {
    transform: scale(1.05);
}

.team-item h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.team-item p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Login Page */
.login-card {
    max-width: 500px;
    margin: 0 auto;
}

.error-message-login {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #f5c6cb;
}

/* Puzzles */
.puzzles-container {
    display: grid;
    gap: 25px;
}

.puzzle-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #667eea;
}

.puzzle-card.completed {
    border-left-color: #2ecc71;
    opacity: 0.8;
}

.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.puzzle-header h3 {
    color: #333;
    font-size: 1.4rem;
}

.points {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.puzzle-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.answer-form {
    margin-top: 20px;
}

.answer-form .form-group {
    display: flex;
    gap: 10px;
}

.answer-form input {
    flex: 1;
}

.answer-form button {
    white-space: nowrap;
}

.completed-badge {
    background: #2ecc71;
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
}

.feedback {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    display: none;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.attempts {
    color: #666;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Leaderboard Matrix */
.leaderboard-matrix {
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.matrix-table th,
.matrix-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.matrix-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.matrix-table .team-column {
    text-align: left;
    min-width: 180px;
}

.matrix-table .score-column {
    min-width: 80px;
    font-weight: 700;
}

.matrix-table .puzzle-column {
    min-width: 60px;
}

.team-name-cell {
    text-align: left;
    font-weight: 600;
    color: #333;
}

.score-cell {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

.status-cell {
    padding: 8px;
}

.status-circle {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ddd;
}

.status-circle.green {
    background: #2ecc71;
    border-color: #27ae60;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.4);
}

.status-circle.red {
    background: #e74c3c;
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.status-circle.grey {
    background: #ecf0f1;
    border-color: #bdc3c7;
}

.matrix-table tr.gold-row {
    background: rgba(255, 215, 0, 0.1);
}

.matrix-table tr.silver-row {
    background: rgba(192, 192, 192, 0.1);
}

.matrix-table tr.bronze-row {
    background: rgba(205, 127, 50, 0.1);
}

.matrix-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Admin Gear Icon */
.admin-gear {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    z-index: 1000;
    text-decoration: none;
    cursor: pointer;
}

.admin-gear:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* Legend - Compact Version */
.legend-compact {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    opacity: 0.7;
}

.legend-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-item span {
    font-size: 0.85rem;
    color: white;
}

/* Admin Section */
.admin-section {
    display: grid;
    gap: 30px;
}

.puzzles-list table,
.teams-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.puzzles-list th,
.puzzles-list td,
.teams-list th,
.teams-list td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.puzzles-list th,
.teams-list th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.puzzles-list code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e74c3c;
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* No Data */
.no-data {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

/* Single Puzzle View */
.game-header {
    text-align: center;
}

.team-info-compact {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.team-name {
    font-size: 1.3rem;
    font-weight: 600;
}

.score-display {
    font-size: 1.3rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
}

.progress-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
    display: inline-block;
}

.puzzle-single {
    max-width: 800px;
    margin: 0 auto;
}

.puzzle-content {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.puzzle-title {
    color: #667eea;
    font-size: 2rem;
    margin-bottom: 30px;
}

.puzzle-description {
    color: #333;
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 40px;
}

.answer-form-single {
    max-width: 500px;
    margin: 0 auto;
}

.answer-form-single input {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    transition: border-color 0.3s;
}

.answer-form-single input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-large {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.2rem;
    margin-top: 20px;
}

.completion-screen {
    text-align: center;
    color: white;
    padding: 60px 20px;
}

.completion-screen h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.completion-screen h2 {
    font-size: 2rem;
    margin-bottom: 30px;
}

.final-score {
    font-size: 1.5rem;
    margin: 20px 0;
}

/* Balloon Animation */
.balloon-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.balloon {
    position: absolute;
    bottom: -150px;
    width: 60px;
    height: 80px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: float-up 4s ease-out forwards;
}

.balloon::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid inherit;
}

.balloon-string {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 60px;
    opacity: 0.6;
}

@keyframes float-up {
    0% {
        bottom: -150px;
        opacity: 1;
        transform: translateX(0) rotate(0deg);
    }
    50% {
        transform: translateX(20px) rotate(10deg);
    }
    100% {
        bottom: 110%;
        opacity: 0;
        transform: translateX(-20px) rotate(-10deg);
    }
}

/* Red Cross Animation */
.red-cross-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.red-cross-container.show {
    opacity: 1;
}

.red-cross {
    position: relative;
    width: 200px;
    height: 200px;
    animation: shake 0.5s ease-in-out;
}

.cross-line {
    position: absolute;
    background: #e74c3c;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
}

.cross-line-1 {
    width: 200px;
    height: 30px;
    top: 85px;
    left: 0;
    transform: rotate(45deg);
    animation: draw-line 0.4s ease-out;
}

.cross-line-2 {
    width: 200px;
    height: 30px;
    top: 85px;
    left: 0;
    transform: rotate(-45deg);
    animation: draw-line 0.4s ease-out 0.2s backwards;
}

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

@keyframes draw-line {
    0% {
        width: 0;
        opacity: 0;
    }
    100% {
        width: 200px;
        opacity: 1;
    }
}

/* Puzzle List (selection page) */
.puzzle-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.puzzle-list-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.puzzle-list-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    border-color: #667eea;
}

.puzzle-list-item.completed {
    background: #d4edda;
    border-color: #28a745;
}

.puzzle-list-number {
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 20px;
    flex-shrink: 0;
}

.puzzle-list-item.completed .puzzle-list-number {
    background: #28a745;
}

.puzzle-list-content {
    flex: 1;
}

.puzzle-list-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.3rem;
    color: #333;
}

.puzzle-list-points {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

.puzzle-list-status {
    font-size: 2rem;
    margin-left: 15px;
}

/* New Puzzle Single Page */
.puzzel-body {
    transition: background-color 0.5s ease;
}

.puzzel-body.correct-answer {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.puzzel-body.incorrect-answer {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.puzzle-single-new {
    max-width: 800px;
    margin: 0 auto;
}

.puzzle-content-new {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.answer-form-new {
    max-width: 500px;
    margin: 0 auto;
}

.code-display {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #28a745;
}

.code-label {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 15px;
}

.code-value {
    font-size: 3rem;
    font-weight: bold;
    color: #28a745;
    font-family: 'Courier New', monospace;
    letter-spacing: 5px;
}

.success-message {
    text-align: center;
    color: #28a745;
    margin-top: 30px;
}

.success-message h3 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.success-message p {
    font-size: 1.5rem;
}

.error-message {
    text-align: center;
    color: #e74c3c;
    margin-top: 30px;
}

.error-message h3 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.error-message p {
    font-size: 1.5rem;
}

/* Danger Zone */
.danger-zone {
    background: #fff3e0;
    border: 3px solid #ff9800;
    border-radius: 15px;
    padding: 30px;
    margin: 40px 0;
    text-align: center;
}

.danger-zone h3 {
    color: #d32f2f;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.danger-zone p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Beheer Menu */
.beheer-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.beheer-menu-card {
    background: white;
    border-radius: 20px;
    padding: 50px 30px;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    border: 3px solid transparent;
}

.beheer-menu-card:hover {
    transform: translateY(-10px);
    border-color: #667eea;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
}

.beheer-menu-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.beheer-menu-card h2 {
    font-size: 1.8rem;
    color: #667eea;
    margin-bottom: 15px;
}

.beheer-menu-card p {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
}

/* Locked Puzzle Page */
.locked-puzzle {
    text-align: center;
}

.lock-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.locked-message {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
}

.locked-message p {
    font-size: 1.2rem;
    color: #856404;
    margin-bottom: 15px;
}

.locked-message p:last-child {
    margin-bottom: 0;
}

.locked-message .hint {
    font-weight: 600;
    color: #667eea;
}

.locked-info {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

.locked-info h3 {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.previous-puzzle-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
}

/* Team Selection Cards */
.team-select-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-decoration: none;
    display: block;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.team-select-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.team-select-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.team-select-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    text-align: center;
    margin: 0;
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
    font-size: 0.9rem;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.footer-left a {
    color: #667eea;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-left a:hover {
    opacity: 0.7;
}

.footer-right {
    font-weight: 500;
}

/* Add padding to body to prevent content from being hidden behind footer */
body {
    padding-bottom: 60px;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 20px;
    }

    .puzzle-content {
        padding: 30px 20px;
    }

    .puzzle-title {
        font-size: 1.5rem;
    }

    .puzzle-description {
        font-size: 1.1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    #teamsList {
        grid-template-columns: 1fr;
    }

    .puzzle-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .answer-form .form-group {
        flex-direction: column;
    }

    .nav-links {
        flex-direction: column;
    }

    .leaderboard table {
        font-size: 0.9rem;
    }

    .leaderboard .position {
        font-size: 1.2rem;
        width: 60px;
    }

    .team-info-compact {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
        gap: 15px;
    }

    .team-name {
        font-size: 1.5rem;
    }

    .score-display {
        font-size: 1.8rem;
        padding: 12px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .red-cross {
        width: 150px;
        height: 150px;
    }

    .cross-line-1,
    .cross-line-2 {
        width: 150px;
        height: 25px;
        top: 62px;
    }

    .balloon {
        width: 45px;
        height: 60px;
    }

    .completion-screen h1 {
        font-size: 2rem;
    }

    .completion-screen h2 {
        font-size: 1.5rem;
    }
}