:root {
    --primary-blue: #4361ee;
    --primary-purple: #7209b7;
    --app-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-radius: 16px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --header-height: 70px;
}

[data-bs-theme="dark"] {
    --app-bg: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    background-color: var(--app-bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
    transition: background-color 0.3s ease;
}

/* Desktop Enhancement */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        background: linear-gradient(135deg, var(--app-bg) 0%, #f0f2ff 100%);
    }

    [data-bs-theme="dark"] body {
        background: linear-gradient(135deg, var(--app-bg) 0%, #1a1a2e 100%);
    }

    .app-container {
        /* max-width: 1200px; */
        margin: 20px auto;
        background: var(--app-bg);
        border-radius: 24px;
        box-shadow: var(--shadow-md);
        min-height: calc(100vh - 40px);
        position: relative;
        overflow: hidden;
    }

    .app-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 300px;
        background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
        opacity: 0.05;
        z-index: 0;
    }

    [data-bs-theme="dark"] .app-container::before {
        opacity: 0.1;
    }

    main, header, footer {
        position: relative;
        z-index: 1;
    }

    .section-title {
        position: relative;
        padding-left: 20px;
    }

    .section-title::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 24px;
        background: linear-gradient(to bottom, var(--primary-blue), var(--primary-purple));
        border-radius: 2px;
    }

    .hero-card {
        background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(114, 9, 183, 0.1) 100%);
        border: 1px solid rgba(67, 97, 238, 0.2);
        backdrop-filter: blur(10px);
    }

    [data-bs-theme="dark"] .hero-card {
        background: linear-gradient(135deg, rgba(67, 97, 238, 0.2) 0%, rgba(114, 9, 183, 0.2) 100%);
        border: 1px solid rgba(67, 97, 238, 0.3);
    }
}

.app-container {
    /* max-width: 768px; */
    margin: 0 auto;
    background: var(--app-bg);
}

/* Enhanced Header for Desktop */
.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

[data-bs-theme="dark"] .app-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 30, 0.95);
}

.app-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1rem;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.btn-app {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    border: none;
    border-radius: 12px;
    padding: 14px 28px;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-app::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.3);
    color: white;
}

.btn-app:hover::after {
    left: 100%;
}

.icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
    transition: all 0.3s ease;
}

.app-card:hover .icon-wrapper {
    transform: scale(1.05);
}

[data-bs-theme="dark"] .icon-wrapper {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.2), rgba(114, 9, 183, 0.2));
}

/* Enhanced Navigation */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 0;
    z-index: 1000;
    max-width: 768px;
    margin: 0 auto;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .nav-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.nav-item {
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    padding: 8px 0;
}

.nav-item.active {
    color: var(--primary-blue);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-blue), var(--primary-purple));
    border-radius: 3px;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

/* Enhanced Countdown Cards */
.countdown-card {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.countdown-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1%, transparent 20%);
    animation: pulse 4s linear infinite;
}

@keyframes pulse {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.countdown-number {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Enhanced Search */
.search-bar {
    background: var(--card-bg);
    border-radius: 50px;
    padding: 16px 28px;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(135deg, var(--primary-blue), var(--primary-purple)) border-box;
}

.search-bar:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.15);
}

/* Enhanced Horizontal Scroll */
.horizontal-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 20px;
    padding: 16px 0;
    margin: 0 -16px;
    padding-left: 16px;
    scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.video-card {
    flex: 0 0 auto;
    width: 300px;
    scroll-snap-align: start;
}

/* Enhanced Progress Circle */
.progress-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-blue) 75%, transparent 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: rotate 2s linear infinite;
    animation-play-state: paused;
}

.progress-circle:hover {
    animation-play-state: running;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-inner {
    width: 110px;
    height: 110px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Enhanced Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid transparent;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(135deg, var(--primary-blue), var(--primary-purple)) border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    cursor: pointer;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
}

/* Enhanced Dashboard Icons */
.dashboard-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
    transition: all 0.3s ease;
}

.app-card:hover .dashboard-icon {
    transform: rotate(5deg) scale(1.1);
}

