/* 
* Little ICY Productions - Puzzle Fun Styles
* Extends the main styles.css with puzzle-specific styling
*/

/* Puzzle Hero Section */
.puzzle-hero {
    background: linear-gradient(135deg, var(--tertiary-color) 0%, #4db6ac 100%);
    padding: 280px 0 20px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.puzzle-hero:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 40px 0;
	padding-bottom: 0;
}

.puzzle-icons {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.puzzle-icons i {
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
}

.animated-title {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
    position: relative;
    display: inline-block;
    animation: titleBounce 4s ease-in-out infinite;
}

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

.animated-tagline {
    font-size: 1.4rem;
    color: var(--white);
    max-width: 600px;
    margin: 0 auto 15px;
    font-weight: 600;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji {
    font-size: 1.6rem;
    display: inline-block;
    margin: 0 3px;
    animation: spin 6s linear infinite;
}

.emoji:nth-child(2) {
    animation-delay: 0.5s;
}

.emoji:nth-child(3) {
    animation-delay: 1s;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    50% {
        transform: rotate(0deg);
    }
    75% {
        transform: rotate(-20deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.hero-decoration {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    height: 100%;
    pointer-events: none;
}

.hero-decoration i {
    position: absolute;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.5rem;
}

.star-1 {
    top: 25%;
    left: 20%;
    animation: twinkle 3s infinite alternate;
}

.star-2 {
    top: 35%;
    right: 25%;
    animation: twinkle 4s infinite alternate;
    animation-delay: 1s;
}

.star-3 {
    bottom: 30%;
    left: 35%;
    animation: twinkle 5s infinite alternate;
    animation-delay: 2s;
}

.star-4 {
    top: 20%;
    right: 15%;
    font-size: 1.2rem;
    animation: twinkle 4.5s infinite alternate;
    animation-delay: 0.5s;
}

.star-5 {
    bottom: 25%;
    right: 30%;
    font-size: 1.3rem;
    animation: twinkle 3.5s infinite alternate;
    animation-delay: 1.5s;
}

@keyframes twinkle {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.8;
        transform: scale(1.3);
    }
}

/* Puzzle Selection Section */
.puzzle-selection {
    padding: 60px 0;
    text-align: center;
}

.puzzle-selection h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--dark-gray);
}

.puzzle-cards {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.puzzle-card {
    background-color: var(--white);
    border-radius: 15px;
    padding: 30px;
    width: 300px;
    height: 350px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.puzzle-card .card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.puzzle-card .button-container {
    margin: 15px 0;
    display: flex;
    justify-content: center;
}

.puzzle-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.puzzle-icon {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.puzzle-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark-gray);
}

.puzzle-card p {
    margin-top: 0;
    color: #666;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.4;
    padding: 0 5px;
}

.play-btn {
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    min-width: 150px;
    display: inline-block;
    text-align: center;
}

.play-btn:hover {
    background-color: #ff5a5a;
    transform: scale(1.05);
}

/* Game Sections */
.game-section {
    padding: 60px 0;
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.game-header h2 {
    font-size: 2.5rem;
    color: var(--dark-gray);
}

.game-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.difficulty-selector label {
    font-weight: 600;
}

.difficulty-selector select {
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid var(--primary-color);
    font-family: 'Nunito', sans-serif;
    background-color: var(--white);
    cursor: pointer;
}

.btn-small {
    background-color: var(--tertiary-color);
    color: var(--white);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    background-color: #6ab996;
}

/* Game Instructions */
.game-instructions {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.animated-instructions {
    background: linear-gradient(135deg, #f9f9f9, #e6f7f2);
    border: 3px dashed var(--tertiary-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    padding: 25px 20px;
    animation: pulse 3s infinite alternate;
    position: relative;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: scale(1.02);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }
}

.instruction-icon {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin: 10px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.instruction-icon i {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.fa-bounce {
    animation: bounce 1s infinite alternate;
}

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

.fa-flip {
    animation: flip 2s infinite;
}

@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0);
    }
}

.game-instructions h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 800;
}

.game-instructions p {
    font-size: 1.2rem;
    color: var(--dark-gray);
    line-height: 1.5;
}

.highlight {
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 1.3rem;
    position: relative;
    display: inline-block;
}

.highlight:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255, 114, 114, 0.3);
    border-radius: 2px;
}

/* Puzzle Options */
.puzzle-options {
    margin-bottom: 30px;
}

.difficulty-container {
    margin-bottom: 25px;
}

.difficulty-container h3,
.puzzle-image-selector h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--dark-gray);
}

.difficulty-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    background-color: var(--white);
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    margin-bottom: 10px;
}

