/*
 * Word Search - Dark Theme Specific Styles
 * Extends worksheet-base.css
 * Optimized for both preview and print
 */

/* ============================================
   WORD SEARCH CONTENT WRAPPER
   ============================================ */
.word-search-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding: 8mm 0;
}

/* ============================================
   WORD SEARCH GRID
   ============================================ */
.word-search-grid {
    display: grid;
    gap: 0;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    border: 2px solid #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    aspect-ratio: 1;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #1e293b;
    line-height: 1;
}

/* Minimal Grid Style - No cell borders */
.word-search-grid.grid-minimal {
    border: none;
    gap: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.word-search-grid.grid-minimal .grid-cell {
    border: none;
    background: transparent;
}

/* ============================================
   PUZZLE INSTRUCTIONS
   ============================================ */
.puzzle-instructions {
    font-family: var(--font-ui);
    font-size: 11px;
    color: #64748b;
    text-align: center;
    margin-bottom: 4mm;
    font-style: italic;
    max-width: 160mm;
    line-height: 1.4;
}

/* ============================================
   WORD LIST
   ============================================ */
.word-list {
    width: 100%;
    margin-top: auto;
    padding-top: 6mm;
}

.word-list__title {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4mm;
    text-align: center;
    letter-spacing: 2px;
}

.word-list__items {
    display: flex;
    flex-wrap: wrap;
    gap: 3mm 4mm;
    justify-content: center;
    padding: 0 5mm;
}

.word-item {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    padding: 2mm 4mm;
    background: #f8fafc;
    border-radius: 2mm;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* ============================================
   SOLUTION PAGE
   ============================================ */
.solution-sheet .sheet__title {
    color: #059669 !important;
}

.solution-sheet .word-search-grid {
    border-color: #059669;
}

.grid-cell.highlighted {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #92400e !important;
    font-weight: 800;
}

.solution-sheet .grid-cell.highlighted {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
    color: #065f46 !important;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .word-search-content {
        padding: 5mm 0;
    }
    
    .word-search-grid {
        border: 2px solid #000 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    .word-search-grid.grid-minimal {
        border: none !important;
        overflow: visible !important;
    }
    
    .word-search-grid.grid-minimal .grid-cell {
        border: none !important;
        background: transparent !important;
    }
    
    .grid-cell {
        border-color: #ccc !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .grid-cell.highlighted {
        background: #fef3c7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .solution-sheet .grid-cell.highlighted {
        background: #d1fae5 !important;
    }
    
    .puzzle-instructions {
        font-size: 10px;
        color: #555 !important;
    }
    
    .word-list {
        padding-top: 5mm;
    }
    
    .word-list__items {
        gap: 2mm 3mm;
    }
    
    .word-item {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        font-size: 10px;
        padding: 1.5mm 3mm;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .print-only {
        display: flex !important;
    }
}

/* Hide print-only elements on screen */
@media screen {
    .print-only {
        display: none !important;
    }
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 1024px) {
    .word-search-content {
        padding: 3% 0;
    }
    
    .puzzle-instructions {
        font-size: clamp(8px, 2vw, 11px);
        max-width: 90%;
    }
    
    .word-list {
        padding-top: 3%;
    }
    
    .word-list__items {
        gap: clamp(4px, 1vw, 3mm) clamp(6px, 1.5vw, 4mm);
    }
    
    .word-item {
        font-size: clamp(8px, 2vw, 11px);
        padding: clamp(2px, 0.5vw, 2mm) clamp(4px, 1vw, 4mm);
    }
    
    /* Scale grid cells to fit */
    .grid-cell {
        font-size: clamp(8px, 2.2vw, 16px);
    }
}

@media (max-width: 600px) {
    .word-search-content {
        padding: 2% 0;
    }
    
    /* Scale grid cells for mobile */
    .grid-cell {
        font-size: clamp(6px, 1.8vw, 12px);
    }
    
    .puzzle-instructions {
        font-size: clamp(6px, 1.6vw, 9px);
        max-width: 95%;
        margin-bottom: 2%;
    }
    
    .word-list__title {
        font-size: clamp(7px, 1.8vw, 10px);
        margin-bottom: 2%;
    }
    
    .word-list__items {
        gap: clamp(2px, 0.6vw, 1.5mm) clamp(4px, 1vw, 2.5mm);
        padding: 0 2%;
    }
    
    .word-item {
        font-size: clamp(6px, 1.5vw, 9px);
        padding: clamp(1px, 0.3vw, 1mm) clamp(3px, 0.8vw, 2.5mm);
    }
    
    .word-search-grid {
        border-width: 1px;
    }
}
