/* Acrostic Viewer Styles */

/* Quote Grid - horizontal layout for quote text */
.acrostic-grid {
    display: grid;
    gap: 1px;
    background-color: #363636;
    padding: 10px;
    border-radius: 8px;
    max-width: none;
    margin: 0;
    width: max-content;
}

/* Scroll container should use full width */
.acrostic-scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
    padding-bottom: 5px;
    position: relative;
}

.acrostic-cell {
    width: 28px;
    height: 28px;
    background-color: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.acrostic-cell:hover {
    background-color: #f5f5f5;
    border-color: #3273dc;
}

.acrostic-cell.active {
    background-color: #e3f2fd;
    border-color: #3273dc;
    box-shadow: 0 0 0 2px rgba(50, 115, 220, 0.2);
}

.acrostic-cell.highlighted {
    background-color: #fff3cd;
    border-color: #ffc107;
}

.acrostic-cell.blocked {
    background-color: #000000 !important;
    border-color: #000000 !important;
    cursor: default;
}

.acrostic-cell.space {
    background-color: #e8e8e8;
    border-color: #d0d0d0;
    cursor: default;
}

.acrostic-cell.punctuation {
    background-color: #f5f5f5;
    border-color: #ddd;
    cursor: default;
    color: #666;
}

.acrostic-cell.revealed {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.acrostic-cell.incorrect {
    background-color: #ffebee;
    color: #c62828;
    animation: shake 0.3s ease-in-out;
}

.acrostic-cell.correct {
    background-color: #e8f5e8;
    color: #2e7d32;
}

/* Cell numbers - standard acrostic format */
.acrostic-cell-number {
    position: absolute;
    top: 1px;
    font-size: 7px;
    font-weight: normal;
    color: #666;
    line-height: 1;
    pointer-events: none;
}

/* Top-left: Sequential quote position (1, 2, 3...) */
.acrostic-cell-pos {
    left: 2px;
}

/* Top-right: Clue letter (A, B, C...) */
.acrostic-cell-clue {
    right: 2px;
}

/* Input styling for acrostic cells */
.acrostic-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    outline: none;
    text-transform: uppercase;
}

.acrostic-input:focus {
    background-color: transparent;
}

/* Clue list styling - bright white text for dark theme */
.clue-list {
    max-height: 500px;
    overflow-y: auto;
}

.clue-item {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
    background-color: rgba(255, 255, 255, 0.05);
}

.clue-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.clue-item.active {
    background-color: rgba(50, 115, 220, 0.3);
    border-left: 3px solid #3273dc;
}

.clue-item.completed {
    background-color: rgba(72, 199, 116, 0.2);
    border-left: 3px solid #48c774;
}

.clue-item.is-acrostic {
    border-left: 3px solid #ffdd57;
}

.clue-item.is-acrostic.active {
    border-left: 3px solid #3273dc;
}

.clue-number {
    font-weight: bold;
    color: #ffdd57;
    margin-right: 8px;
    display: inline-block;
    min-width: 24px;
}

.clue-text {
    color: #ffffff;
    font-weight: 600;
    line-height: 1.4;
}

.clue-answer-boxes {
    display: flex;
    gap: 3px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.clue-answer-box {
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    background-color: #fafafa;
}

.clue-answer-box.filled {
    background-color: #e3f2fd;
    border-color: #3273dc;
}

.clue-answer-box.correct {
    background-color: #e8f5e8;
    border-color: #48c774;
    color: #2e7d32;
}

/* Acrostic clue inputs - the letter boxes next to each clue */
.acrostic-word-inputs {
    display: flex;
    gap: 2px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Container for each letter input + position number */
.acrostic-letter-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.acrostic-letter-input {
    width: 26px;
    height: 26px;
    border: 1px solid #666;
    border-radius: 2px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    background-color: #ffffff;
    padding: 0;
    color: #000;
}

.acrostic-letter-input:focus {
    outline: 2px solid #3273dc;
    background-color: #e3f2fd;
    border-color: #3273dc;
}

.acrostic-letter-input.correct {
    background-color: #e8f5e8;
    border-color: #48c774;
    color: #2e7d32;
}

/* Position number underneath each letter box */
.acrostic-position-num {
    font-size: 9px;
    color: #ffdd57;
    font-weight: 600;
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.acrostic-clue-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

/* Clue letter styling (A., B., C., etc.) */
.clue-letter {
    display: inline-block;
    font-weight: bold;
    color: #ffdd57;
    font-size: 14px;
    min-width: 20px;
}

/* Sticky Clue Bar */
#sticky-clue-bar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 4px;
    background-color: #e3f2fd;
    border: 1px solid #3273dc;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sticky-clue-line {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
}

.sticky-clue-label {
    font-weight: 600;
    color: #3273dc;
}

.sticky-clue-text {
    font-weight: 600;
    color: #1f2d3d;
}

/* Timer styling */
#timer-display {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    background-color: #f5f5f5;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background-color: #3273dc;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background-color: #48c774;
}

.toast.error {
    background-color: #f14668;
}

.toast.warning {
    background-color: #ffdd57;
    color: #363636;
}

/* Animation for incorrect answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3273dc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .acrostic-cell {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .acrostic-grid {
        padding: 5px;
        gap: 1px;
    }

    .columns {
        flex-direction: column;
    }

    .column.is-8,
    .column.is-4 {
        width: 100%;
        max-width: 100%;
    }

    .field.is-grouped {
        flex-direction: column;
        align-items: stretch;
    }

    .control {
        margin-bottom: 8px;
    }

    .clue-answer-boxes {
        gap: 2px;
    }

    .clue-answer-box {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .acrostic-cell {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .acrostic-cell-number {
        font-size: 6px;
    }

    .title.is-2 {
        font-size: 1.5rem;
    }

    .title.is-4 {
        font-size: 1.25rem;
    }
}

/* Desktop sizing improvements */
@media (min-width: 1024px) {
    .acrostic-cell {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .acrostic-cell-number {
        font-size: 8px;
    }
}

/* Accessibility improvements */
.acrostic-cell:focus {
    outline: 3px solid #3273dc;
    outline-offset: 2px;
}

.clue-item:focus {
    outline: 2px solid #3273dc;
    outline-offset: 1px;
}

/* Print styles */
@media print {
    @page {
        margin: 0.5cm;
        size: letter portrait;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background-color: white !important;
        padding-top: 0 !important;
        color: black !important;
        margin: 0 !important;
    }

    .navbar,
    .buttons,
    .field,
    .toast-container,
    .modal,
    #sticky-clue-bar,
    #author-reveal-box {
        display: none !important;
    }

    .section {
        padding: 0 !important;
    }

    .box {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin-bottom: 1rem !important;
        background-color: transparent !important;
    }

    #puzzle-header {
        margin-bottom: 1rem !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 1rem !important;
    }

    #puzzle-title {
        font-size: 24pt !important;
        margin-bottom: 0.5rem !important;
        color: black !important;
    }

    .acrostic-grid {
        background-color: transparent !important;
        border: 2px solid #000 !important;
        gap: 0 !important;
        page-break-inside: avoid;
        margin: 0 auto 1.5rem auto !important;
        padding: 0 !important;
    }

    .acrostic-cell {
        background-color: #fff !important;
        border: 1px solid #000 !important;
        color: transparent !important;
        box-shadow: none !important;
    }

    .acrostic-cell.blocked,
    .acrostic-cell.space {
        background-color: #ccc !important;
    }

    .acrostic-cell.punctuation {
        color: #000 !important;
    }

    .acrostic-input {
        display: none !important;
    }

    .clue-list {
        max-height: none !important;
        overflow: visible !important;
    }

    .clue-item {
        margin-bottom: 0.25rem !important;
        padding: 0 !important;
        background-color: transparent !important;
        page-break-inside: avoid;
        font-size: 10pt !important;
    }

    .clue-number {
        color: #000 !important;
    }

    .clue-text {
        color: #000 !important;
    }

    .clue-answer-boxes {
        display: none !important;
    }
}
