/*
 * © 2025 Dr Michael Guo. All rights reserved.
 */

/* 
   Styles specific to the game pages
   Extending the Apple-inspired design system from the main stylesheet
*/

/* Game Page Base Styles */
.game-page {
    background-color: var(--light-color);
}

.game-page main {
    margin-top: 8rem; /* Accounts for fixed header */
    min-height: calc(100vh - 8rem - 40rem); /* Accounting for header and approximate footer height */
}

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

/* Game Header */
.game-header {
    background-color: var(--background-color);
    padding: 6.4rem 0;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

.game-header h1 {
    margin-bottom: 1.2rem;
    font-size: 4.2rem;
}

.game-header p {
    color: var(--secondary-color);
    font-size: 2rem;
    max-width: 60rem;
    margin: 0 auto;
}

/* Game Content */
.game-content {
    padding: 6.4rem 2.4rem;
}

.game-content .container {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 4.8rem;
}

.game-instructions {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    padding: 3.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    align-self: start;
}

.game-instructions h2 {
    font-size: 2.8rem;
    margin-bottom: 2.4rem;
}

.game-instructions ol {
    margin-left: 2.4rem;
    margin-bottom: 3.2rem;
}

.game-instructions li {
    margin-bottom: 1.2rem;
    font-size: 1.6rem;
}

.difficulty-selector {
    margin-top: 4rem;
}

.difficulty-selector h3 {
    font-size: 2rem;
    margin-bottom: 1.6rem;
}

.difficulty-buttons {
    display: flex;
    gap: 1.2rem;
}

.difficulty-btn {
    padding: 1.2rem 2.4rem;
    border-radius: 9999px;
    border: none;
    background-color: var(--light-color);
    font-size: 1.6rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.difficulty-btn:hover {
    background-color: #ebebeb;
}

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

/* Game Area */
.game-area {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    padding: 3.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    position: relative;
}

.game-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2.4rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.score, .timer {
    padding: 1rem 1.6rem;
    background-color: var(--light-color);
    border-radius: 8px;
}

.transaction-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2.4rem;
    margin-bottom: 3.2rem;
}

.transaction-card h3 {
    font-size: 2rem;
    margin-bottom: 1.2rem;
    color: var(--secondary-color);
}

.transaction-card p {
    font-size: 2rem;
    margin-bottom: 0;
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 3.2rem;
    margin-bottom: 3.2rem;
}

.accounts-list {
    /* Use a vertical list with tighter spacing so more items fit on screen */
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    max-height: 70vh; /* prevent it from growing off-screen */
    overflow-y: auto;
    padding-right: 0.4rem; /* space for scrollbar */
}

.account-item {
    padding: 0.6rem 1rem;
    background-color: var(--light-color);
    border-radius: 6px;
    cursor: grab;
    font-size: 1.5rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    user-select: none;
}

.account-item:hover {
    background-color: #ebebeb;
    transform: translateY(-2px);
}

.account-item.dragging {
    opacity: 0.5;
}

.entry-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.4rem;
}

.entry-column {
    text-align: center;
}

.entry-column h3 {
    font-size: 2rem;
    margin-bottom: 1.6rem;
}

.entry-dropzone {
    min-height: 12rem;
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.6rem;
    transition: all var(--transition-speed) ease;
}

.entry-dropzone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(0, 113, 227, 0.05);
}

.entry-dropzone .placeholder {
    color: var(--secondary-color);
    font-size: 1.6rem;
}

.entry-dropzone .account-item {
    width: 90%;
    text-align: center;
    margin-bottom: 0.4rem;
}

.entry-dropzone .account-item.dropped {
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
}

.entry-dropzone .account-item.dropped:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 2.4rem;
    margin-top: 4rem;
}

.primary-btn, .secondary-btn {
    padding: 1.6rem 3.2rem;
    border-radius: 9999px;
    border: none;
    font-size: 1.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

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

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 113, 227, 0.2);
}

.primary-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

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

.secondary-btn:disabled {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
}

