:root {
    --primary-color: #4facfe;
    --primary-gradient: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    --secondary-color: #ff9a9e;
    --bg-color: #fdfbf7;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --gifted-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --font-heading: 'Comic Neue', cursive, sans-serif;

    /* Vibrant / Kid Friendly Palette */
    --pastel-blue: #A2D2FF;
    --pastel-pink: #FFC8DD;
    --pastel-purple: #CDB4DB;
    --pastel-yellow: #FFF1A5;
    --pastel-green: #B5EAD7;
    --vibrant-orange: #FFB347;
}

/* Animations */
@keyframes bounce-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.card-kid {
    border-radius: 20px;
    border: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-kid:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* Stepper Component */
.stepper-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2rem;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #e9ecef;
    z-index: 0;
    border-radius: 10px;
}

.stepper-progress {
    position: absolute;
    top: 15px;
    left: 0;
    height: 4px;
    background: var(--success-color, #28a745);
    z-index: 0;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.step-item {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 80px;
}

.step-circle {
    width: 34px;
    height: 34px;
    background: #fff;
    border: 4px solid #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
    color: #6c757d;
    transition: all 0.3s ease;
}

.step-item.completed .step-circle {
    border-color: var(--success-color, #28a745);
    background: var(--success-color, #28a745);
    color: #fff;
}

.step-item.active .step-circle {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.2);
}

.step-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
}

.step-item.completed .step-label,
.step-item.active .step-label {
    color: var(--text-color);
}

body {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
}

h1,
h2,
h3,
h4,
h5,
.navbar-brand {
    font-family: var(--font-heading);
    font-weight: bold;
}

/* Navbar */
.navbar {
    background-image: var(--primary-gradient);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    color: white !important;
}

/* Buttons */
.btn-primary {
    background-image: var(--primary-gradient);
    border: none;
}

.section-title {
    margin-bottom: 20px;
    border-bottom: 2px dashed #ddd;
    padding-bottom: 10px;
    display: inline-block;
}

.gifted-section {
    background-image: var(--gifted-bg);
    color: white;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.gifted-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
}

.gifted-card .card-title,
.gifted-card .card-text {
    color: white;
}

/* Utilities */
.grayscale {
    filter: grayscale(100%);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.grayscale:hover {
    filter: grayscale(0%);
    opacity: 1;
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}

/* Component Specific */
.course-card-img {
    height: 200px;
    object-fit: cover;
}

/* Sidebar Styles */
#sidebar-wrapper {
    width: 4.5rem;
    /* Collapsed width */
    height: calc(100vh - 60px);
    /* Full height minus top bar */
    /* top, left, position are handled inline/base.html or here */
    border-right: 1px solid #dee2e6;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    background-color: white;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Hide text when collapsed */
}

/* Sidebar Hover State */
#sidebar-wrapper:hover {
    width: 15rem;
    /* Expanded width */
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

#sidebar-wrapper .list-group-item {
    padding: 0.75rem 1.25rem;
    white-space: nowrap;
    overflow: hidden;
    border: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

#sidebar-wrapper .list-group-item:hover {
    background-color: rgba(79, 172, 254, 0.1);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

#sidebar-wrapper .list-group-item i {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
    margin-right: 0.5rem;
}

.link-text {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out 0.1s;
    display: inline-block;
}

#sidebar-wrapper:hover .link-text {
    opacity: 1;
}

/* Page Content */
#page-content-wrapper {
    width: 100%;
    margin-left: 4.5rem;
    /* Fixed margin, does not change on hover */
    transition: margin-left 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Layout Wrapper */
#wrapper {
    overflow-x: hidden;
}

