/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Performance optimizations */
.floating-element,
.lesson-card,
.modal-content {
    will-change: transform;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-element {
        animation: none !important;
    }
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(1deg);
    }
    66% {
        transform: translateY(-10px) rotate(-0.5deg);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation classes */
.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

/* Floating elements */
.floating-element {
    position: absolute;
    animation: float 15s ease-in-out infinite;
    pointer-events: none;
}

.floating-element:nth-child(1) {
    top: 15%;
    left: 10%;
}

.floating-element:nth-child(2) {
    top: 60%;
    right: 15%;
}

.floating-element:nth-child(3) {
    bottom: 25%;
    left: 65%;
}

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

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #2563eb, #7c3aed);
}

/* Enhanced focus styles for accessibility */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Lesson card enhancements */
.lesson-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lesson-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.lesson-card:hover::before {
    left: 100%;
}

/* Modal improvements */
.modal-content {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
}

.modal-content.scale-100 {
    transform: scale(1);
    opacity: 1;
}

.modal-content.scale-95 {
    transform: scale(0.95);
    opacity: 0;
}

/* Responsive typography */
@media (max-width: 640px) {
    .floating-element {
        animation-duration: 12s;
    }
    
    .floating-element:nth-child(1) {
        width: 8rem !important;
        height: 8rem !important;
    }
    
    .floating-element:nth-child(2) {
        width: 10rem !important;
        height: 10rem !important;
    }
    
    .floating-element:nth-child(3) {
        width: 6rem !important;
        height: 6rem !important;
    }
}

/* Lesson content styles */
.cash-flows-content {
    line-height: 1.7;
    color: #cbd5e1;
}

.lesson-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-block {
    margin-bottom: 2rem;
}

.highlight-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.highlight-box h4 {
    color: #60a5fa;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.highlight-box ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.highlight-box li {
    margin-bottom: 0.5rem;
    color: #cbd5e1;
}

.highlight-box li::marker {
    color: #60a5fa;
}

.example-box {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box h4 {
    color: #a78bfa;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.important-note {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.comparison-item {
    background: rgba(71, 85, 105, 0.3);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid rgba(71, 85, 105, 0.5);
}

.comparison-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #ffffff;
}

.formula-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.formula-box h4 {
    color: #34d399;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.activities-grid {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.activity-card {
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
}

.activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.cash-flows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.cash-inflows, .cash-outflows {
    background: rgba(71, 85, 105, 0.2);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.cash-inflows h4 {
    color: #4ade80;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cash-outflows h4 {
    color: #f87171;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cash-inflows ul, .cash-outflows ul {
    margin-left: 1.25rem;
}

.cash-inflows li, .cash-outflows li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.example-calculation {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-calculation h4 {
    color: #818cf8;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.example-calculation ul {
    margin-left: 1.5rem;
}

.example-calculation li {
    margin-bottom: 0.5rem;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .lesson-section {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .highlight-box,
    .example-box,
    .important-note,
    .formula-box,
    .example-calculation {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .comparison-item,
    .activity-card {
        padding: 1rem;
    }
    
    .cash-flows {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .cash-inflows, .cash-outflows {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .highlight-box,
    .example-box,
    .important-note,
    .formula-box,
    .example-calculation {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .highlight-box h4,
    .example-box h4,
    .formula-box h4,
    .example-calculation h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

/* Print styles */
@media print {
    .floating-element,
    .animate-fade-in-up,
    .animate-slide-in-left,
    .animate-slide-in-right,
    .animate-scale-in {
        animation: none !important;
        transform: none !important;
    }
    
    body {
        color: black !important;
        background: white !important;
    }
    
    .lesson-card::before {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .highlight-box,
    .example-box,
    .important-note,
    .formula-box,
    .example-calculation,
    .activity-card {
        border-width: 2px;
    }
    
    .section-title {
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
    }
} 