.difficulty-btn .stars-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    margin-bottom: 8px;
    min-height: 40px;
}

.difficulty-btn .stars-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.difficulty-btn i {
    color: var(--secondary-color);
    font-size: 1rem;
    margin: 0 2px;
}

.difficulty-btn span {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
    display: block;
    width: 100%;
    text-align: center;
}

.difficulty-btn small {
    font-size: 0.8rem;
    color: #666;
    display: block;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.difficulty-btn.active {
    background-color: var(--tertiary-color);
    border-color: var(--tertiary-color);
    color: var(--white);
}

.difficulty-btn.active i,
.difficulty-btn.active small {
    color: var(--white);
}

/* Puzzle Image Selector */
.puzzle-image-selector {
    margin-bottom: 25px;
}

.puzzle-image-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.puzzle-image-btn {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    border: 3px solid var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.puzzle-image-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.puzzle-image-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.puzzle-image-btn.active {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px var(--secondary-color);
}

/* Jigsaw Puzzle Styles */
.jigsaw-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.jigsaw-board {
    width: 100%;
    max-width: 500px;
    height: 500px;
    background-color: var(--light-gray);
    border: 3px solid var(--tertiary-color);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.grid-overlay {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.grid-cell {
    border: 2px dashed rgba(127, 209, 174, 0.7);
    cursor: pointer;
    transition: background-color 0.2s;
}

.grid-cell:hover {
    background-color: rgba(127, 209, 174, 0.2);
}

.jigsaw-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    min-height: 150px;
}

.puzzle-piece {
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s, box-shadow 0.2s;
    background-size: cover;
    z-index: 2;
    border: 2px solid var(--tertiary-color);
    border-radius: 5px;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    z-index: 3;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.puzzle-piece.selected {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--secondary-color);
    z-index: 10;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 114, 114, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 114, 114, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 114, 114, 0);
    }
}

.puzzle-piece.placed {
    position: absolute;
    cursor: default;
    box-shadow: none;
    transition: all 0.3s ease;
    z-index: 2;
    border: 1px solid rgba(127, 209, 174, 0.3);
    transform: scale(1);
}

.puzzle-piece.snap-success {
    animation: successPulse 0.5s ease-in-out;
    z-index: 5;
}

.puzzle-piece.snap-failure {
    animation: failureShake 0.5s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(127, 209, 174, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(127, 209, 174, 0.7);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(127, 209, 174, 0.7);
    }
}

@keyframes failureShake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

/* Matching Pairs Styles */
.matching-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

.matching-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.memory-card {
    width: 100px;
    height: 100px;
    position: relative;
    perspective: 1000px;
    cursor: pointer;
}

.memory-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s;
}

.memory-card-front {
    background-color: var(--secondary-color);
    transform: rotateY(180deg);
    overflow: hidden;
    padding: 5px;
}

.memory-card-front img {
    width: 130%;
    height: 130%;
    object-fit: contain;
    border-radius: 2px;
    transform: scale(1.0);
    transform-origin: center;
}

.memory-card-back {
    background-color: var(--primary-color);
    color: white;
    transform: rotateY(0deg);
}

.question-mark {
    font-size: 2.5rem;
    color: white;
    font-weight: bold;
}

/* When card is flipped */
.memory-card.flip .memory-card-front {
    transform: rotateY(0deg);
}

.memory-card.flip .memory-card-back {
    transform: rotateY(-180deg);
}

/* Matched cards */
.memory-card.matched .memory-card-front {
    transform: rotateY(0deg);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
    opacity: 0.9;
}

.memory-card.matched .memory-card-back {
    transform: rotateY(-180deg);
}

.memory-card.matched {
    pointer-events: none;
}

.memory-card-placeholder {
    width: 100px;
    height: 100px;
    visibility: hidden;
}

/* Celebration Modal */
.celebration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.celebration-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 1001;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.celebration-title {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.celebration-message {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-color);
}

