/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 243, 181, 0.4), transparent 60%),
                radial-gradient(1000px 500px at 110% 10%, rgba(186, 230, 253, 0.45), transparent 60%),
                radial-gradient(900px 600px at -10% 100%, rgba(221, 214, 254, 0.45), transparent 60%),
                linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: #ffffff;
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
    cursor: pointer;
}

.logo-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 240px;
    height: 90px;
    flex-shrink: 0;
}

.logo-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.logo-text {
    position: relative;
    z-index: 10;
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -1px;
    margin-top: 15px;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
}

.hero-title {
    font-family: 'Fredoka', 'Poppins', sans-serif;
}

.logo-animals {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 45px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.animal {
    position: relative;
    font-size: 1.8rem;
    animation: animalBounce 3s infinite;
    opacity: 0.9;
    transition: all 0.3s ease;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
    cursor: pointer;
}

.animal:hover {
    transform: scale(1.4) translateY(-8px);
    opacity: 1;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

.animal-1 {
    animation-delay: 0s;
}

.animal-2 {
    animation-delay: 0.6s;
}

.animal-3 {
    animation-delay: 1.2s;
}

.animal-4 {
    animation-delay: 1.8s;
}

.animal-5 {
    animation-delay: 2.4s;
}

@keyframes rainbowGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 0, 0, 0.3),
            0 0 40px rgba(255, 128, 0, 0.2),
            0 0 60px rgba(255, 255, 0, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 0, 0, 0.5),
            0 0 50px rgba(255, 128, 0, 0.3),
            0 0 70px rgba(255, 255, 0, 0.2);
    }
}

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

@keyframes animalBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    10% {
        transform: translateY(-10px) rotate(-8deg);
    }
    30% {
        transform: translateY(-15px) rotate(8deg);
    }
    40% {
        transform: translateY(-8px) rotate(-5deg);
    }
    60% {
        transform: translateY(-12px) rotate(5deg);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    flex-shrink: 1;
}

.nav-link {
    text-decoration: none;
    color: #6366f1;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.nav-link:hover {
    color: #4f46e5;
    background-color: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #6366f1;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 80%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: #ffffff;
    margin: 3px 0;
    transition: 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    background-image: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)), url('./Images/LearningeyesImage1_Safe.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: none;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: none;
}

@keyframes blobDrift {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-10px) rotate(10deg) scale(1.03); }
    100% { transform: translateY(0) rotate(-6deg) scale(1); }
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-main-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin: 10rem 0 1.5rem 0;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle-main {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    line-height: 1.3;
    text-align: left;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
}

.hero-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap:12rem;
    align-items: center;
    margin-top: 2rem;
}

/* removed hero-popups styles per overlap feedback */

.hero-content {
    color: white;
    text-align: left;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

.highlight {
    color: #f8fafc;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: #fbbf24;
    color: #1f2937;
}

.btn-primary:hover {
    background: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(251, 191, 36, 0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: #6366f1;
    transform: translateY(-2px);
}

.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 400px;
}

.hero-photo {
    display: none;
}

.floating-elements {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.floating-icon {
    position: absolute;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--icon-bg-1), var(--icon-bg-2));
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    animation: float 8s ease-in-out infinite;
    animation-delay: var(--delay);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0.9;
}

/* Different animation patterns for each icon */
.floating-icon:nth-child(1) { 
    animation: float1 8s ease-in-out infinite;
    animation-delay: 0s;
}
.floating-icon:nth-child(2) { 
    animation: float2 10s ease-in-out infinite;
    animation-delay: 1.5s;
}
.floating-icon:nth-child(3) { 
    animation: float3 7s ease-in-out infinite;
    animation-delay: 3s;
}
.floating-icon:nth-child(4) { 
    animation: float4 9s ease-in-out infinite;
    animation-delay: 4.5s;
}
.floating-icon:nth-child(5) { 
    animation: float5 6s ease-in-out infinite;
    animation-delay: 6s;
}
.floating-icon:nth-child(6) { 
    animation: float6 11s ease-in-out infinite;
    animation-delay: 2s;
}
.floating-icon:nth-child(7) { 
    animation: float7 8.5s ease-in-out infinite;
    animation-delay: 5s;
}
.floating-icon:nth-child(8) { 
    animation: float8 7.5s ease-in-out infinite;
    animation-delay: 1s;
}

/* Individual icon colors */
.floating-icon:nth-child(1) {
    --icon-bg-1: #ff6b6b;
    --icon-bg-2: #ff8e8e;
}

.floating-icon:nth-child(2) {
    --icon-bg-1: #4ecdc4;
    --icon-bg-2: #6dd5d0;
}

.floating-icon:nth-child(3) {
    --icon-bg-1: #45b7d1;
    --icon-bg-2: #6bc5d8;
}

.floating-icon:nth-child(4) {
    --icon-bg-1: #96ceb4;
    --icon-bg-2: #a8d5c1;
}

.floating-icon:nth-child(5) {
    --icon-bg-1: #feca57;
    --icon-bg-2: #fed976;
}

.floating-icon:nth-child(6) {
    --icon-bg-1: #ff9ff3;
    --icon-bg-2: #ffb3f5;
}

.floating-icon:nth-child(7) {
    --icon-bg-1: #54a0ff;
    --icon-bg-2: #74b9ff;
}

.floating-icon:nth-child(8) {
    --icon-bg-1: #5f27cd;
    --icon-bg-2: #7c4dff;
}

/* Remove old positioning rules as we're using CSS variables now */

@keyframes float1 {
    0% { 
        transform: translate(-50%, -50%) translateY(140px) translateX(-30px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    10% { 
        transform: translate(-50%, -50%) translateY(100px) translateX(-20px) rotate(45deg) scale(0.5);
        opacity: 0.6;
    }
    25% { 
        transform: translate(-50%, -50%) translateY(40px) translateX(10px) rotate(90deg) scale(0.8);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) translateY(-30px) translateX(40px) rotate(180deg) scale(1.1);
        opacity: 1;
    }
    75% { 
        transform: translate(-50%, -50%) translateY(-70px) translateX(20px) rotate(270deg) scale(0.9);
        opacity: 0.7;
    }
    90% { 
        transform: translate(-50%, -50%) translateY(-100px) translateX(-10px) rotate(360deg) scale(0.5);
        opacity: 0.3;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-130px) translateX(-50px) rotate(360deg) scale(0.1);
        opacity: 0;
    }
}

