:root {
    --primary: 179 49% 53%; /* #4DC2C1 */
    --primary-foreground: 0 0% 100%;
    --secondary: 21 95% 52%; /* #F97316 */
    --secondary-foreground: 0 0% 100%;
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --muted: 210 40% 98%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --border: 214.3 31.8% 91.4%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: hsl(var(--muted));
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

h1 {
    text-align: center;
    color: hsl(var(--foreground));
    margin-bottom: 20px;
    font-size: 2.5rem;
    font-weight: 700;
}

/* Attribution Section */
.attribution-section {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: hsl(var(--primary) / 0.1);
    border: 1px solid hsl(var(--primary) / 0.3);
    border-radius: 8px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.attribution-content {
    color: hsl(var(--primary));
    font-size: 0.9rem;
    font-weight: 500;
}

.attribution-content p {
    margin: 5px 0;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.875rem;
}

.category-btn:hover {
    background: hsl(var(--muted));
    border-color: hsl(var(--primary));
}

.category-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: hsl(var(--muted-foreground));
    font-size: 1.1rem;
    font-weight: 500;
}

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 30px;
    position: relative;
}

.flashcard {
    width: 100%;
    height: 600px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    padding: 30px;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    border: 1px solid hsl(var(--border));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
    max-height: 100%;
}

/* Custom scrollbar styling for webkit browsers */
.card-face::-webkit-scrollbar {
    width: 8px;
}

.card-face::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.card-face::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

.card-face::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}

.card-front {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
}

.card-back {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    transform: rotateY(180deg);
    justify-content: flex-start;
    border: 2px solid hsl(var(--primary));
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 16px;
    line-height: 1.5;
}

.card-content {
    font-size: 1rem;
    line-height: 1.7;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
    flex: 1;
    min-height: 0;
}

/* Custom scrollbar styling for card-content */
.card-content::-webkit-scrollbar {
    width: 8px;
}

.card-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.card-content::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

.card-content::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}

.card-content ul {
    list-style: none;
    padding-left: 0;
}

.card-content li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.card-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: hsl(var(--secondary));
    font-weight: bold;
    font-size: 1.2rem;
}

.card-back .card-content li::before {
    color: hsl(var(--primary));
}

.answer-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: hsl(var(--primary));
    margin-bottom: 20px;
    text-align: center;
    padding: 12px;
    background: hsl(var(--primary) / 0.1);
    border-radius: 6px;
    border-left: 4px solid hsl(var(--primary));
}

.navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.nav-btn {
    padding: 10px 20px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 100px;
}

.nav-btn:hover {
    background: hsl(var(--muted));
    border-color: hsl(var(--primary));
}

.nav-btn.accent {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--secondary));
}

.nav-btn.accent:hover {
    background: hsl(var(--secondary) / 0.9);
    border-color: hsl(var(--secondary) / 0.9);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Navigation buttons on the right side of the card */
.navigation-right-side {
    position: absolute;
    right: -180px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.nav-btn-orange {
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #ff6b35;
    background: #ff6b35;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.nav-btn-orange:hover {
    background: #e55a2b;
    border-color: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.nav-btn-orange:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #ccc;
    border-color: #ccc;
    box-shadow: none;
}

.nav-btn-orange.accent {
    background: #ff8c42;
    border-color: #ff8c42;
}

.nav-btn-orange.accent:hover {
    background: #e67e3a;
    border-color: #e67e3a;
}



.flip-hint {
    text-align: center;
    color: hsl(var(--muted-foreground));
    margin-top: 10px;
    font-style: italic;
    font-size: 0.875rem;
}

/* Cover card styling */
.cover-card {
    cursor: default;
}

.cover-card:hover {
    transform: none;
}

.cover-card .card-face {
    cursor: default;
}

/* Appendix Section */
.appendix-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid hsl(var(--border));
}

.appendix-section h2 {
    text-align: center;
    color: hsl(var(--foreground));
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 700;
}

.appendix-content {
    max-width: 800px;
    margin: 0 auto;
}

.abbreviations h3 {
    color: hsl(var(--foreground));
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.abbrev-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.abbrev-item {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
}

.abbrev-item:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 2px 8px hsl(var(--primary) / 0.1);
}

.abbrev-item strong {
    color: hsl(var(--primary));
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.abbrev-item .context {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    line-height: 1.5;
    display: block;
}

/* Code Examples Sidebar */
.code-examples {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
    z-index: 100;
    display: none;
}

.code-examples.show {
    display: block;
}

.code-examples h3 {
    padding: 15px;
    margin: 0;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 1rem;
    color: hsl(var(--foreground));
}

.code-example {
    padding: 15px;
    border-bottom: 1px solid hsl(var(--border));
}

.code-example:last-child {
    border-bottom: none;
}

.code-example h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: hsl(var(--primary));
}

.code-example pre {
    background: hsl(var(--muted));
    border-radius: 4px;
    padding: 10px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin: 0;
}

.code-example code {
    color: hsl(var(--foreground));
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Toggle buttons */
.toggle-code-btn, .toggle-tech-btn {
    position: fixed;
    right: 20px;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 101;
    transition: all 0.2s ease;
}

.toggle-code-btn {
    top: 20px;
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.toggle-code-btn:hover {
    background: hsl(var(--secondary) / 0.9);
}

/* Technology Context Section */
.tech-context-section {
    margin-top: 30px;
    padding: 20px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.1);
    display: none;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
}

.tech-context-section.show {
    display: block;
}

/* Custom scrollbar styling for tech-context-section */
.tech-context-section::-webkit-scrollbar {
    width: 8px;
}

.tech-context-section::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.tech-context-section::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

.tech-context-section::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}

/* Quick Context Section */
.quick-context-section {
    margin-top: 30px;
    padding: 20px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.1);
    display: none; /* Hidden by default */
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
}

