/* Reusable Component Styles */

/* Card Component - Base styles shared by all card types
 * Usage: Apply .card class along with specific card types:
 *   - <div class="card stat-card"> for statistics cards
 *   - <div class="card card-borderless card-sm"> for auth forms
 */
.card {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 1.5rem;
    width: 100%;
}

/* Borderless variant for forms and special cases */
.card-borderless {
    border: none;
    padding: 2rem;
}

.card-sm {
    max-width: 400px;
}

.card-md {
    max-width: 600px;
}

.card-lg {
    max-width: 800px;
}

/* Mobile optimizations for cards */
@media screen and (max-width: 480px) {
    .card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .card-borderless {
        padding: 1.5rem;
    }
}

/* Card header styling */
.card h1,
.card h2 {
    margin-bottom: 1.5rem;
    color: var(--md-sys-color-on-surface);
    text-align: center;
}

/* Card form styling */
.card form {
    display: flex;
    flex-direction: column;
}

.card label {
    margin-bottom: 0.5rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
}

.card input {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
}

.card input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.card button {
    padding: 0.75rem;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.card button:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-primary) 80%, var(--md-sys-color-primary-fixed));
    color: var(--md-sys-color-on-primary);
}

.card button:active {
    transform: scale(0.98);
}

.card p {
    color: var(--md-sys-color-primary);
    text-align: center;
}

/* Button Group - Horizontal button layout */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.button-group button {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
}

/* Mobile: Stack buttons vertically */
@media screen and (max-width: 480px) {
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        max-width: none;
    }
}

/* Memory Game Component */
.memory-game .passage-display {
    min-height: 150px;
    padding: 1rem;
    margin: 1rem 0;
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--md-sys-color-on-surface);
    text-align: left;
}

.memory-game .passage-display:empty::before {
    content: "Click a button below to reveal the passage...";
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

/* Game Selector - Toggle between different memory games */
.game-selector {
    margin-top: 0;
    margin-bottom: 0.5rem;
    flex-wrap: nowrap;
}

.game-selector button {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    flex: 1;
    min-width: auto;
    white-space: nowrap;
}

.game-selector button:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.game-selector button.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}

/* Icon Button Group - Compact horizontal layout for icon-based controls */
.button-group-icons {
    flex-wrap: nowrap;
}

.button-group-icons button {
    min-width: 48px;
    max-width: none;
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-group-icons svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Override mobile stacking for game selector and icon groups */
@media screen and (max-width: 480px) {
    .game-selector,
    .button-group-icons {
        flex-direction: row;
    }
    
    .game-selector button,
    .button-group-icons button {
        max-width: none;
    }
}

/* Hold to Reveal button - visual feedback when pressed */
.memory-game button[data-action="hold-reveal"]:active {
    background-color: var(--md-sys-color-tertiary);
    color: var(--md-sys-color-on-tertiary);
}