@keyframes float2 {
    0% { 
        transform: translate(-50%, -50%) translateY(150px) translateX(-40px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    15% { 
        transform: translate(-50%, -50%) translateY(100px) translateX(-25px) rotate(-60deg) scale(0.5);
        opacity: 0.6;
    }
    30% { 
        transform: translate(-50%, -50%) translateY(30px) translateX(-5px) rotate(-120deg) scale(0.8);
        opacity: 1;
    }
    55% { 
        transform: translate(-50%, -50%) translateY(-40px) translateX(20px) rotate(-200deg) scale(1.2);
        opacity: 1;
    }
    75% { 
        transform: translate(-50%, -50%) translateY(-80px) translateX(40px) rotate(-280deg) scale(0.9);
        opacity: 0.7;
    }
    90% { 
        transform: translate(-50%, -50%) translateY(-110px) translateX(50px) rotate(-360deg) scale(0.4);
        opacity: 0.3;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-140px) translateX(60px) rotate(-360deg) scale(0.1);
        opacity: 0;
    }
}

@keyframes float3 {
    0% { 
        transform: translate(-50%, -50%) translateY(130px) translateX(-40px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    20% { 
        transform: translate(-50%, -50%) translateY(80px) translateX(-30px) rotate(90deg) scale(0.5);
        opacity: 0.6;
    }
    40% { 
        transform: translate(-50%, -50%) translateY(20px) translateX(-10px) rotate(180deg) scale(0.8);
        opacity: 1;
    }
    60% { 
        transform: translate(-50%, -50%) translateY(-30px) translateX(20px) rotate(270deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(-50%, -50%) translateY(-70px) translateX(50px) rotate(360deg) scale(0.7);
        opacity: 0.5;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-110px) translateX(80px) rotate(450deg) scale(0.2);
        opacity: 0;
    }
}

@keyframes float4 {
    0% { 
        transform: translate(-50%, -50%) translateY(145px) translateX(-35px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    25% { 
        transform: translate(-50%, -50%) translateY(90px) translateX(-20px) rotate(120deg) scale(0.5);
        opacity: 0.7;
    }
    50% { 
        transform: translate(-50%, -50%) translateY(20px) translateX(5px) rotate(240deg) scale(0.9);
        opacity: 1;
    }
    75% { 
        transform: translate(-50%, -50%) translateY(-40px) translateX(30px) rotate(360deg) scale(1.1);
        opacity: 0.8;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-90px) translateX(50px) rotate(480deg) scale(0.3);
        opacity: 0;
    }
}

@keyframes float5 {
    0% { 
        transform: translate(-50%, -50%) translateY(135px) translateX(0px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    20% { 
        transform: translate(-50%, -50%) translateY(70px) translateX(15px) rotate(180deg) scale(0.5);
        opacity: 0.6;
    }
    40% { 
        transform: translate(-50%, -50%) translateY(10px) translateX(30px) rotate(360deg) scale(0.9);
        opacity: 1;
    }
    60% { 
        transform: translate(-50%, -50%) translateY(-50px) translateX(40px) rotate(540deg) scale(1.2);
        opacity: 1;
    }
    80% { 
        transform: translate(-50%, -50%) translateY(-90px) translateX(20px) rotate(720deg) scale(0.7);
        opacity: 0.5;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-125px) translateX(-20px) rotate(900deg) scale(0.2);
        opacity: 0;
    }
}

@keyframes float6 {
    0% { 
        transform: translate(-50%, -50%) translateY(125px) translateX(-25px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    30% { 
        transform: translate(-50%, -50%) translateY(60px) translateX(-15px) rotate(150deg) scale(0.6);
        opacity: 0.8;
    }
    60% { 
        transform: translate(-50%, -50%) translateY(-10px) translateX(10px) rotate(300deg) scale(1.1);
        opacity: 1;
    }
    90% { 
        transform: translate(-50%, -50%) translateY(-60px) translateX(40px) rotate(450deg) scale(0.6);
        opacity: 0.4;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-100px) translateX(70px) rotate(600deg) scale(0.1);
        opacity: 0;
    }
}

@keyframes float7 {
    0% { 
        transform: translate(-50%, -50%) translateY(120px) translateX(-35px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    25% { 
        transform: translate(-50%, -50%) translateY(50px) translateX(-20px) rotate(90deg) scale(0.5);
        opacity: 0.7;
    }
    50% { 
        transform: translate(-50%, -50%) translateY(-20px) translateX(10px) rotate(180deg) scale(1.0);
        opacity: 1;
    }
    75% { 
        transform: translate(-50%, -50%) translateY(-70px) translateX(30px) rotate(270deg) scale(1.2);
        opacity: 0.9;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-110px) translateX(50px) rotate(360deg) scale(0.3);
        opacity: 0;
    }
}

@keyframes float8 {
    0% { 
        transform: translate(-50%, -50%) translateY(155px) translateX(-45px) rotate(0deg) scale(0.2);
        opacity: 0;
    }
    20% { 
        transform: translate(-50%, -50%) translateY(100px) translateX(-30px) rotate(120deg) scale(0.5);
        opacity: 0.6;
    }
    40% { 
        transform: translate(-50%, -50%) translateY(30px) translateX(-10px) rotate(240deg) scale(0.9);
        opacity: 1;
    }
    60% { 
        transform: translate(-50%, -50%) translateY(-30px) translateX(15px) rotate(360deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(-50%, -50%) translateY(-75px) translateX(35px) rotate(480deg) scale(0.7);
        opacity: 0.5;
    }
    100% { 
        transform: translate(-50%, -50%) translateY(-120px) translateX(55px) rotate(600deg) scale(0.2);
        opacity: 0;
    }
}

.floating-icon i {
    transition: transform 0.3s ease;
    margin-bottom: 2px;
}

.floating-icon:hover i {
    transform: scale(1.2) rotate(-8deg);
}

.icon-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    text-align: center;
    line-height: 1;
    margin-top: 2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.floating-icon:hover {
    transform: translate(-50%, -50%) scale(1.1) translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

/* Learning Pages Section */
.learning-pages {
    padding: 3rem 0 4rem 0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    margin-top: 0;
    color: #1f2937;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.page-card {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    display: block;
}

.page-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: inherit;
    border-color: var(--page-icon-bg-1);
}

.page-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--page-icon-bg-1), var(--page-icon-bg-2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 3px solid rgba(255, 255, 255, 0.9);
    animation: gentle-pulse 3s ease-in-out infinite;
    opacity: 1;
}

.page-card:hover .page-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
    animation: none;
}

@keyframes gentle-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    }
}

/* Individual page card colors matching floating icons */
.page-card:nth-child(1) .page-icon {
    --page-icon-bg-1: #ff6b6b;
    --page-icon-bg-2: #ff8e8e;
}

.page-card:nth-child(2) .page-icon {
    --page-icon-bg-1: #4ecdc4;
    --page-icon-bg-2: #6dd5d0;
}

.page-card:nth-child(3) .page-icon {
    --page-icon-bg-1: #45b7d1;
    --page-icon-bg-2: #6bc5d8;
}

.page-card:nth-child(4) .page-icon {
    --page-icon-bg-1: #96ceb4;
    --page-icon-bg-2: #a8d5c1;
}

.page-card:nth-child(5) .page-icon {
    --page-icon-bg-1: #feca57;
    --page-icon-bg-2: #fed976;
}

.page-card:nth-child(6) .page-icon {
    --page-icon-bg-1: #ff9ff3;
    --page-icon-bg-2: #ffb3f5;
}

.page-card:nth-child(7) .page-icon {
    --page-icon-bg-1: #54a0ff;
    --page-icon-bg-2: #74b9ff;
}

.page-card:nth-child(8) .page-icon {
    --page-icon-bg-1: #5f27cd;
    --page-icon-bg-2: #7c4dff;
}

.page-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.page-card p {
    color: #6b7280;
    line-height: 1.6;
}

/* Resources Section */
.resources {
    padding: 6rem 0;
    background: white;
}

.resource-categories {
    margin-top: 3rem;
}

.category-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn.active,
.tab-btn:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.resource-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
}

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

.resource-image {
    height: 200px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #9ca3af;
}

.resource-content {
    padding: 1.5rem;
}

.resource-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.resource-description {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.resource-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 25px;
}

/* Activities Section */
.activities {
    padding: 6rem 0;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.activity-card {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid #e5e7eb;
}

.activity-card:hover {
    transform: translateY(-5px) rotate(-1deg);
}

.activity-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
}

.activity-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.activity-card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Upload Section */
.upload-section {
    padding: 6rem 0;
    background: white;
}

.upload-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #6366f1;
    background: #f0f4ff;
}

.upload-area i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.upload-area p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.upload-info {
    background: #f8fafc;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #e5e7eb;
}

.upload-info h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.upload-info ul {
    list-style: none;
}

.upload-info li {
    padding: 0.5rem 0;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.upload-info li:last-child {
    border-bottom: none;
}

/* About Section */
.about {
    padding: 4rem 0 3rem 0;
    background: #f8fafc;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.about-header {
    margin-bottom: 1.5rem;
}

.about-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0;
    color: #1f2937;
}

.about-top-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 1rem;
    margin-top: 0;
}

.about-image {
    align-self: flex-start;
    margin-top: -2.5rem;
    padding-top: 0;
}

.learning-image-container {
    margin-top: -2.5rem;
}

.about-text-top p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
}

