/* Safari fallback for theme toggling */
[data-theme="dark"] {
    background: #181a1b !important;
    color: #f5f6fa !important;
}
[data-theme="light"] {
    background: #fff !important;
    color: #222 !important;
}
[data-theme="dark"] .btn-outline-info,
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-dark,
[data-theme="dark"] .btn-outline-success {
    border-color: #fff !important;
    color: #fff !important;
    background-color: transparent !important;
}
[data-theme="dark"] .btn-outline-info:hover,
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-dark.github-btn:hover,
[data-theme="dark"] .btn-outline-success:hover {
    background-color: #fff !important;
    color: #111 !important;
}
/* Fix GitHub icon visibility in dark mode */
/* Fix GitHub icon visibility in dark mode (button and icon) */
[data-theme="dark"] .github-btn {
    background-color: transparent !important;
    border-color: #fff !important;
    color: #fff !important;
}
[data-theme="dark"] .github-btn .fa-github {
    color: #fff !important;
}

/* Google Scholar icon (Academicons) */
.ai-google-scholar:before, .ai.ai-google-scholar:before {
    font-family: 'Academicons';
    content: "\e900";
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Academic Website Custom Styles */

/* Global font size reduction */
html {
    font-size: 0.9rem; /* Reverted back from 1.1rem for better proportions */
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-medium: rgba(0,0,0,0.15);
    
    /* Light theme colors (default) */
    --theme-bg: #ffffff;
    --theme-bg-secondary: #f8f9fa;
    --theme-text: #2c3e50;
    --theme-text-muted: #6c757d;
    --theme-border: #dee2e6;
    --theme-shadow: rgba(0,0,0,0.1);
    --theme-card-bg: #ffffff;
}

/* Dark theme colors */
[data-theme="dark"] {
    --theme-bg: #1a1a1a;
    --theme-bg-secondary: #2d2d2d;
    --theme-text: #ffffff;
    --theme-text-muted: #adb5bd;
    --theme-border: #404040;
    --theme-shadow: rgba(0,0,0,0.3);
    --theme-card-bg: #2d2d2d;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--theme-text);
    background-color: var(--theme-bg);
    padding-top: 76px; /* Account for fixed navbar */
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.95rem; /* Reverted back from 1.05rem for better proportions */
}

/* Adjust heading sizes slightly */
h1 { font-size: calc(2.3rem + 0.6vw); }
h2 { font-size: calc(1.8rem + 0.3vw); }
h3 { font-size: calc(1.5rem + 0.3vw); }
h4 { font-size: calc(1.2rem + 0.15vw); }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

/* Adjust lead text */
.lead {
    font-size: 1.15rem;
}

/* Adjust display headings */
.display-4 {
    font-size: calc(2.2rem + 1.2vw);
}

/* Language-specific font families */
[lang="en"] body {
    font-family: 'Inter', 'Segoe UI', 'Source Sans Pro', sans-serif;
}

[lang="fr"] body {
    font-family: 'Inter', 'Source Sans Pro', 'Segoe UI', sans-serif;
}

[lang="bn"] body {
    font-family: 'Noto Serif Bengali', 'Noto Sans Bengali', 'Inter', 'Segoe UI', sans-serif;
}

/* Bengali font variants for testing */
.bengali-sans {
    font-family: 'Noto Sans Bengali', 'Inter', 'Segoe UI', sans-serif !important;
}

.bengali-serif {
    font-family: 'Noto Serif Bengali', 'Noto Sans Bengali', serif !important;
}

/* Better line spacing for Bengali serif */
[lang="bn"] body {
    line-height: 1.7; /* Slightly more spacing for Bengali readability */
}

.main-content {
    min-height: calc(100vh - 160px);
    background-color: var(--theme-bg);
    transition: background-color 0.3s ease;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px var(--theme-shadow);
    transition: box-shadow 0.3s ease;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.3rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--secondary-color) !important;
}

.nav-link.active {
    color: var(--secondary-color) !important;
    font-weight: 600;
}

/* Cards and Content - Adaptive backgrounds */
.card {
    border: 1px solid var(--theme-border);
    background-color: var(--theme-card-bg) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px var(--theme-shadow);
}

.card-body {
    background-color: var(--theme-card-bg) !important;
    color: var(--theme-text) !important;
}

.card-title {
    color: var(--theme-text) !important;
}

.card-text {
    color: var(--theme-text-muted) !important;
}

/* Ensure proper contrast for dark theme cards */
[data-theme="dark"] .card {
    border-color: #404040 !important;
    background-color: var(--theme-card-bg) !important;
}