/* --- Responsive Sidebar & Layout Logic --- */
@media (max-width: 991px) {

    /* 1. Hide Sidebar by Default (Slide out to left using transform) */
    #sidebar-wrapper {
        margin-left: 0;
        /* Reset margin */
        transform: translateX(-100%);
        /* Move off-screen */
        width: 16rem;
        /* Full menu width */
        z-index: 1060;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease-in-out;

        /* Fix Layout & Scrolling */
        position: fixed;
        left: 0;
        top: 50px;
        /* Start below the 50px Top Bar */
        height: calc(100vh - 50px);
        /* Full height minus Top Bar */
        padding-top: 0;
        /* Remove extra padding */
        overflow-y: auto;
        /* Enable vertical scrolling for the menu */
        overscroll-behavior: contain;
        /* Prevent body scroll chaining */
    }

    /* 2. Show Sidebar when Toggled */
    #wrapper.toggled #sidebar-wrapper {
        transform: translateX(0);
    }

    /* Ensure list items are visible */
    #sidebar-wrapper .list-group-item {
        justify-content: flex-start;
    }

    #sidebar-wrapper .link-text {
        opacity: 1;
        /* Always show text in mobile menu */
    }

    /* 3. Reset Main Content Margin */
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    /* 4. Overlay for Sidebar */
    #page-content-wrapper::before {
        content: '';
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1055;
        /* Below sidebar, above content */
        opacity: 0;
        transition: opacity 0.3s;
    }

    #wrapper.toggled #page-content-wrapper::before {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 576px) {

    /* Adjust Branding Width on tiny screens */
    .mobile-brand-adjust {
        width: auto !important;
        min-width: auto !important;
        padding-left: 0 !important;
    }

    .mobile-brand-adjust span {
        display: none;
        /* Hide text, keep icon */
    }
}

/* Fixed Top Navbar */
.layout-navbar {
    z-index: 1050;
    /* Ensure Navbar stays on top of Sidebar (1040) */
    height: 60px;
}

.dropdown-toggle.no-arrow::after {
    display: none;
}

/* Search Bar */
.input-group-text {
    background: white;
    border-right: none;
}

.form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}

/* User Dropdown */
.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0;
}

/* Dropdown Menu Container */
.user-dropdown-menu {
    width: 400px;
    padding: 0;
    overflow: hidden;
    border: none;
    border-radius: 1rem;
    z-index: 1100;
    /* Highest z-index */
    position: absolute;
    right: 0 !important;
    /* Force right alignment */
    left: auto !important;
    top: 100%;
    margin-top: 5px;
}

.dropdown {
    position: relative;
    padding-bottom: 5px;
}

.dropdown-split-container {
    display: flex;
}

.dropdown-left-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 40%;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dropdown-right-menu {
    width: 60%;
    padding: 1rem;
    background: white;
}

.dropdown-left-info img {
    border: 3px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 1rem;
}

.dropdown-left-info h6 {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.dropdown-left-info small {
    opacity: 0.8;
}

/* --- New Home Page Styles --- */

/* Hero Section */
.hero-section {
    background: var(--primary-gradient);
    color: white;
    padding: 100px 0;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Feature Cards */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 1rem;
    overflow: hidden;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15) !important;
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.icon-box-primary {
    background-color: rgba(79, 172, 254, 0.1);
    color: var(--primary-color);
}

.icon-box-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.icon-box-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.icon-box-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Role Sections */
.role-section {
    padding: 80px 0;
}

.role-img {
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15);
}

/* Testimonials */
.testimonial-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
    position: relative;
}

.testimonial-quote {
    font-size: 1.1rem;
    font-style: italic;
    color: #555;
}

.testimonial-author {
    font-weight: bold;
    margin-top: 1rem;
    color: var(--primary-color);
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

/* Floating Shapes Animation (Optional) */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

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

/* Dropdown Hover */
.dropdown-hover:hover .dropdown-menu {
    display: block;
    margin-top: 0;
}

/* --- Turbo Matching Interface --- */
.matching-dnd-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.match-targets {
    flex: 1;
    min-width: 300px;
}

.match-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 12px;
}

.match-label {
    flex: 1;
    font-weight: 600;
    padding-right: 15px;
}

.match-drop-zone {
    width: 200px;
    /* Fixed width for consistency */
    min-height: 50px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.match-drop-zone.drag-over {
    background: #ebf8ff;
    border-color: #4299e1;
    transform: scale(1.02);
}

.match-drop-zone.has-item {
    border-style: solid;
    border-color: #4facfe;
    background: #e3f2fd;
    padding: 4px;
}

.match-drop-zone.has-item .placeholder-text {
    display: none;
}

.match-pool {
    flex: 1;
    min-width: 300px;
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    align-content: flex-start;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.match-pool.drag-over {
    background: #e2e8f0;
}

.draggable-item {
    padding: 10px 15px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: grab;
    user-select: none;
    font-size: 0.95rem;
    transition: transform 0.1s, box-shadow 0.1s;
    width: auto;
    /* Allow auto width in pool */
    max-width: 100%;
}

.match-drop-zone .draggable-item {
    width: 100%;
    /* Full width in drop zone */
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 5px;
    margin: 0;
}

.draggable-item:active {
    cursor: grabbing;
}

.draggable-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.placeholder-text {
    pointer-events: none;
}