.about-text-bottom {
    width: 100%;
    margin-top: 0;
    padding-top: 0;
}

.about-text-bottom p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
}

.about-text p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.stat p {
    color: #6b7280;
    font-weight: 500;
}

.about-image {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 0;
}

/* Mom and Child Learning Image */
.learning-image-container {
    width: 400px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    background: transparent;
    margin-top: -4rem;
    padding-top: 0;
}

.learning-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    transition: all 0.3s ease;
    filter: none;
    background: transparent;
}

.learning-image:hover {
    transform: scale(1.02);
    filter: none;
    box-shadow: none;
}


/* Contact Section */
.contact {
    padding: 0 0 6rem 0;
    margin-top: 0;
    background: white;
}

.work-in-progress {
    margin-top: 5rem !important;
    padding-top: 2rem !important;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    margin-top: 3rem;
}

.contact-info h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #1f2937;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.contact-item i {
    width: 40px;
    height: 40px;
    background: #6366f1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.contact-form {
    background: #f8fafc;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #e5e7eb;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
}

/* Footer */
.footer {
    background: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
}

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

/* Override inline styles for mobile */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }
    
    .footer-section {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .footer-section h4 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-section ul {
        margin: 0;
        padding: 0;
    }
    
    .footer-section ul li {
        margin-bottom: 0.5rem;
    }
    
    .social-links {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-logo .logo-container {
    width: 200px;
    height: 80px;
}

.footer-logo .logo-text {
    font-size: 1.4rem;
    margin-top: 20px;
    color: white;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #ef4444, #8b5cf6);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.footer-logo .logo-animals {
    top: -5px;
    width: 180px;
    height: 40px;
}

.footer-logo .animal {
    font-size: 1.4rem;
    animation: animalBounce 3s infinite;
}

.footer-section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: #374151;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.3s ease;
}

.social-links a:hover {
    background: #6366f1;
}

/* Social Share Buttons */
.social-share-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.share-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: #374151;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.share-facebook:hover {
    background: #1877f2;
}

.share-twitter:hover {
    background: #1da1f2;
}

.share-pinterest:hover {
    background: #bd081c;
}

.share-whatsapp:hover {
    background: #25d366;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
}

.close:hover {
    color: #000;
}

/* Quiz Styles */
.quiz-container {
    text-align: center;
}

.quiz-question {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #1f2937;
}

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