[data-bs-theme="dark"] .dashboard-icon {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.2), rgba(114, 9, 183, 0.2));
}

/* Enhanced Footer */
.app-footer {
    background: var(--card-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 40px 0 20px;
    margin-top: 40px;
}

[data-bs-theme="dark"] .app-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 16px;
}

.footer-link::before {
    content: '›';
    position: absolute;
    left: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: var(--primary-blue);
    padding-left: 24px;
    transform: translateX(5px);
}

.footer-link:hover::before {
    opacity: 1;
    left: 8px;
}

/* Hide bottom nav on desktop */
@media (min-width: 768px) {
    .nav-bottom {
        display: none;
    }

    .horizontal-scroll {
        margin: 0;
        padding-left: 0;
    }

    .theme-toggle {
        top: 30px;
        right: 30px;
    }
}

/* Loading animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-card {
    animation: fadeInUp 0.6s ease forwards;
}

/* Gradient text for desktop */
@media (min-width: 768px) {
    .gradient-text {
        background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
}

/* Dashboard Specific Styles */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    padding: 24px 20px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.stats-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    border-left: 4px solid var(--primary-blue);
}

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
}

.subject-progress {
    height: 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

[data-bs-theme="dark"] .subject-progress {
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
}

.topper-card {
    flex-shrink: 0;
    width: 40%;
    /* default: tablet + desktop */
}

/* Mobile devices */
@media (max-width: 767px) {
    .topper-card {
        width: 50%;
    }
}

/* Page Transitions */
.page-transition {
    animation: fadeInUp 0.4s ease;
}

/* Breadcrumb */
.breadcrumb-wrap {
    background-color: white;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "›";
    color: #6c757d;
    padding: 0 8px;
}

[data-bs-theme="dark"] .breadcrumb-wrap {
    background-color: #1e293b;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .breadcrumb a {
    color: #c7d2fe;
}

[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #e5e7eb;
}

/* Card Icons */
.content-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    height: 100%;
    position: relative;
    transition: transform 0.2s ease;
}

.content-card:hover {
    transform: translateY(-2px);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.folder .card-icon {
    color: #ffc107;
}

.pdf .card-icon {
    color: #dc3545;
}

.video .card-icon {
    color: #4361ee;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.card-meta {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 0;
}

.card-actions {
    position: absolute;
    top: 16px;
    right: 16px;
}

.btn-action {
    background: none;
    border: none;
    color: #6c757d;
    padding: 4px;
}

/* ===============================
   WHITE THEME CARD (APP STYLE)
================================ */
.stat-card-white {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: all .3s ease;
}

.stat-card-white:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

/* Icon */
.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4f46e5;
    font-size: 26px;
}

/* Text */
.stat-card-white h2 {
    color: #111827;
}

.stat-card-white p {
    font-size: 15px;
}

/* Dark mode support */
[data-bs-theme="dark"] .stat-card-white {
    background: #1f2937;
    border-color: #6366f1;
}

[data-bs-theme="dark"] .stat-card-white h2 {
    color: #f9fafb;
}

[data-bs-theme="dark"] .stat-card-white p {
    color: #d1d5db;
}

/* ===============================
   PROGRESS BAR
================================ */
.subject-progress {
    position: relative;
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 6px;
    margin-top: 18px;
    overflow: visible;
    /* CRITICAL */
}

/* Filled progress */
.progress-fill {
    height: 100%;
    border-radius: 6px;
}

/* ===============================
   LOCATION PIN BASE
================================ */
.progress-pin {
    position: absolute;
    top: -22px;
    width: 14px;
    height: 14px;
    border-radius: 50% 50% 50% 0;
    transform: translateX(-50%) rotate(-45deg);
    z-index: 9999;
    cursor: pointer;
}

/* Inner white dot */
.progress-pin::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    top: 4px;
    left: 4px;
}

/* ===============================
   PIN COLORS
================================ */
.pin-min {
    background: #dc3545;
    /* red */
}

.pin-avg {
    background: #ffc107;
    box-shadow: 0 0 0 2px #ffffff;
}

.pin-max {
    background: #198754;
    /* green */
}

