/* 
    CodInsta Global Styles
    Modern UI / UX Design System
*/

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    padding-top: var(--header-height);
    animation: fadeInPage 0.5s ease-out;
    /* Page entry animation */
}

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page exit animation class */
.page-exit {
    opacity: 0 !important;
    transform: translateY(-10px) !important;
    transition: all 0.4s ease-in-out !important;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

ul {
    list-style: none;
}

/* --- Header Section --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.logo span {
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 30px;
    height: 100%;
    align-items: center;
}

.nav-links a {
    position: relative;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 8px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.auth-btns {
    display: flex;
    gap: 15px;
}

.btn-login {
    background: transparent;
    color: var(--text-main);
    padding: 8px 16px;
}

.btn-register {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
}

.btn-register:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* --- Utilities --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-easy {
    background: #dcfce7;
    color: #166534;
}

.badge-medium {
    background: #fef9c3;
    color: #854d0e;
}

.badge-hard {
    background: #fee2e2;
    color: #991b1b;
}

.badge-private {
    background: #fee2e2;
    color: #991b1b;
}

.badge-public {
    background: #dcfce7;
    color: #166534;
}

/* Animated Buttons */
.btn-animate {
    position: relative;
    overflow: hidden;
}

.btn-animate::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-animate:active::after {
    width: 300px;
    height: 300px;
}

.btn-animate:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.settings-btn:hover {
    transform: rotate(45deg);
    color: var(--primary);
    background: #f1f5f9;
}

.invite-link-box {
    background: #f8fafc;
    border: 1px dashed var(--primary);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-size: 0.85rem;
    color: var(--primary);
}

.copy-btn {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.status-list {
    margin-top: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
}

.status-item:not(:last-child) {
    border-bottom: 1px solid #edf2f7;
}

.request-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.btn-accept {
    background: var(--success);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-decline {
    background: var(--danger);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-invite-unique {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white !important;
    font-weight: 700;
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-invite-unique:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.pseudo-editor {
    width: 100%;
    height: 200px;
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    border: none;
    resize: none;
    outline: none;
}

.btn-solve-task {
    background: #f1f5f9;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-solve-task:hover {
    background: var(--primary);
    color: white;
}

.solved-badge {
    background: #dcfce7;
    color: #166534;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.btn-add-question {
    background: #0f172a;
    color: white !important;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn-add-question:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.challenges-grid>div {
    animation: fadeIn 0.5s ease backwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Actions */
.card-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.challenge-card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.btn-edit-action {
    color: var(--primary);
}

.btn-delete-action {
    color: var(--danger);
}

.action-btn:hover {
    transform: scale(1.1);
}

.solve-timer-display {
    background: #fef2f2;
    color: var(--danger);
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 800;
    font-family: 'Fira Code', monospace;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    border: 1px solid #fee2e2;
}

.dropdown {
    position: relative;
    display: inline-block;
    z-index: 50;
    /* Ensure trigger is above card content */
}

.dropbtn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.dropbtn:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 180px;
    box-shadow: var(--shadow-md);
    border-radius: 10px;
    z-index: 100;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f8fafc;
    color: var(--primary);
}

.dropdown-content a i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a.danger {
    color: var(--danger);
}

.dropdown-content a.danger:hover {
    background-color: #fef2f2;
}

/* Date Separator for Day-wise grouping */
.date-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 35px 0 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    border-bottom: 2px solid var(--border);
}

.date-separator:not(:empty)::before {
    margin-right: 20px;
}

.date-separator:not(:empty)::after {
    margin-left: 20px;
}

.date-separator span {
    background: var(--border);
    padding: 6px 16px;
    border-radius: 50px;
    color: var(--text-main);
}

.post-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.post-time i {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Responsive adjustments */

/* Responsive layout & Fixed Bottom Navigation */
@media (max-width: 768px) {
    /* Hide header nav links on mobile to shrink them into the 3-dot settings button */
    .nav-links {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }

    header {
        padding: 0 20px;
    }
    
    /* General Responsive adjustments */
    .container {
        padding: 20px 15px;
    }

    /* Typography adjustments for smaller screens */
    .hero {
        padding: 50px 20px;
    }
    .hero h1 {
        font-size: 2.2rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .section-title {
        font-size: 1.5rem;
    }

    /* Grids scaling */
    .learning-grid, .challenges-grid {
        grid-template-columns: 1fr;
    }
    
    /* Forms, filters and dialogs */
    .filter-bar {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .modal {
        padding: 25px;
        width: 95%;
    }
    .modal-grid, .lang-options {
        grid-template-columns: 1fr;
    }

    /* Topics detailed view adjustments */
    .topic-view-container {
        padding: 30px 20px;
    }
    .full-page-overlay h1 {
        font-size: 2rem;
        margin-top: 40px;
    }
    .topic-stats-row {
        flex-direction: column;
        gap: 15px;
    }
    .btn-close-topic {
        top: 15px;
        right: 15px;
    }
    .solution-modal {
        padding: 20px !important;
    }
    .solution-code {
        padding: 25px 15px 15px;
        font-size: 0.85rem;
    }

    /* Footer collapsing */
    .footer {
        padding: 50px 0 30px;
        margin-top: 80px;
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    /* Auth Buttons adjustment */
    .auth-btns {
        gap: 8px;
    }
    .btn-login {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .btn-register {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* Extra small devices adjustments */
@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }
    .auth-btns .btn-login {
        display: none; /* Only hide login text button, keep register or profile pic */
    }
    .auth-btns .btn-register {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    /* If user is logged in, hide full greeting on extra small screens */
    .auth-btns span {
        display: none !important;
    }
}

/* --- Pseudo Code Solve UI --- */
.btn-pseudo {
    background: #f1f5f9;
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.btn-pseudo:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    padding: 35px;
    border-radius: 20px;
    max-width: 550px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-timer {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--danger);
    font-family: 'Fira Code', monospace;
    margin-bottom: 25px;
    background: #fef2f2;
    padding: 15px 30px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    border: 1px solid #fee2e2;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pseudo-textarea {
    width: 100%;
    height: 250px;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--border);
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    margin-bottom: 25px;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.pseudo-textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.modal-footer {
    display: flex;
    gap: 15px;
}

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: #f1f5f9;
    color: var(--text-main);
    border-radius: 10px;
    font-weight: 600;
}

.btn-submit-pseudo {
    flex: 2;
    padding: 14px;
    background: var(--success);
    color: white;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit-pseudo:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* --- Hero Section --- */
.hero {
    padding: 80px 40px;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    border-radius: 24px;
    margin-bottom: 60px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(to right, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    color: #94a3b8;
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Learning Path Grid --- */
.learning-section {
    margin: 80px 0;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #1e293b;
}

.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* --- DSA Card (LeetCode Style) --- */
.learning-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    cursor: pointer;
    border: 1px solid #f1f5f9;
}

.learning-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-header-gradient {
    min-height: 180px;
    height: auto;
    padding: 30px;
    position: relative;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.card-header-gradient .subtitle {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.card-header-gradient h3 {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.25;
    max-width: 85%;
    margin-bottom: 20px;
}

.card-content-stats {
    background: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .val {
    font-size: 1.8rem;
    font-weight: 800;
    display: block;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-item .label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}

.stat-item .percent {
    font-size: 1.1rem;
    color: #94a3b8;
    font-weight: 500;
    line-height: 1.8;
}

.play-circle {
    position: absolute;
    right: 30px;
    bottom: 85px;
    width: 75px;
    height: 75px;
    background: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    z-index: 2;
    transform: rotate(-8deg);
    transition: all 0.3s;
}

.learning-card:hover .play-circle {
    transform: rotate(0deg) scale(1.1);
    background: var(--primary);
}

.learning-card:hover .play-circle i {
    color: white;
}

.play-circle i {
    font-size: 1.8rem;
    color: #1e293b;
    margin-left: 5px;
}

/* --- Community Challenges Grid --- */
.challenges-section {
    padding-bottom: 80px;
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.challenge-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.challenge-card h3 {
    font-size: 1.4rem;
    margin: 15px 0 10px;
    color: #1e293b;
}

.challenge-card p {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.challenge-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.author-info img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.solved-count {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.languages {
    display: flex;
    gap: 8px;
}

.lang-icon {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: #eff6ff;
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-solve {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-solve:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* --- Footer --- */
.footer {
    background: #0f172a;
    color: white;
    padding: 100px 0 40px;
    margin-top: 150px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 80px;
    margin-bottom: 80px;
}

.footer-brand .logo {
    font-size: 2rem;
    margin-bottom: 30px;
}

.footer-brand p {
    color: #94a3b8;
    line-height: 1.8;
    font-size: 1.1rem;
    max-width: 450px;
}

.footer-section h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 15px;
}

.footer-section ul li a {
    color: #94a3b8;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section ul li a:hover {
    color: #60a5fa;
    transform: translateX(5px);
}

.footer-bottom {
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: 1rem;
}

.developer-country {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag {
    width: 25px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.social-links {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.social-item {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.4rem;
}

.social-item:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-8px) rotate(10deg);
}

/* Full-Page Topic View */
.full-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 3000;
    display: none;
    overflow-y: auto;
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.topic-view-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 100px 40px;
    position: relative;
}

.btn-close-topic {
    position: fixed;
    top: 30px;
    right: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-main);
    z-index: 3010;
    transition: all 0.3s;
}

.btn-close-topic:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
}

.full-page-overlay h1 {
    font-size: 3rem;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topic-stats-row {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.topic-stat-box {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.topic-stat-box i {
    color: var(--primary);
    font-size: 1.2rem;
}

/* Modal Enhancements */
.solution-modal {
    max-width: 900px !important;
    text-align: left !important;
    padding: 50px !important;
}

.solution-code {
    background: #1e293b;
    color: #f8fafc;
    padding: 35px 30px 30px;
    border-radius: 20px;
    margin: 30px 0 50px;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    overflow-x: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.solution-code::before {
    content: 'Recommended Solution';
    position: absolute;
    top: 15px;
    left: 30px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 1px;
}

.topic-info {
    margin-bottom: 30px;
    line-height: 1.8;
    color: #475569;
    font-size: 1.1rem;
}

.topic-info-content {
    font-size: 1.25rem;
    line-height: 1.8;
    color: #334155;
    margin-bottom: 60px;
}

.btn-close-dsa {
    margin-top: 30px;
    width: 100%;
    padding: 15px;
    background: #f1f5f9;
    color: #1e293b;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
}

/* --- Premium Filter Bar --- */
.filter-bar {
    background: white;
    padding: 25px;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 50px;
    align-items: center;
    transition: all 0.3s ease;
}

.filter-bar:hover {
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.1);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 20px;
    color: #94a3b8;
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 55px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.filter-group select {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 18px;
    transition: all 0.3s ease;
}

.filter-group select:focus {
    border-color: var(--primary);
    background-color: white;
    outline: none;
}

@media (max-width: 900px) {
    .filter-bar {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* --- Mobile Responsiveness and Navigation Enhancements --- */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    body {
        padding-top: var(--header-height);
    }

    header {
        padding: 0 15px;
        justify-content: space-between;
        position: fixed;
    }

    /* Hide the default horizontal navlinks */
    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        flex-direction: column;
        align-items: stretch;
        padding: 15px 0;
        border-bottom: 2px solid var(--border);
        box-shadow: 0 15px 25px rgba(0, 0, 0, 0.08);
        gap: 0;
        z-index: 999;
        height: auto;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }

    /* When menu is toggled open */
    .nav-links.mobile-active {
        display: flex !important;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Style the vertical nav links in the mobile menu */
    .nav-links a {
        padding: 14px 24px;
        width: 100%;
        text-align: left;
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-main);
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .nav-links a::after {
        display: none; /* Disable desktop underline bar */
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(37, 99, 235, 0.05);
        color: var(--primary);
        padding-left: 28px;
    }

    /* Hamburger/Settings Button Styling */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: #f1f5f9;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        color: var(--text-main);
        font-size: 1.15rem;
        cursor: pointer;
        transition: all 0.2s ease;
        order: 3; /* Render after brand name and auth buttons */
    }

    .mobile-menu-btn:hover {
        background: #e2e8f0;
        transform: scale(1.05);
    }

    .mobile-menu-btn:active {
        transform: scale(0.95);
    }

    /* Auth buttons spacing adjustments on mobile */
    .auth-btns {
        margin-left: auto;
        margin-right: 10px;
        gap: 8px;
    }

    .auth-btns a, 
    .auth-btns button {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
    }

    .btn-login {
        padding: 6px 8px !important;
    }

    /* Layout grid overrides for all main views */
    .container {
        padding: 20px 15px;
    }

    .profile-grid,
    .learning-grid,
    .challenges-grid,
    .dashboard-grid,
    .groups-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    /* Forms and Filters styling for mobile */
    .filter-bar {
        grid-template-columns: 1fr !important;
        padding: 15px;
        gap: 12px;
        border-radius: 16px;
    }

    .search-box input,
    .filter-group select {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .search-box i {
        left: 15px;
    }

    .search-box input {
        padding-left: 45px;
    }

    /* Modals & Overlays */
    .modal, 
    .ep-modal,
    .settings-modal,
    .crop-modal {
        width: 92% !important;
        max-width: 100% !important;
        padding: 20px !important;
        border-radius: 16px !important;
    }

    /* Heading font sizing for mobile screens */
    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.4rem !important;
    }

    /* Learning path cards adjustment */
    .learning-card {
        border-radius: 16px;
    }
    .card-header-gradient {
        padding: 20px !important;
        min-height: 150px !important;
    }
    .card-header-gradient h3 {
        font-size: 1.3rem !important;
        max-width: 100% !important;
    }
    .card-content-stats {
        padding: 15px !important;
    }
    .play-circle {
        width: 50px !important;
        height: 50px !important;
        right: 20px !important;
        bottom: 60px !important;
        border-radius: 14px !important;
    }
    .play-circle i {
        font-size: 1.2rem !important;
        margin-left: 3px !important;
    }

    /* Section headers alignment on mobile */
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
    
    .section-header button, 
    .section-header .btn-add-question {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        display: inline-flex !important;
    }

    /* Dark Mode variables and styling overrides for mobile menu */
    body.dark-mode .nav-links,
    body[style*="background: #0f172a"] .nav-links,
    body[style*="background: rgb(15, 23, 42)"] .nav-links,
    .dark-mode-active .nav-links {
        background: rgba(15, 23, 42, 0.98);
        border-bottom-color: #334155;
        box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3);
    }

    body.dark-mode .nav-links a,
    body[style*="background: #0f172a"] .nav-links a,
    body[style*="background: rgb(15, 23, 42)"] .nav-links a,
    .dark-mode-active .nav-links a {
        color: #f1f5f9;
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }

    body.dark-mode .mobile-menu-btn,
    body[style*="background: #0f172a"] .mobile-menu-btn,
    body[style*="background: rgb(15, 23, 42)"] .mobile-menu-btn,
    .dark-mode-active .mobile-menu-btn {
        background: #1e293b;
        color: #f1f5f9;
    }

    /* Fix table responsiveness on mobile pages like leaderboard */
    .leaderboard-table, 
    .table-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- Mobile Menu Popup Modal --- */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-menu-overlay.open {
    display: flex;
    opacity: 1;
}

.mobile-menu-popup {
    background: var(--surface);
    width: 90%;
    max-width: 380px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 20px;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-menu-overlay.open .mobile-menu-popup {
    transform: scale(1);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.mobile-menu-close {
    background: #f1f5f9;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: #e2e8f0;
}

.mobile-menu-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.mobile-menu-item:hover {
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary);
    border-color: rgba(37, 99, 235, 0.1);
}

.mobile-menu-item.active {
    background: var(--primary);
    color: white;
}

.mobile-menu-item.danger {
    color: var(--danger);
}

.mobile-menu-item.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Dark Mode support for Mobile Menu Popup */
body.dark-mode .mobile-menu-popup,
body[style*="background: #0f172a"] .mobile-menu-popup,
body[style*="background: rgb(15, 23, 42)"] .mobile-menu-popup,
.dark-mode-active .mobile-menu-popup {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

body.dark-mode .mobile-menu-header,
body[style*="background: #0f172a"] .mobile-menu-header,
body[style*="background: rgb(15, 23, 42)"] .mobile-menu-header,
.dark-mode-active .mobile-menu-header {
    border-bottom-color: #334155;
}

body.dark-mode .mobile-menu-close,
body[style*="background: #0f172a"] .mobile-menu-close,
body[style*="background: rgb(15, 23, 42)"] .mobile-menu-close,
.dark-mode-active .mobile-menu-close {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .mobile-menu-item:hover,
body[style*="background: #0f172a"] .mobile-menu-item:hover,
body[style*="background: rgb(15, 23, 42)"] .mobile-menu-item:hover,
.dark-mode-active .mobile-menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #3b82f6;
    border-color: rgba(255, 255, 255, 0.08);
}