.quiz-option {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.quiz-option:hover {
    border-color: #6366f1;
    background: #f0f4ff;
}

.quiz-option.selected {
    border-color: #6366f1;
    background: #6366f1;
    color: white;
}

.quiz-option.correct {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
}

.quiz-score {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

/* Memory Game Styles */
.memory-game {
    text-align: center;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.memory-card {
    aspect-ratio: 1;
    background: #f3f4f6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 2rem;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.memory-card:hover {
    background: #e5e7eb;
}

.memory-card.flipped {
    background: white;
    color: #1f2937;
    border-color: #6366f1;
}

.memory-card.matched {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.memory-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .nav-container {
        max-width: 100%;
        gap: 1rem;
        align-items: center;
    }
    
    .nav-menu {
        gap: 0.4rem;
    }
    
    .nav-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.5rem;
    }
    
    .logo-container {
        width: 240px;
        height: 80px;
    }
    
    .logo-text {
        font-size: 1.8rem;
    }
    
    .logo-animals {
        width: 220px;
        height: 40px;
    }
    
    .animal {
        font-size: 1.6rem;
    }

    /* Prevent navbar overlap on laptop widths */
    .hero {
        padding-top: 7.5rem;
    }

    .hero-main-title {
        white-space: nowrap;
        margin: -10rem 0 3rem 0;
        text-align: center;
    }

    .hero-content-wrapper {
        margin-top: 3rem;
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    * {
        max-width: 100%;
    }
    
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    .logo-container {
        width: 250px;
        height: 80px;
    }

    .logo-text {
        font-size: 1.8rem;
        margin-top: 15px;
    }

    .logo-animals {
        top: -8px;
        width: 220px;
        height: 40px;
    }

    .animal {
        font-size: 1.6rem;
    }

    .footer-logo .logo-container {
        width: 160px;
        height: 60px;
    }

    .footer-logo .logo-text {
        font-size: 1.1rem;
        margin-top: 15px;
    }

    .footer-logo .logo-animals {
        top: -3px;
        width: 140px;
        height: 30px;
    }

    .footer-logo .animal {
        font-size: 1.1rem;
    }

    .hero-container {
        text-align: center;
    }

    .hero-content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }

    .hero-main-title {
        font-size: 2rem;
        white-space: normal;
        word-wrap: break-word;
        margin: 0 0 1rem 0;
        text-align: center;
        padding: 0 1rem;
    }
    
    .hero-container {
        padding: 0 1rem;
    }

    .hero-subtitle-main {
        font-size: 1.5rem;
        text-align: center;
        margin: 0 0 1.5rem 0;
    }

    .hero-content {
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .about-content {
        gap: 1.5rem;
    }
    
    .about-top-section {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .about-text-bottom {
        text-align: left;
    }

    .contact-content {
        grid-template-columns: 1fr;
    }

    .upload-container {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .category-tabs {
        flex-direction: column;
        align-items: center;
    }

    .tab-btn {
        width: 200px;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    /* Added overrides to prevent header overlap */
    .hero {
        padding-top: 6.5rem;
    }

    .hero-main-title {
        white-space: normal;
        margin: 0 0 1rem 0;
    }

    .hero-subtitle-main {
        font-size: 1.25rem;
        text-align: center;
        margin: 0 0 1.5rem 0;
    }

    .hero-content-wrapper {
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    /* Ensure no horizontal overflow */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .hero-container {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .hero-main-title {
        font-size: 1.75rem;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        margin: 0 0 1rem 0;
        text-align: center;
        padding: 0 0.5rem;
        line-height: 1.3;
    }

    .hero-subtitle-main {
        font-size: 1.1rem;
        text-align: center;
        margin: 0 0 1.5rem 0;
        padding: 0 0.5rem;
        word-wrap: break-word;
    }
    
    .hero-content-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 1.5rem;
        padding: 0;
    }
    
    .hero-content {
        padding: 0 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        padding: 0;
        word-wrap: break-word;
    }

    .section-title {
        font-size: 2rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .floating-elements {
        width: 200px;
        height: 200px;
        min-height: 200px;
    }

    .floating-icon {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .icon-label {
        font-size: 0.6rem;
    }
    
    .floating-icon:hover {
        transform: translate(-50%, -50%) scale(1.05) translateY(-3px);
    }

    .logo-container {
        width: 200px;
        height: 70px;
    }

    .logo-text {
        font-size: 1.4rem;
        margin-top: 12px;
    }

    .logo-animals {
        top: -6px;
        width: 180px;
        height: 35px;
    }

    .animal {
        font-size: 1.3rem;
    }

    .footer-logo .logo-container {
        width: 140px;
        height: 50px;
    }

    .footer-logo .logo-text {
        font-size: 0.9rem;
        margin-top: 12px;
    }

    .footer-logo .logo-animals {
        top: -2px;
        width: 120px;
        height: 25px;
    }

    .footer-logo .animal {
        font-size: 0.9rem;
    }

    /* Added stronger mobile protection */
    .hero {
        padding-top: 7.5rem;
    }

    .hero-main-title {
        white-space: normal;
        word-wrap: break-word;
        margin: 0 0 1.5rem 0;
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    /* Ensure no horizontal scroll on any element */
    .nav-container {
        padding: 0 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    /* Fix any grid or flex items that might overflow */
    .categories-grid,
    .features-grid,
    .tools-grid {
        padding: 0 0.5rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Page Hero Styles */
.page-hero {
    padding: 8rem 0 1rem;
    background: #ffffff;
    color: #333;
    text-align: left;
    position: relative;
    margin-top: 0;
}

.page-hero .container {
    text-align: left;
}

.page-hero .hero-content {
    text-align: left;
    width: 100%;
}



/* Additional decorative elements for coloring theme */
@keyframes crayonFloat {
    0%, 100% { transform: rotate(-15deg) translateY(0px); }
    50% { transform: rotate(-15deg) translateY(-10px); }
}

/* Paint splash effects */

.page-hero .hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
    color: #333;
}

.page-hero .hero-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 2;
    color: #666;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
}

/* Active Navigation Link */
.nav-link.active {
    color: #4f46e5;
    font-weight: 700;
    background-color: rgba(99, 102, 241, 0.15);
}

.nav-link.active::after {
    width: 80%;
}

/* Page-specific sections */
.doodle-tools, .colouring-categories, .story-categories, .worksheet-categories, .poster-categories, 
.quiz-categories, .puzzle-types, .rhyme-categories {
    padding: 2rem 0 3rem 0;
    margin-top: 5rem;
    background: #f8fafc;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 350px);
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 0 2rem;
    width: 100%;
    max-width: none;
    justify-items: center;
    align-items: stretch;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    color: #3b82f6;
}

.pagination-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn:disabled:hover {
    background: white;
    border-color: #e5e7eb;
    color: #374151;
}

.pagination-info {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 1rem;
}

/* Responsive grid adjustments */
@media (max-width: 1200px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 350px);
        padding: 0 1.5rem;
    }
    
    .categories-sidebar {
        max-height: 75vh;
    }
}

@media (max-width: 900px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(5, 350px);
        padding: 0 1rem;
    }
    
    .categories-sidebar {
        max-height: 70vh;
    }
}

@media (max-width: 700px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(8, 350px);
        padding: 0 0.5rem;
    }
    
    .categories-sidebar {
        max-height: 65vh;
    }
}

@media (max-width: 500px) {
    .categories-grid {
        grid-template-columns: repeat(1, 1fr);
        grid-template-rows: repeat(16, 350px);
        padding: 0 0.5rem;
    }
}

.tool-card, .category-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
    overflow: hidden;
}

.tool-card:hover, .category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.tool-icon, .category-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    font-size: 2rem;
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.tool-card h3, .category-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #1f2937;
    line-height: 1.2;
    flex-shrink: 0;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.tool-card p, .category-card p {
    color: #6b7280;
    margin-bottom: 1.2rem;
    line-height: 1.4;
    font-size: 0.85rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 3.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    white-space: normal;
}

.tool-card .btn, .category-card .btn {
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 500;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Gallery and Grid Styles */
.drawing-gallery, .featured-pages, .featured-stories, .featured-worksheets, .featured-posters, 
.featured-puzzles, .featured-rhymes {
    padding: 6rem 0;
    background: white;
}

.gallery-grid, .pages-grid, .stories-grid, .worksheets-grid, .posters-grid, .puzzles-grid, .rhymes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.gallery-item, .page-item, .story-card, .worksheet-item, .poster-item, .puzzle-item, .rhyme-item {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid #e5e7eb;
}

.gallery-item:hover, .page-item:hover, .story-card:hover, .worksheet-item:hover, .poster-item:hover, 
.puzzle-item:hover, .rhyme-item:hover {
    transform: translateY(-5px);
}

.gallery-placeholder, .page-preview, .story-cover, .worksheet-preview, .poster-preview, 
.puzzle-preview, .rhyme-cover {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.gallery-item h4, .page-item h4, .story-card h3, .worksheet-item h4, .poster-item h4, 
.puzzle-item h4, .rhyme-item h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.gallery-item p, .page-item p, .story-card p, .worksheet-item p, .poster-item p, 
.puzzle-item p, .rhyme-item p {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Story Meta */
.story-meta, .worksheet-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.story-meta span, .worksheet-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Writing Tips Section */
.writing-tips {
    padding: 6rem 0;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.tip-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid #e5e7eb;
}

.tip-card:hover {
    transform: translateY(-5px);
}

.tip-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
}

.tip-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.tip-card p {
    color: #6b7280;
    line-height: 1.6;
}

/* Quiz Features */
.quiz-features {
    padding: 6rem 0;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
}

/* FAQ Section */
.faq {
    padding: 6rem 0;
    background: #f8fafc;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.faq-item {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.faq-item h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.faq-item p {
    color: #6b7280;
    line-height: 1.6;
}

/* Contact Form Select */
.form-group select {
    width: 100%;
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
    background: white;
}

.form-group select:focus {
    outline: none;
    border-color: #6366f1;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* Drawing Canvas Section */
.drawing-canvas-section {
    padding: 2rem 0 2rem 0;
    margin-top: 5rem;
    background: #f8fafc;
    min-height: 80vh;
}

.doodle-page .top-toolbar {
    margin-top: 1.25rem;
}


/* Action Buttons Vertical */
.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.action-buttons-vertical .btn {
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    margin: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #374151;
    transition: all 0.2s ease;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.action-buttons-vertical .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Clear button specific styling */
.action-buttons-vertical #clearCanvas {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.action-buttons-vertical #clearCanvas:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Save button specific styling */
.action-buttons-vertical #saveDrawing {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.action-buttons-vertical #saveDrawing:hover {
    background: #059669;
    border-color: #059669;
}

/* Undo button specific styling */
.action-buttons-vertical #undoAction {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.action-buttons-vertical #undoAction:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Download button specific styling */
.action-buttons-vertical #downloadDrawing {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.action-buttons-vertical #downloadDrawing:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Brush and Eraser tool buttons - default (inactive) state with dark text */
.action-buttons-vertical #brushTool:not(.active),
.action-buttons-vertical #eraserTool:not(.active),
.action-buttons-vertical #fillTool:not(.active) {
    background: white;
    border-color: #e2e8f0;
    color: #1f2937;
}

.action-buttons-vertical #brushTool:not(.active):hover,
.action-buttons-vertical #eraserTool:not(.active):hover,
.action-buttons-vertical #fillTool:not(.active):hover {
    background: #f3f4f6;
    border-color: #6366f1;
    color: #6366f1;
}

/* Brush and Eraser tool buttons active state */
.action-buttons-vertical #brushTool.active,
.action-buttons-vertical #eraserTool.active,
.action-buttons-vertical #fillTool.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.action-buttons-vertical #brushTool.active:hover,
.action-buttons-vertical #eraserTool.active:hover,
.action-buttons-vertical #fillTool.active:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* Reference Upload Inline */
.reference-upload-inline {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    margin-left: 0.5rem;
    justify-content: center;
}

.reference-upload-inline .file-input {
    display: none;
}

.reference-upload-inline .tool-btn {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 0;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

.reference-upload-inline .tool-btn {
    width: 80px;
}

.reference-upload-inline #removeImage.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.reference-upload-inline #removeImage.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

.reference-upload-inline .tool-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Upload button specific styling */
.reference-upload-inline label.tool-btn {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.reference-upload-inline label.tool-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* Remove button specific styling */
.reference-upload-inline #removeImage.tool-btn {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.reference-upload-inline #removeImage.tool-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.reference-upload-inline .tool-btn i {
    font-size: 0.875rem;
}

/* Responsive Design for Drawing Canvas */
@media (max-width: 768px) {
    .canvas-area {
        flex-direction: column;
        gap: 1rem;
    }
    
    .left-sidebar {
        width: 100%;
        position: static;
        order: 2;
    }
    
    .canvas-container {
        order: 1;
    }
    
    .color-palette-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .tool-buttons {
        gap: 0.25rem;
    }
    
    .tool-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .tool-btn i {
        font-size: 0.75rem;
    }
    
    .action-buttons-vertical {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .action-buttons-vertical .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Top Toolbar */
.top-toolbar {
    background: transparent;
    border-radius: 12px;
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 150px;
    align-items: stretch;
}

.toolbar-section.reference-section {
    min-width: auto;
    margin-left: 0.5rem;
}

.toolbar-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    line-height: 1.1;
}

.tool-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: space-between;
}

/* Doodle top drawing tools: left align text */
.top-toolbar .tool-buttons .tool-btn {
    justify-content: flex-start;
    text-align: left;
}

.action-buttons-inline {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-left: 1cm;
    align-items: center;
}

.toolbar-section.movable-section:last-child h4 {
    margin-left: 1cm;
}

.action-buttons-inline .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 8px;
}

.action-buttons-inline .btn {
    height: 34px;
    line-height: 1;
}

/* Doodle header action colors */
.action-buttons-inline #clearCanvas {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.action-buttons-inline #clearCanvas:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.action-buttons-inline #undoAction {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.action-buttons-inline #undoAction:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.action-buttons-inline #saveDrawing {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.action-buttons-inline #saveDrawing:hover {
    background: #059669;
    border-color: #059669;
}

.action-buttons-inline #downloadDrawing {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.action-buttons-inline #downloadDrawing:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Colouring modal header action colors */
.modal-header-actions #clearCanvas {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.modal-header-actions #clearCanvas:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.modal-header-actions #undoAction {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.modal-header-actions #undoAction:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.modal-header-actions #saveDrawing {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.modal-header-actions #saveDrawing:hover {
    background: #059669;
    border-color: #059669;
}

.modal-header-actions #downloadDrawing {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.modal-header-actions #downloadDrawing:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.tool-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    min-width: 0;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

/* Doodle toolbar: keep all buttons the same height */
.top-toolbar .tool-btn,
.reference-upload-inline .tool-btn,
.action-buttons-inline .btn {
    height: 34px;
    line-height: 1;
}

.tool-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    transform: translateY(-1px);
}

.tool-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.tool-btn i {
    font-size: 0.875rem;
}

.brush-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brush-slider {
    flex: 1;
    min-width: 80px;
}

#brushSizeValue {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    min-width: 35px;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.color-palette-grid .color-swatch {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.color-palette-grid .color-swatch:hover {
    transform: scale(1.1);
}

.color-palette-grid .color-swatch.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.custom-color-picker {
    width: 100%;
    height: 35px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Shape Options */
.shape-options {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    text-align: center;
}

.shape-options h4 {
    color: #374151;
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.shape-buttons {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.25rem;
    justify-content: center;
}

.shape-btn {
    padding: 0.25rem 0.5rem;
    border: 2px solid #6b7280;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.625rem;
    color: #6b7280;
    font-weight: 500;
    min-height: 45px;
    justify-content: center;
}

.shape-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

.shape-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Text Options */
.text-options {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.text-options h4 {
    color: #166534;
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.text-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.text-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-control-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #166534;
}

.text-control-group input[type="range"] {
    width: 100px;
}

.text-control-group select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #22c55e;
    border-radius: 4px;
    font-size: 0.875rem;
}

#fontSizeValue {
    font-size: 0.875rem;
    color: #166534;
    font-weight: 500;
    min-width: 40px;
}

/* AI Assistant */
.ai-assistant {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.ai-prompt-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.ai-input:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.ai-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.ai-suggestion {
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid #f59e0b;
    text-align: center;
}

.ai-suggestion:hover {
    background: #fef3c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2);
}

/* Canvas Area */
.canvas-area {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.doodle-page .canvas-area {
    gap: 0;
}

.left-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    flex-shrink: 0;
    height: 700px;
    justify-content: flex-start;
}

/* Doodle page: compact left tools and fit canvas without scroll */
/* Doodle left panel: match colouring page layout exactly */
.doodle-page .left-sidebar {
    height: auto;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    padding: 1.5rem;
    gap: 0;
}

.doodle-page .sidebar-section {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    flex: none;
}

.doodle-page .sidebar-section:not(:last-child) {
    margin-bottom: 1cm;
}

.doodle-page .sidebar-section h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
}

/* Doodle: add 1cm gap only between color picker and brush size block */
.doodle-page .custom-color-picker {
    margin-top: 0.5rem;
    margin-bottom: 1cm;
}

.doodle-page .color-palette-grid {
    margin-bottom: 0;
}

.doodle-page .color-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.doodle-page .color-palette-grid .color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.doodle-page .custom-color-picker {
    height: 35px;
    border-radius: 8px;
}

.doodle-page .brush-control {
    gap: 0.5rem;
    margin: 0;
}

.doodle-page .sidebar-section .brush-control:first-of-type {
    margin-bottom: 0.5cm;
}

.doodle-page #brushSizeValue,
.doodle-page #fillToleranceValue {
    font-size: 0.875rem;
    color: #6b7280;
}

.doodle-page #brushSize,
.doodle-page #fillTolerance {
    width: 100%;
    margin-bottom: 0.5rem;
}

.doodle-page .canvas-container {
    height: auto;
    max-height: calc(100vh - 240px);
    padding: 0.5rem;
    border-radius: 8px;
    border-width: 1px;
    box-shadow: none;
}

.doodle-page #drawingCanvas {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 240px);
    border-radius: 6px;
}

.sidebar-section {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-section h4 {
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    text-align: center;
}

.sidebar-section h4:not(:first-child) {
    margin-top: 1.5rem;
}

.canvas-container {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    text-align: center;
    height: 700px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#drawingCanvas {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: crosshair;
    display: block;
    width: 1000px;
    height: 700px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Text Input Overlay */
.text-input-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 300px;
}

#textArea {
    width: 100%;
    height: 100px;
    border: 1px solid #22c55e;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    resize: none;
    margin-bottom: 1rem;
}

.text-controls-overlay {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Reference Image */
.reference-image {
    position: absolute;
    top: 1rem;
    right: 1rem;
    max-width: 150px;
    max-height: 188px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0.8;
    pointer-events: none;
    z-index: 10;
}

/* Colouring canvas reference image - make it usable on mobile */
.colouring-canvas-container .reference-image {
    position: absolute;
    top: 1rem;
    right: 1rem;
    max-width: 150px;
    max-height: 188px;
}

@media (max-width: 768px) {
    .colouring-canvas-container .reference-image {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        max-width: 100% !important;
        max-height: 250px !important;
        width: auto !important;
        margin: 1rem auto;
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
}

.reference-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Reference Upload */
.reference-upload {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.reference-upload h4 {
    color: #374151;
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.file-input {
    display: none;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item .gallery-actions {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
}

.gallery-item .gallery-actions button {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Responsive Design for Drawing Interface */
@media (max-width: 1200px) {
    .canvas-area {
        flex-direction: column;
        gap: 1rem;
    }
    
    .left-sidebar {
        height: auto;
        flex-direction: row;
        min-width: auto;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .sidebar-section {
        min-width: 180px;
        flex-shrink: 0;
    }
    
    #drawingCanvas {
        width: 800px;
        height: 600px;
    }
    
    .canvas-container {
        height: 600px;
    }
}

/* Doodle tablet layout: keep tools left + canvas right like colouring page */
@media (max-width: 1200px) and (min-width: 769px) {
    .doodle-page .canvas-area {
        flex-direction: row;
        gap: 1.5rem;
        align-items: stretch;
    }

    .doodle-page .left-sidebar {
        flex-direction: column;
        width: 200px;
        min-width: 200px;
        height: 70vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 0;
    }

    .doodle-page .sidebar-section {
        min-width: auto;
    }

    .doodle-page .canvas-container {
        height: 70vh;
        flex: 1;
    }

    .doodle-page #drawingCanvas {
        width: 100%;
        height: 100%;
    }

    .doodle-page .drawing-gallery {
        display: none;
    }
}

/* Tablet portrait: use hamburger menu */
@media (max-width: 1279px) and (min-width: 769px) and (orientation: portrait) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
        z-index: 1001;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 1rem 0;
    }
}

/* Tablet landscape: use hamburger up to iPad Air/Mini widths */
@media (max-width: 1279px) and (min-width: 769px) and (orientation: landscape) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
        z-index: 1001;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 1rem 0;
    }
}

/* Wide tablet landscape (iPad Pro+): show full nav */
@media (min-width: 1280px) and (orientation: landscape) {
    .hamburger {
        display: none;
    }

    .nav-menu {
        position: static;
        flex-direction: row;
        width: auto;
        text-align: left;
        box-shadow: none;
        padding: 0;
    }

    .nav-menu li {
        margin: 0;
    }
}

/* Tablet landscape hero visibility fixes */
@media (max-width: 1279px) and (min-width: 769px) and (orientation: landscape) {
    .hero {
        padding-top: 7rem;
        min-height: auto;
    }

    .hero-main-title {
        margin: 2rem 0 1rem 0;
        font-size: 2.25rem;
        text-align: left;
        white-space: normal;
    }

    .hero-subtitle-main {
        font-size: 1.35rem;
        margin: 0 0 1.25rem 0;
        text-align: left;
        white-space: normal;
    }
}

@media (max-width: 1024px) {
    .canvas-area {
        flex-direction: column;
        gap: 1rem;
    }
    
    .left-sidebar {
        height: auto;
        flex-direction: row;
        min-width: auto;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .sidebar-section {
        min-width: 160px;
        flex-shrink: 0;
    }
    
    #drawingCanvas {
        width: 700px;
        height: 500px;
    }
    
    .canvas-container {
        height: 500px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .doodle-page .left-sidebar {
        width: 200px;
        min-width: 200px;
        height: 70vh;
    }

    .doodle-page .canvas-container {
        height: 70vh;
        flex: 1;
    }
}

@media (max-width: 768px) {
    /* Top toolbar mobile fixes */
    .top-toolbar {
        display: none;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        overflow-x: visible;
    }

    .canvas-area {
        flex-direction: column;
        gap: 1rem;
    }
    
    .toolbar-section {
        width: 100%;
        min-width: auto;
    }
    
    .tool-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .tool-btn {
        flex: 1 1 auto;
        min-width: 80px;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .tool-btn span {
        display: inline;
    }
    
    .left-sidebar {
        height: auto;
        flex-direction: column;
        gap: 1rem;
        overflow-x: visible;
        overflow-y: auto;
        padding-bottom: 0;
        max-height: 45vh;
        order: 1;
    }
    
    .sidebar-section {
        min-width: auto;
        width: 100%;
        flex-shrink: 0;
    }
    
    .color-palette {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .action-buttons-vertical {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .canvas-container {
        padding: 0.5rem;
        height: auto;
        min-height: 400px;
        max-height: 70vh;
        order: 2;
    }
    
    #drawingCanvas {
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        max-height: 70vh;
        aspect-ratio: 4/3;
    }
    
    /* Reference image - make it larger and better positioned on mobile */
    .reference-image {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        max-width: 100% !important;
        max-height: 200px !important;
        width: auto !important;
        margin: 1rem auto;
        display: block;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .drawing-gallery {
        display: none;
    }
}

/* Category Filtering Styles */
.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.view-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.view-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* List View Styles */
.categories-list-view {
    margin-top: 1rem;
}

.list-container {
    display: flex;
    gap: 1rem;
    min-height: 80vh;
    align-items: stretch;
}

.categories-sidebar {
    width: 220px;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
    max-height: 80vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.categories-sidebar h3 {
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.3;
}

.category-list-item:hover {
    background: #f3f4f6;
    color: #374151;
}

.category-list-item.active {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

.category-list-item i {
    width: 16px;
    text-align: center;
    font-size: 0.875rem;
}

.category-list-item span:first-of-type {
    flex: 1;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.category-list-item .count {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 400;
    flex-shrink: 0;
}

.thumbnails-container {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
    gap: 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.thumbnails-header h3 {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.thumbnails-header span {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

.search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: #1f2937;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 0.875rem;
    pointer-events: none;
}

.search-input:focus + .search-icon {
    color: #3b82f6;
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 0.5rem;
    flex: 1;
    overflow-y: auto;
    grid-auto-rows: minmax(200px, auto);
}

.thumbnail-item {
    background: #f9fafb;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.thumbnail-preview {
    width: 100%;
    height: 120px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border: 2px solid #e5e7eb;
}

.thumbnail-emoji {
    font-size: 3rem;
}

.thumbnail-title {
    color: #1f2937;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.thumbnail-difficulty {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.difficulty-easy {
    background: #dcfce7;
    color: #166534;
}

.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

.thumbnail-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
}

/* Enhanced Colouring Cards */
.colouring-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 300px;
}

.colouring-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.card-preview {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    overflow: hidden;
    border-radius: 16px;
}

.preview-image {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
}

.card-image {
    width: 100%;
    height: 100%;
    min-height: 300px;
    object-fit: cover;
    object-position: center;
}

.uploaded-preview {
    font-size: 1.2rem;
    color: #374151;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 2px dashed #d1d5db;
    max-width: 80%;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.sample-preview {
    font-size: 4rem;
    opacity: 0.8;
}

.uploaded-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 2;
}

.new-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 5;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.card-title-overlay {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 5;
}

.card-title-overlay .card-title {
    color: #3b82f6;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    margin: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.colouring-card:hover .card-overlay {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: #3b82f6;
}

.overlay-content i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.overlay-content span {
    font-size: 1rem;
    font-weight: 500;
}

.card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0 0 16px 16px;
    z-index: 10;
}

.card-actions .btn {
    flex: 1;
    padding: 0.75rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 0;
}

.card-actions .btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
}

.card-actions .btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.card-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Colouring Modal Styles */
.colouring-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
}

.modal-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header-actions .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border-radius: 8px;
}

/* Colouring modal header tool buttons */
.modal-header-actions #brushTool,
.modal-header-actions #fillTool,
.modal-header-actions #eraserTool {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    color: #374151;
}

.modal-header-actions #brushTool:hover,
.modal-header-actions #fillTool:hover,
.modal-header-actions #eraserTool:hover {
    border-color: #6366f1;
    color: #4f46e5;
}

.modal-header-actions #brushTool.active,
.modal-header-actions #fillTool.active,
.modal-header-actions #eraserTool.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.modal-header-actions #clearCanvas {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.modal-header-actions #clearCanvas:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.modal-header-actions #undoAction {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.modal-header-actions #undoAction:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.modal-header-actions #saveDrawing {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.modal-header-actions #saveDrawing:hover {
    background: #059669;
    border-color: #059669;
}

.modal-header-actions #downloadDrawing {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.modal-header-actions #downloadDrawing:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.action-buttons-inline #clearCanvas {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.action-buttons-inline #clearCanvas:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.action-buttons-inline #undoAction {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.action-buttons-inline #undoAction:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.action-buttons-inline #saveDrawing {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.action-buttons-inline #saveDrawing:hover {
    background: #059669;
    border-color: #059669;
}

.action-buttons-inline #downloadDrawing {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.action-buttons-inline #downloadDrawing:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.drawing-canvas-section .sidebar-section {
    padding: 0.8rem;
}