/* ===============================
   TOOLTIP (HOVER / TAP)
================================ */
.progress-pin::before {
    content: attr(data-label);
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    background: #111827;
    color: #ffffff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Show tooltip */
.progress-pin:hover::before,
.progress-pin:active::before {
    opacity: 1;
}

/* ===============================
   DARK MODE
================================ */
[data-bs-theme="dark"] .subject-progress {
    background: #374151;
}

[data-bs-theme="dark"] .progress-pin::before {
    background: #f9fafb;
    color: #111827;
}

/* Trend animations */
.animate-up {
    animation: rise 0.4s ease-in-out;
}

.animate-down {
    animation: fall 0.4s ease-in-out;
}

.animate-flat {
    animation: pulse 0.6s ease-in-out;
}

@keyframes rise {
    from {
        transform: translateY(6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fall {
    from {
        transform: translateY(-6px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        opacity: .6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .6;
    }
}

.subject-hover {
    cursor: pointer;
}

.subject-hover:hover {
    text-decoration: underline;
    color: var(--bs-primary);
}

.subject-trigger {
    cursor: pointer;
}

.subject-trigger:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

.icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gradient-text {
    background: linear-gradient(135deg, #4361ee, #7209b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Security Toggle Box */
.security-header {
    cursor: pointer;
}

.security-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.3s ease;
    opacity: 0;
}

.security-box.open .security-content {
    max-height: 600px;
    /* enough for content */
    opacity: 1;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.security-box.open .toggle-icon {
    transform: rotate(180deg);
}

.message-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999999;

    display: none;
    /* ⬅️ important */
    align-items: center;
    justify-content: center;
}

.message-alert {
    max-width: 420px;
    width: calc(100% - 32px);
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    transition: 0.3s;
    z-index: 9999;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-content {
    padding: 25px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 0;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}

.menu-link:hover {
    color: var(--primary-blue);
}

/* Simple hover effect using inline style equivalent */
.transition-hover {
    transition: all 0.2s ease-in-out;
}

.transition-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important;
    border-color: #dee2e6 !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
}

.bg-opacity-10 {
    --bs-bg-opacity: 0.1;
}

.bg-opacity-15 {
    --bs-bg-opacity: 0.15;
}

.tracking-wide {
    letter-spacing: 0.5px;
}

.rounded-4 {
    border-radius: 1rem !important;
}

/*PDF Annotation*/
/* Custom styles */
.transition {
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile-optimized scrolling */
#pdf-wrapper {
    -webkit-overflow-scrolling: touch !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    scroll-behavior: smooth;
}

/* Touch-friendly canvas */
.draw-canvas {
    touch-action: pan-x pan-y !important;
    -webkit-tap-highlight-color: transparent;
}

/* Scrollbar */
#pdf-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#pdf-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#pdf-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#pdf-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Button styles */
.btn-primary.active {
    background-color: #0d6efd;
    color: white;
}

.btn-warning.active {
    background-color: #ffc107;
    color: black;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .btn-group .btn {
        padding: 0.375rem 0.5rem;
    }

    .btn-group .btn i {
        font-size: 1rem;
    }

    .form-range {
        width: 70px;
    }

    #pdf-wrapper {
        height: 55vh !important;
    }

    .pdf-page-wrapper {
        margin: 8px auto;
    }
}

/* PDF page wrapper */
.pdf-page-wrapper {
    position: relative;
    margin: 20px auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: white;
}

.pdf-page-wrapper canvas {
    display: block;
    border-radius: 4px;
}

.pdf-page-wrapper .draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 4px;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Notification animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Badge styles */
.badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.badge:hover {
    opacity: 0.9;
}

/* App button style */
.btn-app {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-app:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    color: white;
}

/* Custom Cursors for Drawing */

.cursor-pen {
    /* 0 24 means the 'ink' comes from the bottom-left (x=0, y=24) */
    cursor: url('../img/icons/pencil.png') 0 24, crosshair !important;
}

.cursor-eraser {
    /* 12 12 means the 'erase' happens from the center of the icon */
    cursor: url('../img/icons/eraser.png') 12 12, cell !important;
}

.cursor-highlight {
    cursor: url('../img/icons/highlighter.png') 0 24, copy !important;
}

/* Ensure the wrapper respects the cursor when drawMode is ON */
.draw-mode-active .draw-canvas {
    pointer-events: auto;
}

/* Page navigation styles */
.page-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: none;
}

.page-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.page-nav-left {
    left: 10px;
}

.page-nav-right {
    right: 10px;
}

@media (min-width: 768px) {
    .page-nav-left {
        left: 20px;
    }

    .page-nav-right {
        right: 20px;
    }
}

.page-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    font-weight: 500;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

/* PDF Zoom Container - Hardware Accelerated */
.zoom-container {
    transform-origin: 0 0;
    will-change: transform;
}

/* PDF Page Styles */
.pdf-page-wrapper {
    position: relative;
    margin: 15px auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background-color: white;
}

.draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Cursor styles */
.cursor-pen {
    cursor: crosshair !important;
}

.cursor-eraser {
    cursor: cell !important;
}

.cursor-highlight {
    cursor: text !important;
}

/* Smooth scroll for pdf wrapper */
#pdf-wrapper {
    scroll-behavior: smooth;
    overflow: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Animation for notifications */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading indicator */
#loadingIndicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
}

/* Hide scrollbar during pinch zoom */
body.zooming-active {
    overflow: hidden;
}

.zooming-active #pdf-wrapper {
    overflow: hidden;
}

/* =========================
   IOS SAFARI SAFE FIX
========================= */

/* ONLY target learning resource section */
#learningResource .col-6 {
    display: flex;
}

/* Anchor full width */
#learningResource .col-6>a {
    width: 100%;
}

