@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Tajawal:wght@400;500;700&display=swap');

:root {
    /* Sleek, Professional Modern UI */
    --primary-color: #4F46E5;   /* Indigo */
    --primary-dark: #3730A3;
    --secondary-color: #10B981; /* Emerald */
    --secondary-dark: #059669;
    --accent-color: #F59E0B;    /* Amber */
    --accent-dark: #D97706;
    --bg-color: #F8FAFC;        /* Slate 50 */
    --card-bg: #FFFFFF;
    --text-main: #1E293B;       /* Slate 800 */
    --text-muted: #64748B;      /* Slate 500 */
    --glass-blur: blur(16px);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Tajawal', sans-serif;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(rgba(56, 189, 248, 0.1) 2px, transparent 2px), 
        radial-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px);
    background-size: 80px 80px, 40px 40px;
    background-position: 0 0, 20px 20px;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header Styles --- */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--glass-blur);
    border-bottom: 5px solid;
    border-image: linear-gradient(to right, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6) 1;
    padding: 1rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.subject-tag {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #F1F5F9;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    display: inline-block;
    margin-top: 0;
    margin-left: 10px;
    vertical-align: middle;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border: 3px solid transparent;
    background: #f1f5f9;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: #1d4ed8;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

#home-btn.active { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: #b91c1c; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4); }
#alphabet-btn.active { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #b45309; box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4); }
#units-btn.active { background: linear-gradient(135deg, #10b981, #059669); border-color: #047857; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4); }

/* --- Content Area --- */
#content-area {
    flex: 1;
    padding: 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.welcome-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.welcome-content {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    width: 100%;
    max-width: 900px;
}

/* --- Buttons --- */
button {
    font-family: inherit;
    outline: none;
}

.btn-back {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem !important;
    font-size: 1rem !important;
    transition: all 0.2s ease !important;
}

.btn-back:hover {
    background: #f1f5f9 !important;
    color: var(--text-main) !important;
}

/* --- Tracing Canvas --- */
#tracing-canvas, #dotCanvas {
    background-image: linear-gradient(#e2e8f0 1px, transparent 1px), linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px;
}

/* --- Responsive Design --- */
/* For tablets and smaller screens */
@media (max-width: 1024px) {
    .main-header {
        padding: 1rem 1.5rem;
    }
    #content-area {
        padding: 1.5rem;
    }
    .flower-wrapper {
        width: 250px;
        height: 250px;
    }
    .flower-bloom {
        width: 200px;
        height: 200px;
    }
    .flower-bloom::before {
        font-size: 12rem;
    }
}

/* For mobile devices */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }
    .nav-btn {
        flex: 1 1 auto;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
    }
    .logo {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
    }
    .subject-tag {
        margin-left: 0;
    }
    #content-area {
        padding: 1rem;
    }
    .welcome-content {
        padding: 1.5rem;
    }
    h1 {
        font-size: 2.2rem !important;
    }
    .flower-wrapper {
        width: 220px;
        height: 220px;
        margin: 0.5rem auto;
    }
    .flower-bloom {
        width: 180px;
        height: 180px;
    }
    .flower-bloom::before {
        font-size: 10rem;
    }
    .flying-creature {
        font-size: 3.5rem;
        top: -30px;
    }
    @keyframes float-bug {
        0%, 100% { top: -30px; }
        50% { top: -45px; }
    }
    .student-card {
        width: 100% !important;
        max-width: 300px;
        margin: 0 auto;
    }
    /* Star counter adjustment */
    .star-counter {
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
        justify-content: center;
        width: 100%;
    }
    .flower-wrapper:hover .bloom-action {
        width: 130px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* For very small devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem !important;
    }
    .nav-btn {
        width: 100%;
    }
    .flower-wrapper {
        width: 180px;
        height: 180px;
    }
    .flower-bloom {
        width: 140px;
        height: 140px;
    }
    .flower-bloom::before {
        font-size: 8rem;
    }
    .flying-creature {
        font-size: 2.5rem;
        top: -20px;
    }
    @keyframes float-bug {
        0%, 100% { top: -20px; }
        50% { top: -30px; }
    }
}