.drawing-canvas-section .sidebar-section h4 {
    margin: 0.5rem 0 0.5rem 0;
    font-size: 0.85rem;
}

.drawing-canvas-section .brush-control {
    gap: 0.35rem;
}

.drawing-canvas-section .color-palette-grid {
    gap: 0.35rem;
}

.drawing-canvas-section .color-palette-grid .color-swatch {
    width: 30px;
    height: 30px;
}

@media (min-width: 769px) {
    .drawing-canvas-section .left-sidebar {
        height: min(700px, 70vh);
    }

    .drawing-canvas-section .canvas-container {
        height: min(700px, 70vh);
    }

    .drawing-canvas-section #drawingCanvas {
        width: 100%;
        height: 100%;
    }
}

.modal-header-buttons .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.colouring-tools {
    width: 250px;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tool-section {
    margin-bottom: 1.5rem;
    display: block;
    visibility: visible;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
    display: block;
    visibility: visible;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.more-colors-btn {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s ease;
}

.more-colors-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.more-colors-palette {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #374151;
}

.color-swatch.active {
    border-color: #3b82f6;
    border-width: 3px;
}

#brushSize {
    width: 100%;
    margin-bottom: 0.5rem;
}

#brushSizeValue {
    font-size: 0.875rem;
    color: #6b7280;
}

