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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .card {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .site-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode .site-footer {
    background-color: #1a1a1a;
}

body.dark-mode table {
    background-color: #2d2d2d;
}

body.dark-mode th {
    background-color: #3d3d3d;
    color: #e0e0e0;
}

body.dark-mode tr:hover {
    background-color: #3d3d3d;
}

body.dark-mode pre {
    background-color: #1e1e1e;
}

body.dark-mode code {
    background-color: #3d3d3d;
    color: #ff6b6b;
}

body.dark-mode .search-box {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode .search-box:focus {
    border-color: #3498db;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    color: #2c3e50;
}

h2 {
    font-size: 2rem;
    color: #34495e;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: #f8f9fa;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.dark-mode-toggle,
.menu-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover,
.menu-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.menu-toggle {
    display: none;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
}

.site-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.site-nav a:hover {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* Search container */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

.search-box:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Main content */
.site-main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Cards and sections */
.card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Homepage specific styles */

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.category-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.cs-card {
    border-color: #e74c3c;
}

.duolingo-card {
    border-color: #f39c12;
}

.category-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.category-card h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    border: none;
}

.category-card p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.category-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.topic-tag {
    background: #e9ecef;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.cs-card .topic-tag {
    background: #fdf2f2;
    color: #c53030;
}

.duolingo-card .topic-tag {
    background: #fffbeb;
    color: #d97706;
}

.category-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.cs-card .category-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.duolingo-card .category-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.category-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    text-decoration: none;
    color: white;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Code blocks */
pre {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
}

code {
    background-color: #f1f3f4;
    color: #d73a49;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Copy and Run buttons */
.copy-btn,
.run-algorithm-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4a5568;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.run-algorithm-btn {
    right: auto;
    left: 10px;
    background: #28a745;
}

.copy-btn:hover,
.run-algorithm-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Links */
a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid #3498db;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

/* Footer */
.site-footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    text-align: left;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 1rem;
    border: none;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #bdc3c7;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #3498db;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.progress-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-item span {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 1rem;
    font-size: 0.9rem;
    color: #bdc3c7;
}

/* Progress bars */
.progress-bar {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
    cursor: pointer;
}

/* Scroll progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    z-index: 1001;
    transition: width 0.1s ease;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Search highlighting */
mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #6c757d;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(44, 62, 80, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem;
    }
    
    .site-nav.active {
        display: block;
    }
    
    .site-nav ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    pre {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .header-controls {
        gap: 0.5rem;
    }
    
    .dark-mode-toggle,
    .menu-toggle {
        width: 35px;
        height: 35px;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .topic-tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Special styling for categories */
.category-computer-science h2 {
    border-bottom-color: #e74c3c;
}

.category-duolingo h2 {
    border-bottom-color: #f39c12;
}

/* Language flags and icons */
.language-flag {
    display: inline-block;
    width: 24px;
    height: 16px;
    margin-right: 0.5rem;
    border-radius: 2px;
    vertical-align: middle;
}

/* Achievement badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #17a2b8;
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.25rem;
}

.badge-success {
    background-color: #28a745;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
}

/* Navigation breadcrumbs */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #6c757d;
}

.breadcrumb a:hover {
    color: #495057;
}

/* Tags */
.tag {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 0.25rem;
    text-decoration: none;
}

.tag:hover {
    background-color: #dee2e6;
    color: #212529;
    text-decoration: none;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Interactive elements */
.interactive-element {
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-element:hover {
    transform: scale(1.05);
}

/* Code execution results */
.code-result {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.code-result.success {
    border-color: #28a745;
    background-color: #d4edda;
    color: #155724;
}

.code-result.error {
    border-color: #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}