.quick-context-section.show {
    display: block; /* Shown when relevant */
}

/* Custom scrollbar styling for quick-context-section */
.quick-context-section::-webkit-scrollbar {
    width: 8px;
}

.quick-context-section::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.quick-context-section::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

.quick-context-section::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}

/* Inline Technology Context */
.tech-context-inline {
    position: relative;
    z-index: 1;
}

.tech-context-inline h3 {
    font-size: 1.25rem;
    color: hsl(var(--primary));
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.tech-context-inline p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: hsl(var(--foreground));
    margin-bottom: 8px;
}

.tech-context-inline .tech-details {
    font-size: 0.85rem;
    padding: 8px;
    margin-top: 8px;
}

.tech-context-inline .tech-item {
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.tech-context-inline .tech-item:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 2px 4px hsl(var(--primary) / 0.1);
}

.tech-context-inline .tech-item:last-child {
    margin-bottom: 0;
}

/* Collapsible Technology Items */
.tech-item-collapsible {
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tech-item-collapsible:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 2px 4px hsl(var(--primary) / 0.1);
}

.tech-item-collapsible.expanded {
    border-color: hsl(var(--primary));
    background: hsl(var(--card));
}

.tech-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid hsl(var(--border));
}

.tech-item-header h4 {
    margin: 0;
    font-size: 1rem;
    color: hsl(var(--primary));
    font-weight: 600;
}

.tech-toggle {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    transition: transform 0.2s ease;
}

.tech-item-content {
    display: none;
    padding: 12px;
}

.tech-item-content p {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: hsl(var(--foreground));
}

.tech-code-example {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid hsl(var(--border));
}

.tech-code-example h5 {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    color: hsl(var(--secondary));
    font-weight: 600;
}

.tech-code-example pre {
    background: hsl(var(--muted));
    border-radius: 4px;
    padding: 10px;
    font-size: 0.7rem;
    overflow-x: auto;
    margin: 0;
    border: 1px solid hsl(var(--border));
}

.tech-code-example code {
    color: hsl(var(--foreground));
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.3;
}

/* Ensure card content doesn't overflow */
.card-face {
    overflow-y: auto;
    max-height: 100%;
}

.card-content {
    flex: 1;
    min-height: 0;
}

/* Brain Animation */
.animation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.brain-animation {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.brain-icon {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.thought-bubbles {
    position: absolute;
    top: -20px;
    right: -60px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bubble {
    font-size: 1.5rem;
    opacity: 0;
    animation: float 3s ease-in-out infinite;
}

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

.bubble-2 {
    animation-delay: 1s;
}

.bubble-3 {
    animation-delay: 2s;
}

.sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 1.2rem;
    opacity: 0;
    animation: sparkle 4s ease-in-out infinite;
}

.sparkle:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.sparkle:nth-child(2) {
    top: 60%;
    right: 20%;
    animation-delay: 1.5s;
}

.sparkle:nth-child(3) {
    bottom: 30%;
    left: 40%;
    animation-delay: 3s;
}

.animation-text {
    font-size: 1.1rem;
    color: hsl(var(--primary));
    font-weight: 500;
    text-align: center;
    animation: fadeInOut 3s ease-in-out infinite;
}

/* Animation Keyframes */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes float {
    0%, 100% {
        opacity: 0;
        transform: translateY(20px) translateX(0);
    }
    25% {
        opacity: 1;
        transform: translateY(0) translateX(-10px);
    }
    75% {
        opacity: 1;
        transform: translateY(-10px) translateX(-20px);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    25% {
        opacity: 1;
        transform: scale(1.2) rotate(90deg);
    }
    75% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

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

@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .flashcard {
        height: 500px;
    }
    
    .card-face {
        padding: 24px;
    }
    
    .controls {
        gap: 8px;
        justify-content: center;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .nav-btn {
        padding: 8px 16px;
        min-width: 80px;
        font-size: 0.8rem;
    }
    
    /* Hide code examples sidebar on mobile */
    .code-examples {
        display: none !important;
    }
    
    .toggle-code-btn {
        display: none;
    }
    
    /* Adjust appendix layout for mobile */
    .abbrev-list {
        grid-template-columns: 1fr;
    }
    
    .abbrev-item {
        padding: 12px;
    }
    
    /* Mobile adjustments for new features */
    .navigation-right-side {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: center;
        margin-top: 20px;
        gap: 10px;
    }
    
    .nav-btn-orange {
        min-width: auto;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    

}