/* Category Cards */
.category-card {
    height: 160px; /* Fixed height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 8px;
    padding: 1rem 0.5rem;
    text-align: center;
    border: 1px solid #e0e0e0;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

.category-card .display-4 {
    font-size: 2.25rem;
    margin: 0 0 0.5rem 0;
    line-height: 1;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-card h5 {
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
    padding: 0 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em;
}

/* Bingo Card Styles */
.bingo-card {
    width: 100%;
    max-width: 900px;
    min-height: 700px; /* Ensure minimum height */
    margin: 0 auto;
    background-color: #ddd;
    border: 12px solid #333;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Preview specific styles */
.bingo-preview .bingo-card {
    min-height: 800px; /* Larger height for preview */
}

.bingo-preview .bingo-grid {
    flex: 1; /* Fill available space */
    min-height: 600px; /* Ensure minimum grid height */
}

.bingo-header {
    background-color: #333;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 12px 0;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    background-color: #333;
    padding: 2px;
}

.bingo-row {
    display: contents;
}

.bingo-cell {
    background-color: white;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1.3;
    transition: all 0.2s ease;
    word-break: break-word;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    user-select: none;
}

.bingo-cell:not(.bingo-free):hover {
    background-color: #f8f9fa;
    transform: scale(1.02);
    z-index: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bingo-cell:focus {
    outline: 3px solid #0d6efd;
    outline-offset: -1px;
    z-index: 2;
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.bingo-cell.editing {
    background-color: #fff;
    box-shadow: 0 0 0 2px #0d6efd, 0 0 10px rgba(13, 110, 253, 0.5);
    z-index: 10;
    transform: scale(1.03);
}

.bingo-cell input {
    width: 100%;
    height: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.9em;
    text-align: center;
    background-color: #fff;
}

.bingo-cell input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.bingo-free {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    font-weight: bold;
    color: #721c24;
    cursor: default !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 2px solid #dc3545;
}

/* Marked cell styles */
.bingo-marked {
    background-color: #d4edda !important;
    color: #155724;
    position: relative;
}

.bingo-marked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5em;
    opacity: 0.7;
    pointer-events: none;
}

/* Bingo line animation */
.bingo-line {
    animation: bingoPulse 0.5s ease-in-out;
    background-color: #c3e6cb !important;
}

@keyframes bingoPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Toast notifications */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    min-width: 250px;
}

.toast {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Skip link styles */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Visually hidden but still accessible */
.visually-hidden-focusable {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus styles for better keyboard navigation */
:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .bingo-card {
        border: 2px solid #000 !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .bingo-cell.bingo-marked {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .bingo-cell {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

.bingo-free .free-text {
    font-size: 1.2rem;
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    transform: rotate(-5deg);
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .bingo-header {
        font-size: 1.4rem;
        padding: 10px 0;
    }
    
    .bingo-cell {
        font-size: 1rem;
        padding: 0.5rem 0.3rem;
    }
    
    .bingo-free .free-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .bingo-header {
        font-size: 1.2rem;
        padding: 8px 0;
    }
    
    .bingo-cell {
        font-size: 0.9rem;
        padding: 0.4rem 0.2rem;
    }
    
    .bingo-free .free-text {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .bingo-header {
        font-size: 1.1rem;
    }
    
    .bingo-cell {
        font-size: 0.75rem;
        padding: 0.2rem;
    }
    
    .bingo-free .free-text {
        font-size: 0.9rem;
    }
}

/* Custom tooltip styles */
.tooltip {
    pointer-events: none;
}

.tooltip-inner {
    background-color: #333;
    color: white;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow::before,
.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #333;
}

.bs-tooltip-auto[data-popper-placement^=bottom] .tooltip-arrow::before,
.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #333;
}

.bs-tooltip-auto[data-popper-placement^=left] .tooltip-arrow::before,
.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: #333;
}

.bs-tooltip-auto[data-popper-placement^=right] .tooltip-arrow::before,
.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: #333;
}

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

/* Instructions panel */
.bingo-instructions {
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd;
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bingo-instructions h5 {
    color: #0a58ca;
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.bingo-instructions h5:before {
    content: 'ℹ️';
    margin-right: 0.5rem;
    font-size: 1.2em;
}

.bingo-instructions h6 {
    color: #495057;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
}

.bingo-instructions ul,
.bingo-instructions ol {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.bingo-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: #212529;
}

.bingo-instructions kbd {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    color: #495057;
    display: inline-block;
    font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
    font-size: 0.85em;
    line-height: 1;
    padding: 0.2em 0.4em;
    white-space: nowrap;
}

/* Screen reader only utility class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bingo-cell {
        font-size: 0.75rem;
        padding: 0.2rem;
    }
    
    .bingo-header {
        font-size: 0.9rem;
        padding: 5px 0;
    }
    
    .bingo-instructions {
        padding: 1rem;
        margin: 1.25rem 0;
    }
    
    .bingo-instructions h5 {
        font-size: 1rem;
    }
    
    .bingo-instructions ul,
    .bingo-instructions ol {
        padding-left: 1.25rem;
    }
    
    .bingo-instructions li {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
}
