/* Global Reset & Variables */
* {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    box-sizing: border-box;
}

:root {
    --primary: #2193b0;
    --primary-light: #6dd5ed;
    --secondary: #2c3e50;
    --text-color: #333;
    --text-light: rgba(255, 255, 255, 0.92);
    --glass-bg: rgba(255, 255, 255, 0.95);
    /* Increased opacity for crispness */
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --code-bg: #1e1e1e;
    --python-color: #306998;
    --java-color: #f89820;
    --c-color: #5c6bc0;
    --success-green: #28a745;
    --warning-yellow: #ffc107;
}

body {
    min-height: 100vh;
    color: var(--text-color);
    background: var(--primary);
    /* Fallback */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Background effects */
.noise-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGQ9Ik0wIDBoMzAwdjMwMEgweiIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDUiLz48L3N2Zz4=');
    opacity: 0.4;
    z-index: -2;
    pointer-events: none;
}

.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    z-index: -3;
    pointer-events: none;
}

/* Custom cursor */
.cursor,
.cursor-follower {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.1s;
}

.cursor {
    background: rgba(255, 255, 255, 0.3);
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
}

.cursor-follower {
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) scale(2.5);
    transition: transform 0.3s, background 0.3s;
}

.cursor.active {
    transform: translate(-50%, -50%) scale(0.5);
}

.cursor-follower.active {
    transform: translate(-50%, -50%) scale(3.5);
    background: rgba(255, 255, 255, 0.15);
}

/* Navbar */
.navbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    /* Solid for clarity */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-links a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    margin: 0 5px;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(33, 147, 176, 0.08);
    color: var(--primary);
}

/* Nav Logo */
.nav-logo {
    height: 40px;
    width: 120px;
    /* Adjusted width */
    background-image: url("mylogo.jpg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 24px;
    cursor: pointer;
}

/* Search Container */
.search-container {
    max-width: 1000px;
    margin: 110px auto 30px;
    /* More top margin to clear nav */
    padding: 0 20px;
    text-align: center;
}

.search-bar {
    width: 100%;
    /* Full width of container */
    max-width: 600px;
    /* But capped */
    padding: 16px 24px;
    font-size: 16px;
    border: none;
    border-radius: 50px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    display: inline-block;
}

.search-bar:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.filter-pill {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    padding: 8px 20px;
    color: var(--secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.filter-pill:hover {
    transform: translateY(-2px);
    background: white;
}

.filter-pill.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(33, 147, 176, 0.2);
    border-color: var(--primary-light);
}

/* Program Container - Grid Layout */
.program-container {
    max-width: 1400px;
    margin: 0 auto 100px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 Cols fixed on Desktop */
    gap: 30px;
    align-items: start;
    /* Prevents stretching height */
}

/* Fallback for smaller screens */
@media (max-width: 1200px) {
    .program-container {
        grid-template-columns: 1fr;
        max-width: 900px;
    }
}

/* Program Card Styling */
.program-card {
    background: #ffffff;
    border-radius: 20px;
    /* Softer radius */
    padding: 30px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.04);
    /* Lighter shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
}

.program-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

/* Card Header Redesign */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.program-title {
    font-size: 1.35rem;
    /* Slightly smaller for balance */
    font-weight: 700;
    color: var(--secondary);
    margin: 5px 0 0 0;
    line-height: 1.3;
}

.language-label {
    background: transparent;
    padding: 0;
    margin-bottom: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    /* Brand color label */
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.program-description {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Toggle Button */
.toggle-view-btn {
    width: 100%;
    background: #f8f9fa;
    border: none;
    padding: 12px;
    border-radius: 12px;
    color: #555;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.toggle-view-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Collapsible Section */
.code-collapse {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease-out;
}

.code-collapse.expanded {
    opacity: 1;
    margin-top: 10px;
}

/* Code Block - Refined */
.code-block {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    margin: 5px 0 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Action Bar - Unified Row */
.action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.action-btn,
.run-btn,
.copy-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.run-btn {
    background: var(--success-green);
    color: white;
}

.run-btn:hover {
    background: #218838;
}

.copy-btn {
    background: #edf2f7;
    color: #4a5568;
}

.copy-btn:hover {
    background: #e2e8f0;
}

/* Auth Buttons */
.action-btn.btn-solved,
.action-btn.btn-bookmarked {
    padding: 8px 12px;
}

.action-btn.btn-solved {
    background: #d4edda;
    color: #155724;
}

.action-btn.btn-bookmarked {
    background: #fff3cd;
    color: #856404;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--secondary);
}

/* Run Output - Mobile Optimization */
.run-output {
    background: #2d2d2d;
    color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    border-left: 4px solid var(--success-green);
    display: none;
    width: 100%;
    /* Ensure full width */
    max-width: 100%;
    overflow-x: auto;
    /* Allow code scroll */
}

.output-title {
    font-weight: 700;
    color: var(--secondary);
    margin: 20px 0 10px;
    font-size: 1.1rem;
}

.output-block {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #333;
    white-space: pre-wrap;
}

/* Toast Notification Fix */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 2000;
    border-left: 4px solid var(--success-green);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Footer - Matched to Landing Page */
.footer {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--secondary);
    padding: 15px 0;
    /* Compact Padding */
    text-align: center;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
    position: relative;
    /* Ensure it flows */
    z-index: 10;
}

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

.footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    /* Reduced Margin */
    flex-wrap: wrap;
    /* FIX: Allow wrapping on mobile */
    gap: 15px;
    /* Add gap for wrapped items */
}

.footer-social {
    display: flex;
    justify-content: center;
    margin: 0;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    /* Compact Size */
    height: 36px;
    /* Compact Size */
    border-radius: 50%;
    color: var(--secondary);
    background: rgba(255, 255, 255, 0.2);
    margin: 0 8px;
    /* Tighter margin */
    text-decoration: none;
    font-size: 16px;
    /* Smaller icon */
    transition: all 0.3s;
}

.social-icon:hover {
    transform: translateY(-5px);
    background: white;
    color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.footer-bottom p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9rem;
    color: #adb5bd;
}

/* Visitor Counter Styling */
.visitor-counter {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 30px;
    margin-right: 20px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.visitor-counter:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.visitor-counter i {
    font-size: 1rem;
    color: var(--primary);
    margin-right: 8px;
}

.visitor-counter span {
    font-weight: 600;
    color: var(--secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 20px;
    }

    .nav-links {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .program-card {
        padding: 20px;
    }

    .card-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 10px;
    }

    .language-label {
        margin-left: 0;
        margin-bottom: 5px;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn,
    .run-btn,
    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}