/* PuzzlePlay - Main Stylesheet */
/* Fun, Kid-Inspired, Colorful Design */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Fredoka+One&display=swap');

/* CSS Variables - Colorful Kid-Friendly Palette */
:root {
    /* Primary Colors */
    --primary-pink: #FF6B9D;
    --primary-purple: #9B5DE5;
    --primary-blue: #00BBF9;
    --primary-green: #00F5D4;
    --primary-yellow: #FEE440;
    --primary-orange: #F15BB5;
    --primary-red: #FF6B6B;

    /* Gradients */
    --gradient-rainbow: linear-gradient(135deg, #FF6B9D 0%, #9B5DE5 25%, #00BBF9 50%, #00F5D4 75%, #FEE440 100%);
    --gradient-sunset: linear-gradient(135deg, #FF6B9D 0%, #F15BB5 50%, #FEE440 100%);
    --gradient-ocean: linear-gradient(135deg, #00BBF9 0%, #9B5DE5 100%);
    --gradient-candy: linear-gradient(135deg, #FF6B9D 0%, #9B5DE5 100%);
    --gradient-mint: linear-gradient(135deg, #00F5D4 0%, #00BBF9 100%);

    /* Background Colors */
    --bg-light: #FFF8F0;
    --bg-white: #FFFFFF;
    --bg-cream: #FFF5E6;
    --bg-lavender: #F0E6FF;

    /* Text Colors */
    --text-dark: #2D3748;
    --text-medium: #4A5568;
    --text-light: #718096;
    --text-white: #FFFFFF;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(155, 93, 229, 0.15);
    --shadow-md: 0 4px 20px rgba(155, 93, 229, 0.2);
    --shadow-lg: 0 8px 40px rgba(155, 93, 229, 0.25);
    --shadow-glow: 0 0 30px rgba(0, 187, 249, 0.3);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Quicksand', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Fun Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 107, 157, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(0, 187, 249, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(155, 93, 229, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Fredoka One', cursive;
    color: var(--text-dark);
    line-height: 1.2;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

a {
    color: var(--primary-purple);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-pink);
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid transparent;
    background-image: linear-gradient(white, white), var(--gradient-rainbow);
    background-origin: padding-box, border-box;
    background-clip: padding-box, border-box;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.75rem;
    background: var(--gradient-candy);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-candy);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-sm);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--text-dark);
    transition: var(--transition-normal);
    position: relative;
}

.nav-link:hover {
    background: var(--bg-lavender);
    color: var(--primary-purple);
}

.nav-link.active {
    background: var(--gradient-candy);
    color: var(--text-white);
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-lavender);
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 3px;
    background: var(--primary-purple);
    border-radius: 2px;
    transition: var(--transition-normal);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-full);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--gradient-candy);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--primary-purple);
    border: 3px solid var(--primary-purple);
}

.btn-secondary:hover {
    background: var(--primary-purple);
    color: var(--text-white);
}

.btn-success {
    background: var(--gradient-mint);
    color: var(--text-dark);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.875rem;
}

/* Card Styles */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 2px dashed rgba(155, 93, 229, 0.2);
    background: var(--bg-lavender);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background: var(--bg-cream);
    border-top: 2px dashed rgba(255, 107, 157, 0.2);
}

/* Hero Section */
.hero {
    padding: 60px 0 40px;
    text-align: center;
    position: relative;
}

.hero-title {
    margin-bottom: 16px;
    background: var(--gradient-candy);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-medium);
    max-width: 600px;
    margin: 0 auto 32px;
}

/* Puzzle Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 40px 0;
}

.tool-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--gradient-rainbow);
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.tool-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.tool-title {
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.tool-description {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Maze Generator Section */
.generator-section {
    padding: 40px 0;
}

.generator-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 30px rgba(155, 93, 229, 0.25), 0 -5px 20px rgba(155, 93, 229, 0.1);
}

.controls-header {
    background: var(--gradient-candy);
    color: var(--text-white);
    padding: 20px 24px;
    text-align: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.controls-header h3 {
    color: var(--text-white);
    margin-bottom: 4px;
}

.controls-body {
    padding: 24px;
}

.control-group {
    margin-bottom: 20px;
}

.control-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.control-label i {
    margin-right: 6px;
    color: var(--primary-purple);
}

/* Form Elements */
.form-select,
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 3px solid rgba(155, 93, 229, 0.2);
    border-radius: var(--radius-md);
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: var(--transition-normal);
    outline: none;
}

.form-select:focus,
.form-input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 4px rgba(155, 93, 229, 0.1);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239B5DE5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

/* Range Slider */
.range-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-range {
    flex: 1;
    height: 8px;
    background: var(--bg-lavender);
    border-radius: var(--radius-full);
    appearance: none;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--gradient-candy);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-value {
    min-width: 50px;
    padding: 8px 12px;
    background: var(--bg-lavender);
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 700;
    color: var(--primary-purple);
}

/* Size Inputs Grid */
.size-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-cream);
    border-radius: var(--radius-md);
}

.toggle-label {
    font-weight: 600;
    color: var(--text-dark);
}

.toggle {
    position: relative;
    width: 56px;
    height: 30px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #CBD5E0;
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: var(--bg-white);
    border-radius: 50%;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked+.toggle-slider {
    background: var(--gradient-mint);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(26px);
}

/* Preview Area */
.preview-area {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    min-height: 600px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-cream);
    border-bottom: 3px dashed rgba(255, 107, 157, 0.2);
    flex-wrap: wrap;
    gap: 12px;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-title h3 {
    font-size: 1.25rem;
}

.preview-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preview-content {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 550px;
    background:
        linear-gradient(90deg, rgba(155, 93, 229, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(155, 93, 229, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

#maze-canvas {
    max-width: 100%;
    background: var(--bg-white);
}

/* Download Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    margin: 20px;
    transform: scale(0.9);
    transition: var(--transition-normal);
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    background: var(--gradient-candy);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--text-white);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-white);
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 24px;
}

.download-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.download-option {
    padding: 20px;
    border: 3px solid rgba(155, 93, 229, 0.2);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.download-option:hover {
    border-color: var(--primary-purple);
    background: var(--bg-lavender);
}

.download-option i {
    font-size: 2rem;
    color: var(--primary-purple);
    margin-bottom: 8px;
    display: block;
}

.download-option span {
    font-weight: 700;
    color: var(--text-dark);
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #2D3748 0%, #1a1e28 100%);
    color: var(--text-white);
    padding: 60px 0 24px;
    margin-top: 60px;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--gradient-rainbow);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: var(--text-white);
    margin-bottom: 20px;
    font-size: 1.125rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-pink);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Loading Animation */
.loader {
    display: inline-block;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(155, 93, 229, 0.2);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Confetti Animation for Generate */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) rotate(720deg);
        opacity: 0;
    }
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--text-dark);
    color: var(--text-white);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .generator-grid {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        order: 2;
    }

    .preview-area {
        order: 1;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
    }

    .nav.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero {
        padding: 40px 0 30px;
    }

    .preview-header {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .logo {
        font-size: 1.4rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .tool-card {
        padding: 24px 16px;
    }

    .size-inputs {
        grid-template-columns: 1fr;
    }

    .download-options {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {

    .header,
    .footer,
    .controls-panel,
    .preview-header {
        display: none !important;
    }

    .preview-content {
        padding: 0;
        background: none;
    }

    #maze-canvas {
        width: 100%;
        max-width: none;
        box-shadow: none;
    }
}