.reset-btn {
    background-color: #ff9500;
    color: white;
    padding: 1.6rem 3.2rem;
    border-radius: 9999px;
    border: none;
    font-size: 1.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.reset-btn:hover {
    background-color: #e6850e;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(255, 149, 0, 0.3);
}

.reset-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Feedback and Game Complete Screens */
#game-feedback, #game-complete {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: var(--border-radius);
    padding: 3.2rem;
    text-align: center;
}

#game-feedback.hidden, #game-complete.hidden {
    display: none;
}

#feedback-content {
    margin-bottom: 4rem;
    font-size: 2rem;
}

#game-complete h2 {
    font-size: 4.2rem;
    margin-bottom: 2.4rem;
}

.final-score {
    margin-bottom: 4rem;
    font-size: 2.4rem;
}

.final-score p {
    margin-bottom: 1.2rem;
}

.game-complete-buttons {
    display: flex;
    gap: 2.4rem;
}

/* Correct/Incorrect Styles */
.correct-answer {
    background-color: var(--success-color) !important;
    color: white;
}

.incorrect-answer {
    background-color: #ff3b30 !important;
    color: white;
}

/* Additional Styles for Balance Builder Game */
.game-layout {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    margin-bottom: 3.2rem;
}

.accounts-container {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2.4rem;
    flex: 1;
    min-width: 300px;
}

.accounts-container h3 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.statement-builder {
    flex: 1;
    min-width: 400px;
    margin-bottom: 3.2rem;
}

.statement-section h3 {
    font-size: 2.4rem;
    margin-bottom: 2.4rem;
    text-align: center;
    color: var(--primary-color);
}

.statement-category {
    margin-bottom: 2.4rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2rem;
}

.statement-category h4 {
    font-size: 2rem;
    margin-bottom: 1.6rem;
    color: var(--dark-color);
}

.statement-dropzone {
    min-height: 10rem;
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 1.6rem;
    transition: all var(--transition-speed) ease;
}

.statement-dropzone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(0, 113, 227, 0.05);
}

.placed-account {
    margin: 0.8rem 0;
    text-align: left;
}

.balance-checker {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2.4rem;
    margin-bottom: 3.2rem;
}

.balance-display {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    font-size: 1.8rem;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.balance-result {
    font-size: 2.2rem;
    font-weight: 600;
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--background-color);
}

/* Game Tips Section */
.game-tips {
    margin-top: 2.4rem;
    padding: 2rem;
    background-color: rgba(0, 113, 227, 0.05);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.game-tips h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
}

.game-tips ul {
    list-style: none;
    padding-left: 0;
}

.game-tips li {
    margin-bottom: 0.8rem;
    padding-left: 2rem;
    position: relative;
}

.game-tips li:before {
    content: "💡";
    position: absolute;
    left: 0;
}

/* Responsive Design */
@media (max-width: 992px) {
    .game-content .container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-header {
        padding: 8rem 2.4rem 4.8rem;
    }

    .game-header h1 {
        font-size: 3.6rem;
    }

    .game-content {
        padding: 4.8rem 2.4rem;
    }

    .game-area {
        padding: 2.4rem;
    }

    .entry-columns {
        grid-template-columns: 1fr;
        gap: 3.2rem;
    }

    .game-controls {
        flex-direction: column;
        gap: 1.6rem;
    }
}

@media (max-width: 576px) {
    .game-header {
        padding: 10rem 1.6rem 3.2rem;
    }

    .game-header h1 {
        font-size: 2.8rem;
        line-height: 1.2;
    }

    .game-header p {
        font-size: 1.6rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }

    .primary-btn, .secondary-btn {
        width: 100%;
    }

    .game-instructions {
        padding: 2.4rem;
    }

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

    .difficulty-btn {
        width: 100%;
    }

    /* Balance Builder responsive layout */
    .game-layout {
        flex-direction: column;
        gap: 2rem;
    }

    .accounts-container,
    .statement-builder {
        min-width: auto;
    }
}
