/* Word Search Fun - Kids-friendly, colorful design */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #c4b5fd 0%, #ddd6fe 50%, #fbcfe8 100%);
    min-height: 100vh;
    color: var(--text-dark);
    position: relative;
    overflow-x: hidden;
}

/* Floating background icons */
.floating-icons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.6;
    animation: floatIcon 6s ease-in-out infinite;
}

.floating-icon:nth-child(1) { top: 10%; left: 5%; color: #3b82f6; animation-delay: 0s; animation-duration: 5s; }
.floating-icon:nth-child(2) { top: 20%; right: 8%; color: #f97316; animation-delay: 1s; animation-duration: 7s; }
.floating-icon:nth-child(3) { top: 60%; left: 3%; color: #10b981; animation-delay: 2s; animation-duration: 6s; }
.floating-icon:nth-child(4) { top: 75%; right: 5%; color: #eab308; animation-delay: 0.5s; animation-duration: 8s; }
.floating-icon:nth-child(5) { top: 35%; right: 15%; color: #f59e0b; animation-delay: 3s; animation-duration: 5.5s; }
.floating-icon:nth-child(6) { top: 50%; left: 10%; color: #8b5cf6; animation-delay: 1.5s; animation-duration: 6.5s; }
.floating-icon:nth-child(7) { top: 85%; left: 15%; color: #14b8a6; animation-delay: 2.5s; animation-duration: 7.5s; }
.floating-icon:nth-child(8) { top: 15%; left: 25%; color: #6366f1; animation-delay: 4s; animation-duration: 5s; }
.floating-icon:nth-child(9) { top: 70%; right: 20%; color: #ec4899; animation-delay: 0.8s; animation-duration: 6s; }
.floating-icon:nth-child(10) { top: 40%; left: 85%; color: #ef4444; animation-delay: 2.2s; animation-duration: 7s; }
.floating-icon:nth-child(11) { top: 5%; right: 30%; color: #2563eb; animation-delay: 3.5s; animation-duration: 5.5s; }
.floating-icon:nth-child(12) { top: 90%; left: 40%; color: #059669; animation-delay: 1.2s; animation-duration: 8s; }

@keyframes floatIcon {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) translateX(8px) rotate(5deg); }
    50% { transform: translateY(-8px) translateX(-5px) rotate(-3deg); }
    75% { transform: translateY(-20px) translateX(5px) rotate(4deg); }
}

/* Ensure content is above floating icons */
.navbar, .home-hero, main, .footer {
    position: relative;
    z-index: 1;
}

/* Navbar */
.navbar {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.95), rgba(236, 72, 153, 0.95)) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
}

.nav-link {
    font-weight: 600;
    transition: transform 0.2s;
}

.nav-link:hover {
    transform: scale(1.05);
}

/* Home landing hero */
.home-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #c026d3 100%);
    color: #fff;
    margin-bottom: 0;
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.35);
}

.home-hero__pattern {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image:
        radial-gradient(circle at 20% 30%, #fff 0, transparent 45%),
        radial-gradient(circle at 80% 70%, #fff 0, transparent 40%),
        repeating-linear-gradient(
            -12deg,
            transparent,
            transparent 24px,
            rgba(255, 255, 255, 0.06) 24px,
            rgba(255, 255, 255, 0.06) 25px
        );
    pointer-events: none;
}

.home-hero__row {
    padding-top: 3rem !important;
    padding-bottom: 3.5rem !important;
}

@media (min-width: 992px) {
    .home-hero__row {
        padding-top: 4rem !important;
        padding-bottom: 5rem !important;
    }
}

.home-hero__eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

@media (min-width: 992px) {
    .home-hero__eyebrow {
        justify-content: flex-start;
    }
}

.home-hero__pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

.home-hero__title {
    color: #fff !important;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.15);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.home-hero__lead {
    color: rgba(255, 255, 255, 0.92) !important;
    font-size: 1.2rem;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 992px) {
    .home-hero__lead {
        margin-left: 0;
    }
}

.btn-hero-primary {
    background: #fff !important;
    color: #4f46e5 !important;
    border: none !important;
    font-weight: 800;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hero-primary:hover {
    background: #f8fafc !important;
    color: #4338ca !important;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.btn-hero-outline {
    background: transparent !important;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-hero-outline:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: #fff !important;
    color: #fff !important;
}

.home-hero__visual {
    max-width: 320px;
}

.home-hero__grid-demo {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.15);
}

.home-hero__grid-demo span {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #4f46e5;
    background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.home-hero__grid-demo span:nth-child(6),
.home-hero__grid-demo span:nth-child(7),
.home-hero__grid-demo span:nth-child(8),
.home-hero__grid-demo span:nth-child(9),
.home-hero__grid-demo span:nth-child(10) {
    background: linear-gradient(180deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
}

.home-hero__wave {
    height: 48px;
    background: linear-gradient(180deg, transparent 0%, rgba(196, 181, 253, 0.35) 100%);
    margin-top: -1px;
}

.scroll-margin-top {
    scroll-margin-top: 5.5rem;
}

/* Cards */
.card {
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.card-header {
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    font-weight: 700;
    border: none;
}

/* Did you know section */
.did-you-know .card {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid rgba(99, 102, 241, 0.2);
}

.did-you-know .card-body p {
    color: var(--text-dark);
    line-height: 1.6;
}

.did-you-know .text-warning {
    color: #f59e0b !important;
}

/* Feature cards */
.feature-card {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    font-weight: 700;
    padding: 12px 28px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}
.btn-primary:active {
    transform: scale(0.98);
}

/* Game page */
.game-page {
    background: linear-gradient(135deg, #c4b5fd 0%, #e9d5ff 50%, #fce7f3 100%);
}

.game-card, .words-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.words-card {
    background: rgba(255, 255, 255, 0.98);
}

.game-instructions {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.game-instructions h6 {
    color: #4f46e5;
    font-weight: 700;
}

.game-instructions ol li {
    line-height: 1.5;
}

/* Word grid */
.word-grid-container {
    max-width: 100%;
    overflow-x: auto;
}

.word-grid {
    display: inline-grid;
    gap: 2px;
    padding: 16px;
    background: linear-gradient(145deg, #f0f0f5, #e8e8f0);
    border-radius: 16px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.word-grid.cell-8 { grid-template-columns: repeat(8, 1fr); }
.word-grid.cell-10 { grid-template-columns: repeat(10, 1fr); }
.word-grid.cell-12 { grid-template-columns: repeat(12, 1fr); }
.word-grid.cell-15 { grid-template-columns: repeat(15, 1fr); }

.grid-cell {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    color: #4b5563;
}

.word-grid.cell-15 .grid-cell {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.9rem;
}

.grid-cell:hover {
    background: #e0e7ff;
    transform: scale(1.08);
}

.grid-cell.selected {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    color: white;
    transform: scale(1.05);
}

.grid-cell.found {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    color: white !important;
    animation: foundPulse 0.5s ease;
}

.grid-cell.hint {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: white !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.6);
}

@keyframes foundPulse {
    0% { transform: scale(1.2); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Game page buttons */
.btn-game-hint {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border: none;
    color: white;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.35);
}

.btn-game-hint:hover {
    background: linear-gradient(135deg, #d97706, #ea580c);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
}

.btn-game-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white !important;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    text-decoration: none;
    display: inline-block;
}

.btn-game-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

/* Printable Puzzles button - consistent secondary style across pages */
.btn-print {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary) !important;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 16px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-print:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-print.btn-lg {
    padding: 14px 32px;
    font-size: 1.1rem;
}

/* Quick Play - outline version of primary, same shape and size, border in primary color */
.btn-quick-play {
    background: transparent !important;
    border: 2px solid #6366f1;
    color: #6366f1 !important;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-quick-play:hover {
    background: rgba(99, 102, 241, 0.12) !important;
    border-color: #4f46e5;
    color: #4f46e5 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

/* Word list */
.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-badge {
    padding: 8px 14px;
    background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
    border-radius: 12px;
    font-weight: 700;
    color: #4f46e5;
    transition: all 0.3s ease;
}

.word-badge.found {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
    text-decoration: line-through;
    opacity: 0.8;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.25);
    margin-top: auto;
}
.footer-heading {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.75rem;
}
.footer-links a {
    display: block;
    padding: 0.25rem 0;
    color: rgba(255, 255, 255, 0.75) !important;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s, transform 0.2s;
}
.footer-links a:hover {
    color: white !important;
}
.footer a {
    transition: color 0.2s;
}
.footer a:hover {
    color: white !important;
}

/* Theme cards */
.theme-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon i {
    color: white;
}

/* How to play */
.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
}

/* Modal - ensure it appears above all content (floating icons, navbar, etc.) */
.modal-backdrop {
    z-index: 1060 !important;
}
.modal {
    z-index: 1061 !important;
}

.modal-content {
    border: none;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.celebration-icon {
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Floating icons - responsive */
@media (max-width: 768px) {
    .floating-icon {
        font-size: 1.4rem;
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .grid-cell {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        font-size: 0.95rem;
    }
    
    .word-grid.cell-15 .grid-cell {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        font-size: 0.75rem;
    }
}