.celebration-close {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
}

.celebration-close:hover {
    background-color: var(--secondary-color);
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    top: -10px;
    animation: confetti-fall 5s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes pop-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Add a class to the body when celebration is showing to prevent scrolling */
body.showing-celebration {
    overflow: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .animated-title {
        font-size: 2.8rem;
    }
    
    .animated-tagline {
        font-size: 1.2rem;
    }
    
    .puzzle-icons {
        font-size: 2rem;
        gap: 20px;
    }
    
    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .jigsaw-board {
        height: 350px;
        max-width: 350px;
    }
    
    .puzzle-piece {
        /* Scale down puzzle pieces for tablets */
        transform: scale(0.9);
    }
    
    .puzzle-piece:hover {
        transform: scale(0.95);
    }
    
    .puzzle-piece.selected {
        transform: scale(1);
    }
    
    .matching-board {
        gap: 6px;
    }
    
    .memory-card, .memory-card-placeholder {
        width: 85px;
        height: 85px;
    }
    
    .memory-card-front img {
        width: 130%;
        height: 130%;
        transform: scale(1.0);
    }
    
    .question-mark {
        font-size: 2rem;
    }
    
    .difficulty-buttons {
        justify-content: center;
        gap: 10px;
    }
    
    .difficulty-btn {
        min-width: 110px;
        padding: 12px;
    }
    
    .difficulty-btn i {
        font-size: 0.9rem;
    }
    
    .difficulty-btn .stars-container {
        min-height: 35px;
    }
    
    .puzzle-image-buttons {
        justify-content: center;
    }
    
    .puzzle-image-btn {
        width: 70px;
        height: 70px;
    }
    
    .puzzle-hero {
        padding: 220px 0 20px;
    }
}

@media (max-width: 480px) {
    .animated-title {
        font-size: 2.2rem;
    }
    
    .animated-tagline {
        font-size: 1.1rem;
    }
    
    .puzzle-icons {
        font-size: 1.8rem;
        gap: 15px;
    }
    
    .puzzle-card {
        width: 100%;
    }
    
    .jigsaw-board {
        height: 300px;
        max-width: 300px;
    }
    
    .puzzle-piece {
        /* Scale down puzzle pieces more for phones */
        transform: scale(0.8);
    }
    
    .puzzle-piece:hover {
        transform: scale(0.85);
    }
    
    .puzzle-piece.selected {
        transform: scale(0.9);
    }
    
    .matching-board {
        gap: 5px;
    }
    
    .memory-card, .memory-card-placeholder {
        width: 65px;
        height: 65px;
    }
    
    .memory-card-front img {
        width: 130%;
        height: 130%;
        transform: scale(1.0);
    }
    
    .question-mark {
        font-size: 1.5rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .difficulty-buttons {
        gap: 8px;
    }
    
    .difficulty-btn {
        min-width: 90px;
        padding: 10px;
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .difficulty-btn i {
        font-size: 0.8rem;
    }
    
    .difficulty-btn span {
        font-size: 0.95rem;
        margin-bottom: 3px;
    }
    
    .difficulty-btn small {
        font-size: 0.7rem;
    }
    
    .difficulty-btn .stars-container {
        min-height: 30px;
        margin-bottom: 5px;
    }
    
    .puzzle-image-btn {
        width: 60px;
        height: 60px;
    }
    
    .puzzle-hero {
        padding: 180px 0 20px;
    }
}

/* Additional media query for very small screens */
@media (max-width: 375px) {
    .jigsaw-board {
        height: 280px;
        max-width: 280px;
    }
    
    .puzzle-piece {
        /* Scale down puzzle pieces even more for very small phones */
        transform: scale(0.7);
    }
    
    .puzzle-piece:hover {
        transform: scale(0.75);
    }
    
    .puzzle-piece.selected {
        transform: scale(0.8);
    }
    
    .jigsaw-pieces {
        gap: 8px;
    }
    
    .memory-card, .memory-card-placeholder {
        width: 55px;
        height: 55px;
    }
    
    .memory-card-front img {
        width: 130%;
        height: 130%;
        transform: scale(1.0);
    }
    
    .question-mark {
        font-size: 1.2rem;
    }
} 