/* Safari fix only for learning cards */
#learningResource .app-card {

    min-height: 100%;

    -webkit-transform: translateZ(0);
    transform: translateZ(0);

    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;

    -webkit-tap-highlight-color: transparent;
}

/* Safer hover */
#learningResource .app-card:hover {
    box-shadow: var(--shadow-md);
}

/* Icon fix only */
#learningResource .icon-wrapper {
    flex-shrink: 0;
}

/* Mobile adjustments */
@media(max-width:768px) {

    #learningResource .app-card {
        padding: 1rem !important;
    }

}


.game-thumb {
    width: 100%;
    height: 220px;

    object-fit: cover;
    object-position: center;

    border-radius: 16px;

    display: block;

    background: #f8f9fa;
}

/* Equal card height */
.game-card {
    display: flex;
    flex-direction: column;
}

.game-card .btn {
    margin-top: auto;
}

/* Mobile */
@media(max-width:768px) {

    .game-thumb {
        height: 180px;
    }

}

/* Floating Writing Button Styles */
.floating-write-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: floatPulse 2s infinite ease-in-out;
}

.floating-write-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 28px rgba(0,0,0,0.4);
}

.floating-write-btn:active {
    transform: scale(0.95);
}

.floating-write-btn i {
    font-size: 32px;
    color: white;
    transition: transform 0.2s;
}

.floating-write-btn.active {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    box-shadow: 0 0 20px rgba(0,180,219,0.6);
}

.floating-write-btn.active i {
    transform: rotate(15deg);
}

@keyframes floatPulse {
    0% { transform: translateY(0px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
    50% { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.4); }
    100% { transform: translateY(0px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
}

/* Tooltip for floating button */
.floating-write-btn::before {
    content: "Tap to write";
    position: absolute;
    bottom: 80px;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
}

.floating-write-btn:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: 85px;
}

/* Draw mode active cursor styles */
.cursor-pen { cursor: crosshair !important; }
.cursor-eraser { cursor: cell !important; }
.cursor-highlight { cursor: text !important; }

/* Ensure toolbar buttons are always clickable */
.toolbar-btn, .btn-group button, .btn-group .btn {
    pointer-events: auto !important;
    z-index: 100 !important;
}

/* Camera drag styles */
#cameraBox {
    transition: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .floating-write-btn {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
    }
    .floating-write-btn i {
        font-size: 26px;
    }
}