/**
 * Christian Wordle Styles
 * Game board, keyboard, and UI styling
 */

#christian-wordle-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    position: relative;
}

#christian-wordle-container h2 {
    color: #333;
    margin-bottom: 0;
    font-size: 2em;
    font-weight: bold;
}

/* Game Board */
#game-board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 15px 0 30px;
    align-items: center;
    position: relative;
}

.word-row {
    display: flex;
    gap: 5px;
}

.letter-tile {
    width: 62px;
    height: 62px;
    border: 2px solid #d3d6da;
    border-radius: var(--bb-block-radius-inner);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    user-select: none;
    transition: all 0.3s ease;
}

.letter-tile.filled {
    border-color: #878a8c;
    animation: pop 0.1s ease-in-out;
}

.letter-tile.correct {
    background-color: var(--ODBUgreen);
    border-color: var(--ODBUgreen);
    color: white;
}

.letter-tile.partial {
    background-color: var(--ODBUyellow);
    border-color: var(--ODBUyellow);
    color: white;
}

.letter-tile.absent {
    background-color: var(--ODBUdarkgray);
    border-color: var(--ODBUdarkgray);
    color: white;
}

.letter-tile.flip {
    transform: rotateX(90deg);
    transition: transform 0.25s ease-in-out;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Shake animation for invalid guesses */
.word-row.shake {
    animation: shake 0.6s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

/* Keyboard */
#keyboard {
    margin: 30px 0;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.keyboard-key {
    min-width: 43px;
    height: 58px;
    border: none;
    border-radius: 4px;
    background-color: #d3d6da;
    color: #333;
    font-size: 0.875rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: all 0.1s ease;
    margin: 5px 0 !important;
}

.keyboard-key:hover {
    background-color: #c3c6ca;
}

.keyboard-key:active {
    transform: scale(0.95);
}

.keyboard-key.special-key {
    min-width: 65px;
    font-size: 0.75rem;
}

.keyboard-key.correct {
    background-color: var(--ODBUgreen);
    color: white;
}

.keyboard-key.partial {
    background-color: var(--ODBUyellow);
    color: white;
}

.keyboard-key.absent {
    background-color: var(--ODBUdarkgray);
    color: white;
}

/* Game Messages */
#game-messages {
    margin: 20px 0;
}

.game-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
}

.game-message.success {
    background-color: var(--ODBUgreen);
    color: #ffffff;
    border: 1px solid var(--ODBUgreen);
}

.game-message.error {
    background-color: var(--bb-danger-color);;
    color: #ffffff;
    border: 1px solid var(--bb-danger-color);;
}

.game-message.info {
    background-color: var(--ODBUyellow);
    color: #ffffff;
    border: 1px solid var(--ODBUyellow);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Verse Reveal */
.verse-highlight {
    color: white;
    border: 3px solid var(--ODBUblue);
    padding: 25px;
    border-radius: var(--bb-block-radius);
    margin: 30px 0;
}

.verse-highlight h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--ODBUblue);
    font-size: 1.5em;
}

.verse-highlight blockquote {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--ODBUblue);
    font-weight: 400;
}

.verse-highlight blockquote p {
    margin-bottom: 0;
    font-style: italic;
}

/* Game Stats */
.game-stats {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.game-stats h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.game-stats p {
    margin: 8px 0;
    color: #555;
}

.game-stats strong {
    color: #333;
}

/* Info icon and tooltip */
.tools {
    margin-top: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: .875em;
    flex-wrap: wrap;
}

.tools span {
    cursor: pointer;
}

.tools span:hover {
    color: var(--ODBUblue);
}

.tools i {
    font-weight: 500;
    margin-right: 5px;
}

.tools .panel {
    background: var(--bb-content-alternate-background-color);
    border-radius: var(--bb-block-radius);
    padding: 15px;
    font-size: 0.875em;
    text-align: center;
    flex: 0 0 100%;
}

.tools #cw-instructions-panel {
    text-align: left;
}

.tools .panel h3 {
    margin-bottom: 10px;
}

.tools .panel ul {
    margin-bottom: 5px
}

.tools .panel ul li {
    line-height: 2em;
}

.tools .panel ul ul {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    #christian-wordle-container {
        padding: 15px;
    }

    .letter-tile {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .keyboard-key {
        min-width: 30px;
        height: 48px;
        font-size: 0.75rem;
        padding: 0;
    }

    .keyboard-key.special-key {
        min-width: 55px;
        font-size: 0.65rem;
    }

    .word-row {
        gap: 3px;
    }

    .keyboard-row {
        gap: 4px;
    }

    #verse-reveal {
        padding: 20px;
    }

    #verse-reveal blockquote {
        font-size: 1em;
    }
}

@media (max-width: 320px) {
    .letter-tile {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .keyboard-key {
        min-width: 30px;
        height: 42px;
        font-size: 0.7rem;
        padding: 0;
    }

    .keyboard-key.special-key {
        min-width: 50px;
        font-size: 0.6rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Admin Page Styles */
.wrap .form-table th {
    font-weight: 600;
}

.wrap .description {
    font-style: italic;
    color: #666;
}

#fetch-result {
    margin-top: 15px;
}

#fetch-result .notice {
    display: inline-block;
    margin: 0;
    padding: 8px 12px;
}

/* Accessibility */
.keyboard-key:focus {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

.letter-tile:focus {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .letter-tile {
        border-width: 3px;
    }

    .letter-tile.correct {
        background-color: #0d7377;
    }

    .letter-tile.partial {
        background-color: #b8860b;
    }

    .letter-tile.absent {
        background-color: #2f2f2f;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .letter-tile {
        transition: none;
    }

    .letter-tile.flip {
        transform: none;
    }

    @keyframes pop {

        0%,
        100% {
            transform: none;
        }
    }

    @keyframes shake {

        0%,
        100% {
            transform: none;
        }
    }

    @keyframes fadeIn {

        from,
        to {
            opacity: 1;
            transform: none;
        }
    }
}

#game-board.cw-blur .word-row {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
    opacity: 0.7;
    transition: filter 0.3s, opacity 0.3s;
}

#cw-share-btn-container {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none; /* allow clicks to pass through except for the button */
}

#cw-share-btn-container.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#cw-share-btn-container #cw-share-btn {
    pointer-events: auto;
    z-index: 11;
}

#cw-share-btn-container #cw-share-btn i {
    font-weight: 300;
    margin-right: 5px;
}

/* Widget Styles */
.widget_christian_wordle_widget {
    text-align: center;
}

#cw-widget-lightbox {
    display: none;
    position: fixed;
    z-index: 9999999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

#cw-widget-lightbox.active {
    display: flex !important;
}

.cw-widget-lightbox-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px 24px;
    max-width: 600px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

#cw-widget-lightbox-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 2em;
    color: #333;
    cursor: pointer;
    z-index: 10001;
}

.cw-widget-verse-reveal {
    color: white;
    border: 1px solid var(--ODBUblue);
    padding: 10px;
    border-radius: var(--bb-block-radius);
    margin: 5px 0;
    text-align: center;
}

.cw-widget-verse-reveal h3,
.cw-widget-verse-reveal p {
    margin-bottom: 0;
    color: var(--ODBUblue);
}