/* ========================================
   Lego Builder Competition - Main Styles
   ======================================== */

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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #f6ad55;
    --danger-color: #f56565;
    --bg-light: #f7fafc;
    --bg-dark: #2d3748;
    --text-dark: #1a202c;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #fff 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   Welcome Page
   ======================================== */

.welcome-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.welcome-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.welcome-content h1 {
    font-size: 48px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content .subtitle {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 30px;
}

.welcome-description {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: left;
}

.welcome-features {
    text-align: left;
    margin: 30px 0;
}

.welcome-features h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.welcome-features ul {
    list-style: none;
}

.welcome-features li {
    padding: 8px 0;
    font-size: 16px;
}

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
}

/* ========================================
   Game Page
   ======================================== */

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

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    font-size: 40px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.challenge-prompt {
    color: var(--text-light);
    font-size: 16px;
    font-style: italic;
}

.game-content {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.player-section {
    flex: 1;
}

.player-section h2 {
    margin-bottom: 15px;
    color: var(--text-dark);
}

.image-upload-box {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    background: var(--bg-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-upload-box:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--bg-light) 0%, rgba(102, 126, 234, 0.05) 100%);
}

.image-upload-box input[type="file"] {
    display: none;
}

.upload-placeholder {
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text-light);
}

.upload-placeholder p {
    margin: 10px 0;
}

.upload-placeholder .small {
    font-size: 12px;
}

.image-preview {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 24px;
    color: var(--secondary-color);
    padding: 0 20px;
    height: 100px;
}

/* ========================================
   Buttons
   ======================================== */

.primary-btn, .secondary-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

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

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

.challenge-join-btn:disabled {
    background-color: #b0bec5 !important;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.7;
}

.secondary-btn {
    background: var(--border-color);
    color: var(--text-dark);
}

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

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

/* ========================================
   Loading & Error States
   ======================================== */

.spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner-circle {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: #fed7d7;
    color: var(--danger-color);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid var(--danger-color);
}

/* ========================================
   Results Page
   ======================================== */

.results-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h1 {
    font-size: 40px;
    background: linear-gradient(135deg, var(--success-color) 0%, var(--warning-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.winner-section {
    text-align: center;
    padding: 30px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.winner-badge {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.winner-section h2 {
    font-size: 36px;
    color: var(--success-color);
    margin-bottom: 10px;
}

.winner-subtitle {
    color: var(--text-light);
    font-size: 18px;
}

.scores-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.score-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.score-card h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.score-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.score-item:last-child {
    border-bottom: none;
}

.score-item.total {
    font-weight: bold;
    font-size: 16px;
    color: var(--secondary-color);
    padding-top: 10px;
}

.ai-feedback {
    background: white;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
    border-radius: 5px;
}

.ai-feedback h4 {
    margin-bottom: 10px;
}

.ai-feedback p {
    color: var(--text-light);
    line-height: 1.8;
}

.images-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.images-section h3 {
    margin-bottom: 20px;
}

.submitted-images {
    display: flex;
    justify-content: center;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-comparison img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.history-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.history-section h3 {
    margin-bottom: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .game-content {
        flex-direction: column;
        gap: 20px;
    }

    .vs-divider {
        height: 40px;
        writing-mode: horizontal-tb;
        transform: rotate(90deg);
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .image-comparison {
        grid-template-columns: 1fr;
    }

    .welcome-content {
        padding: 25px;
    }

    .welcome-content h1 {
        font-size: 32px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}