/* --- Animations & Effects --- */
@keyframes floating {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

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

@keyframes pulse-btn {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.floating-element {
    animation: floating 4s ease-in-out infinite;
}

.twinkling-star {
    position: absolute;
    animation: twinkle 3s ease-in-out infinite;
}

.shiny-text {
    background: linear-gradient(90deg, #ec4899 0%, #8b5cf6 30%, #ec4899 60%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 3s linear infinite;
    font-family: 'Outfit', 'Tajawal', sans-serif;
    padding: 0 5px;
}

.card-btn-pulse {
    animation: pulse-btn 2s infinite;
    transition: transform 0.3s ease, filter 0.3s ease !important;
}

.card-btn-pulse:hover {
    filter: brightness(1.1);
    transform: scale(1.08) !important;
}

.student-card {
    transition: all 0.3s ease;
}

.student-card .rocket-icon {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.student-card:hover .rocket-icon {
    transform: translateY(-25px) scale(1.15);
}

.activity-card {
    transition: all 0.3s ease;
}

.activity-card .game-icon {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.activity-card:hover .game-icon {
    transform: translateX(-15px) rotate(-15deg) scale(1.15);
}

body {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" style="font-size: 24px;"><text y="22">✨</text></svg>'), auto;
}

/* --- Butterfly Garden UI --- */
.flower-wrapper {
    position: relative;
    cursor: pointer;
    text-align: center;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flying-creature {
    position: absolute;
    top: -40px;
    font-size: 5rem;
    z-index: 20;
    transition: all 0.5s ease;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.2));
}

.butterfly {
    animation: flap-wings 1.5s infinite alternate, float-bug 3s ease-in-out infinite;
    left: 15%;
}

.bee {
    animation: float-bug 2s ease-in-out infinite, buzz-wings 0.1s infinite;
    right: 15%;
    transform: scaleX(-1);
}

@keyframes flap-wings {
    0% { transform: scaleX(1) rotate(-10deg); }
    100% { transform: scaleX(0.3) rotate(10deg); }
}

@keyframes buzz-wings {
    0% { transform: translateY(0) scaleX(-1) rotate(-5deg); }
    50% { transform: translateY(-2px) scaleX(-1) rotate(5deg); }
    100% { transform: translateY(0) scaleX(-1) rotate(-5deg); }
}

@keyframes float-bug {
    0%, 100% { top: -40px; }
    50% { top: -60px; }
}

.flower-bloom {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flower-bloom::before {
    position: absolute;
    z-index: 0;
    font-size: 16rem;
    opacity: 0.9;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.15));
}

.pink-bloom::before {
    content: '🌸';
}

.yellow-bloom::before {
    content: '🌻';
}

.pink-bloom {
    box-shadow: inset 0 0 40px rgba(255,255,255,0.8);
    background: radial-gradient(circle, rgba(252,231,243,0.9) 0%, rgba(252,231,243,0.4) 60%, transparent 100%);
}

.yellow-bloom {
    box-shadow: inset 0 0 40px rgba(255,255,255,0.8);
    background: radial-gradient(circle, rgba(254,243,199,0.9) 0%, rgba(254,243,199,0.4) 60%, transparent 100%);
}

.flower-content {
    z-index: 10;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.7);
    padding: 1.5rem;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 2px solid rgba(255,255,255,0.5);
    transition: all 0.4s ease;
}

.bloom-action {
    margin-top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    background: white;
    color: #db2777;
    border-radius: 50px;
    font-weight: 900;
    font-size: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fbcfe8;
}

.yellow-bloom .bloom-action {
    color: #d97706;
    border-color: #fde68a;
}

.flower-wrapper:hover .flower-bloom {
    transform: scale(1.15);
}

.flower-wrapper:hover .flower-bloom::before {
    transform: scale(1.2) rotate(15deg);
    filter: drop-shadow(0 25px 30px rgba(0,0,0,0.25));
}

.flower-wrapper:hover .flower-content {
    background: rgba(255,255,255,0.95);
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.flower-wrapper:hover .bloom-action {
    width: 160px;
    height: 45px;
    opacity: 1;
    font-size: 1.3rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
}

.flower-wrapper:hover .flying-creature {
    top: -60px;
    transform: scale(1.1);
}