[data-theme="dark"] .card-body {
    background-color: var(--theme-card-bg) !important;
}

[data-theme="dark"] .card-header {
    background-color: #404040 !important;
    border-color: #404040 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card-title {
    color: #ffffff !important;
}

[data-theme="dark"] .card-text {
    color: #adb5bd !important;
}

/* Button adjustments for dark theme */
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-success,
[data-theme="dark"] .btn-outline-info {
    color: #ffffff;
    border-color: var(--theme-border);
}

[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-success:hover,
[data-theme="dark"] .btn-outline-info:hover {
    background-color: var(--theme-bg-secondary);
    border-color: var(--secondary-color);
    color: #ffffff;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px; /* iOS minimum tap target size */
    min-height: 44px; /* iOS minimum tap target size */
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--theme-bg-secondary);
    border-color: var(--secondary-color);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

/* Dark theme adjustments for navbar and footer */
[data-theme="dark"] .navbar {
    background-color: #2d2d2d !important;  /* Lighter than pure black */
}

[data-theme="dark"] .bg-dark {
    background-color: #2d2d2d !important;  /* Lighter background for better readability */
}

/* Improve blog page header visibility in dark mode */
[data-theme="dark"] .display-4,
[data-theme="dark"] .display-5 {
    color: #ffffff !important;
}

[data-theme="dark"] .lead {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .text-light {
    color: #ffffff !important;
}

/* Ensure all text is visible in dark mode */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #ffffff !important;
}

[data-theme="dark"] p,
[data-theme="dark"] .lead {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

[data-theme="dark"] .text-dark {
    color: #ffffff !important;
}

/* Badge styling for dark mode */
[data-theme="dark"] .badge.bg-light {
    background-color: #404040 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-light.text-dark {
    background-color: #404040 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-warning.text-dark {
    background-color: #f39c12 !important;
    color: #000000 !important;
}

[data-theme="dark"] .display-4 {
    color: #ffffff !important;
}

/* Blog post links styling for dark mode */
[data-theme="dark"] .blog-post h2 a,
[data-theme="dark"] .blog-post .text-decoration-none {
    color: #ffffff !important;
}

[data-theme="dark"] .blog-post h2 a:hover {
    color: var(--secondary-color) !important;
}

/* News item styling for dark mode */
[data-theme="dark"] .news-item h3 a {
    color: #ffffff !important;
}

[data-theme="dark"] .news-item h3 a:hover {
    color: var(--secondary-color) !important;
}

[data-theme="dark"] .news-content {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .news-date {
    color: #adb5bd !important;
}

[data-theme="dark"] .news-item p {
    color: #e0e0e0 !important;
}

/* Ensure news items have dark backgrounds in dark mode */
[data-theme="dark"] .news-item {
    background-color: var(--theme-card-bg) !important;
    border-color: #404040 !important;
    color: #ffffff !important;
}

/* Fix any remaining text visibility issues */
[data-theme="dark"] .container {
    color: #ffffff;
}

[data-theme="dark"] .card-body p {
    color: #e0e0e0 !important;
}

/* Footer icons: remove stray underline/characters and make icons larger */
.footer-icons a {
    text-decoration: none !important; /* remove any underline */
    display: inline-block;
    line-height: 1; /* avoid extra characters aligning */
}

.footer-icons i {
    font-size: 1.5rem; /* make icons bigger */
    vertical-align: middle;
}

.footer-icons a:hover i {
    color: var(--secondary-color);
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-title {
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #34495e;
    border-color: #34495e;
}

/* Language Switcher */
.dropdown-item.active {
    background-color: var(--secondary-color);
    color: white;
}

/* Profile Image */
.rounded-circle {
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Hero Section */
.display-4 {
    color: var(--theme-text);
    font-weight: 700;
}

.lead {
    color: var(--theme-text-muted);
}

/* Blog Posts */
.blog-post {
    border-bottom: 1px solid var(--theme-border);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.blog-post:last-child {
    border-bottom: none;
}

.blog-meta {
    color: var(--theme-text-muted);
    font-size: 0.9rem;
}

.blog-meta a {
    color: var(--secondary-color);
    text-decoration: none;
}

.blog-meta a:hover {
    text-decoration: underline;
}

/* Publications */
.publication-item {
    border-left: 4px solid var(--secondary-color);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}

.publication-title {
    font-weight: 600;
    color: var(--theme-text);
}

.publication-authors {
    font-style: italic;
    color: var(--theme-text-muted);
}

.publication-venue {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Notebooks */
.notebook-preview {
    background: var(--theme-bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.notebook-preview pre {
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--theme-text);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* News Timeline */
.news-timeline {
    position: relative;
    padding-left: 2rem;
}

.news-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--secondary-color);
}

.news-item {
    position: relative;
    margin-bottom: 2rem;
    background: var(--theme-card-bg);
    color: var(--theme-text);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px var(--theme-shadow);
    border: 1px solid var(--theme-border);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.news-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    background: var(--secondary-color);
    border-radius: 50%;
    border: 3px solid var(--theme-bg);
    transition: border-color 0.3s ease;
}

.news-date {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .news-timeline {
        padding-left: 1rem;
    }
    
    .news-item::before {
        left: -1.5rem;
    }
    
    /* Mobile Navigation Improvements */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .theme-toggle {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        margin-right: 0.5rem !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        background: transparent !important;
        color: white !important;
        border-radius: 0.375rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.1rem !important;
    }
    
    .theme-toggle:hover,
    .theme-toggle:focus,
    .theme-toggle:active {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.8) !important;
        color: white !important;
        transform: scale(1.05) !important;
    }
    
    .navbar-toggler {
        padding: 0.375rem 0.5rem;
        font-size: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.3);
        min-height: 38px;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
    }
    
    .dropdown-menu {
        background: var(--bs-dark);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.85);
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .dropdown-item:hover,
    .dropdown-item:focus {
        background: rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 1);
    }
    
    .dropdown-item.active {
        background: var(--bs-primary);
        color: white;
    }
    
    /* Fix mobile dropdown positioning */
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
    }
    
    /* Mobile Content Improvements */
    .profile-photo {
        max-width: 180px;
        margin: 0 auto 1.5rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .card {
        margin-bottom: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.5rem;
    }
    
    /* Fix mobile touch targets */
    .btn {
        min-height: 44px;
    }
    
    /* Improve mobile scrolling */
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Better mobile typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .small {
        font-size: 0.8rem;
    }
    
    /* Mobile-friendly table */
    .table-responsive {
        font-size: 0.9rem;
    }
}

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

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Remove default dark mode media query since we have manual theme toggle */
/* The user can choose their preferred theme using the toggle button */

/* Clickable section headings */
.section-heading-link {
    transition: all 0.3s ease;
}

.section-heading-link:hover {
    transform: translateX(5px);
    text-decoration: underline !important;
}

.section-heading-link:hover i {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Hero Section Styles */
.hero-section {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%) !important;
    color: white !important;
    width: 100%;
    margin: 0;
    padding: 4rem 0 !important;
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-section p.lead {
    color: rgba(255,255,255,0.9) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    z-index: -1;
}

/* Dark theme hero adjustments */
[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1a252f 0%, #2980b9 100%) !important;
}

/* Notebook Display Styles */
.notebook-content {
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.notebook-content .cell {
    margin-bottom: 1.5rem;
    border-left: 4px solid transparent;
    padding-left: 1rem;
}

.notebook-content .markdown-cell {
    border-left-color: var(--secondary-color);
}

.notebook-content .code-cell {
    border-left-color: var(--accent-color);
}

.notebook-content .input pre {
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.notebook-content .output {
    margin-top: 0.5rem;
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    background: var(--theme-bg);
}

.notebook-content .output-text,
.notebook-content .output-result {
    padding: 0.75rem;
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    color: var(--theme-text);
}

.notebook-content .manual-conversion {
    position: relative;
}

.notebook-content .manual-conversion::before {
    content: "⚠️ Simplified Display Mode";
    position: absolute;
    top: -0.5rem;
    right: 1rem;
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Mobile post info toggle */
.btn-mobile-toggle {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    background: var(--theme-bg);
    color: var(--theme-text);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-mobile-toggle:hover {
    background: var(--theme-bg-secondary);
    border-color: var(--secondary-color);
    color: var(--theme-text);
}

.btn-mobile-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

.btn-mobile-toggle i {
    transition: transform 0.2s ease;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    /* No custom padding or margin overrides for mobile; use default Bootstrap/browser spacing */
}

/* Extra small devices (phones) */
@media (max-width: 576px) {
    /* No custom padding or margin overrides for small phones; use default Bootstrap/browser spacing */
}

/* Tab styling improvements */
.nav-pills .nav-link {
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    margin-right: 0.25rem;
    transition: all 0.3s ease;
}

.nav-pills .nav-link:hover {
    background-color: var(--theme-bg-secondary);
    border-color: var(--secondary-color);
}

.nav-pills .nav-link.active {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #ffffff !important; /* Force white text on active tab */
}

.nav-pills .nav-link.active:hover {
    background-color: var(--secondary-color) !important;
    color: #ffffff !important;
}