/*!
 * SuperKids Word Search Puzzle Generator - Stylesheet
 * Version 12.1 (Post Zombie Cleanup)
 * 
 * Comprehensive styling for word search puzzle generator including:
 * - Responsive design and mobile optimization
 * - Print styles for puzzle worksheets
 * - Interactive game interface
 * - Modern UI with gradient backgrounds and animations
 * 
 * Copyright (c) 2025 Knowledge Share LLC
 * All rights reserved
 * 
 * Created: 2025
 * Last Modified: August 2025
 */


/* Base Styles */
* {
    box-sizing: border-box;
}

/*
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
*/

.container {
    background: white;
/*    border-radius: 15px; */
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* View Management */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Navigation */
.nav-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn.active {
    background: #667eea;
    color: white;
}

.nav-btn:hover:not(.active) {
    background: #f0f4ff;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Generator View Styles */
.controls {
    display: grid;
    grid-template-columns: 60% 35%;
    gap: 30px;
    margin-bottom: 30px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group.full-width {
    grid-column: 1 / -1;
}

.grid-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.print-footer {
    text-align: center;
    margin-top: 40px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #ccc;
    padding-top: 15px;
}

label {
    font-weight: bold;
    color: #555;
}

input, textarea, select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 180px;
    font-family: monospace;
}

.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.btn-generate {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-clear {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
    align-self: flex-start;
}

.btn-clear:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.status {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: bold;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Print View Styles */
.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.print-field {
    /* border-bottom: 2px solid #000; */
    padding-bottom: 5px;
    min-width: 200px;
}

.board-number {
    text-align: center;
    font-size: 14px;
    color: #888;
    margin: 15px 0;
}

.puzzle-grid {
    display: grid;
    gap: 1px;
    justify-content: center;
    font-family: monospace;
    font-weight: bold;
    margin: 20px auto;
    max-width: 100%;
}

.puzzle-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: white;
}

.puzzle-cell.highlighted {
    background: #ffeb3b;
    color: #000;
    font-weight: bold;
}

.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px 15px;
    margin-top: 25px;
}

.word-item {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    text-align: center;
 /*   font-weight: bold; */
}

/* Game View Styles */
.game-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.game-grid {
    display: inline-block;
    font-family: monospace;
    font-weight: bold;
    line-height: 1;
    user-select: none;
    touch-action: none;
}

.game-row {
    display: block;
    margin: 1px 0;
}

.game-cell {
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    margin: 1px;
    transition: all 0.2s;
    background: white;
    width: 25px;
    height: 25px;
    line-height: 25px;
    font-size: 18px;
}

.game-cell:hover {
    background: #e3f2fd;
}

.game-cell.selected {
    background: #2196f3;
    color: white;
}

.game-cell.found {
    background: #4caf50;
    color: white;
}

.game-sidebar {
    min-width: 200px;
    max-width: 300px;
    flex: 1;
}

.game-word-list {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.game-word-item {
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 16px;
}

.game-word-item.found {
    background: #4caf50;
    color: white;
    text-decoration: line-through;
}

.hint-button {
    background: #ff9800;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px 0;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
}

.hint-button:hover {
    background: #f57c00;
}

.game-stats {
    margin-top: 20px;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
}

/* Answer Legend Styles */
.answer-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 25px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-word {
    font-weight: bold;
}

/* Print Styles */
@media print {
    body {
        margin: 15px;
        font-size: 12px;
        background: white;
    }
    
    .container {
        padding: 15px;
        box-shadow: none;
        border-radius: 0;
    }
    
    h1 {
        font-size: 1.4em;
        margin: 10px 0;
    }
    
    .nav-buttons {
        display: none !important;
    }
    
    .board-number {
        margin: 8px 0;
    }
    
    .print-header {
        margin-bottom: 15px;
    }
    
    .puzzle-grid {
        margin: 15px auto;
    }
    
    .puzzle-cell.highlighted {
        background: none !important;
        border: 2px solid #000 !important;
        color: #000 !important;
        font-weight: bold !important;
    }
    
    .word-list {
        margin-top: 20px;
        gap: 8px;
    }
    
    .word-item {
        padding: 4px;
        font-size: 11px;
    }
    
    .answer-legend {
        gap: 5px;
    }
    
    .legend-item {
        padding: 4px;
        font-size: 10px;
    }
}

/* Overlay Styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.overlay.show {
    display: flex;
}

.overlay-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.7);
    animation: popIn 0.3s ease-out forwards;
}

.overlay-content.success {
    border-top: 5px solid #4caf50;
}

.overlay-content.hint {
    border-top: 5px solid #ff9800;
}

.overlay-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.overlay-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.overlay-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.4;
}

.overlay-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.overlay-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.overlay-button.success {
    background: linear-gradient(45deg, #4caf50, #45a049);
}

.overlay-button.success:hover {
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.overlay-button.hint {
    background: linear-gradient(45deg, #ff9800, #f57c00);
}

.overlay-button.hint:hover {
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { 
        transform: scale(0.7);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .controls {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .grid-controls {
        gap: 15px;
    }
    
    .buttons, .nav-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    button, .nav-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .game-layout {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .game-sidebar {
        width: 100%;
        max-width: none;
    }
    
    .game-cell {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 16px;
    }
    
    .overlay-content {
        margin: 20px;
    }
}

/* Format for printing puzzles */
@media print {
  .no-print {
    display: none !important;
  }
}
@media print {
  #printView ~ footer {
    display: none !important;
  }
}
@media print {
    .frame.no-print-border {
        border: none !important;
        padding-top: 0; /* optional: adjust spacing if needed */
    }
}


/* Format links in showStatus message */
.clickable-link {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

.clickable-link:hover {
    background: #0056b3;
}