.tool-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.tool-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.tool-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}


.colouring-canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f9fafb;
    overflow: auto;
    min-height: 0; /* Allow flex item to shrink */
    position: relative;
    width: 100%;
    height: 100%;
}

/* Mobile fixes for colouring canvas */
@media (max-width: 768px) {
    .colouring-modal {
        padding: 0;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    
    .modal-body {
        flex-direction: column;
        height: calc(100vh - 60px); /* Subtract header height */
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 20;
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }

    .close-btn {
        color: #111827;
        font-size: 2.25rem;
    }
    
    .colouring-tools {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 1rem;
        overflow-x: visible;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        flex-shrink: 0;
        max-height: 40vh;
    }
    
    .tool-section {
        margin-bottom: 1rem;
        width: 100%;
        flex-shrink: 0;
    }
    
    .tool-section h4 {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
        font-weight: 600;
    }
    
    .color-palette-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .color-swatch {
        width: 40px;
        height: 40px;
    }
    
    .custom-color-picker {
        width: 100%;
        height: 40px;
        margin-top: 0.5rem;
    }
    
    .brush-control {
        width: 100%;
    }
    
    .brush-control input[type="range"] {
        width: 100%;
    }
    
    .action-buttons-vertical {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-buttons-vertical button {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        min-width: auto;
        white-space: nowrap;
    }
    
    .action-buttons-vertical button i {
        font-size: 0.9rem;
    }
    
    .colouring-canvas-container {
        flex: 1;
        min-height: 0;
        height: 100%;
        padding: 0.5rem;
    }
    
    #colouringCanvas {
        max-width: 100%;
        max-height: 100%;
        width: auto !important;
        height: auto !important;
    }
}

#colouringCanvas {
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-outline {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Responsive design for different screen sizes */
@media (max-width: 1400px) {
    .thumbnails-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        padding: 0.5rem;
    }
}

@media (max-width: 1200px) {
    .list-container {
        gap: 0.75rem;
        min-height: 75vh;
    }
    
    .categories-sidebar {
        width: 200px;
        padding: 0.875rem;
        max-height: 75vh;
    }
    
    .thumbnails-container {
        padding: 0.625rem;
    }
    
    .thumbnails-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.625rem;
        padding: 0.5rem;
    }
}

@media (max-width: 992px) {
    .list-container {
        gap: 0.75rem;
        min-height: 70vh;
    }
    
    .categories-sidebar {
        width: 180px;
        padding: 0.75rem;
        max-height: 70vh;
    }
    
    .thumbnails-container {
        padding: 0.5rem;
    }
    
    .thumbnails-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
        padding: 0.5rem;
    }
}

@media (max-width: 768px) {
    .list-container {
        flex-direction: column;
        gap: 0.75rem;
        min-height: 65vh;
    }
    
    .categories-sidebar {
        width: 100%;
        max-height: 200px;
        padding: 0.75rem;
    }
    
    .thumbnails-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }
}

@media (max-width: 600px) {
    .thumbnails-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.375rem;
    }
    
    .categories-sidebar {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .thumbnails-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.375rem;
    }
    
    .categories-sidebar {
        padding: 0.75rem;
    }
}

