/* ============================================
   MaLab - Modern Academic Design System
   Inspired by Google DeepMind
   Dr. Tianle Ma - Oakland University
   ============================================ */

/* Import Google Fonts - Clean Modern Typography */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS Variables - Design Tokens */
:root {
    /* Primary Colors - Deep Blue to Purple Gradient (DeepMind inspired) */
    --primary-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --highlight-gradient: linear-gradient(90deg, #00d4ff 0%, #7b2cbf 100%);

    /* Base Colors */
    --primary-dark: #1a1a2e;
    --primary-mid: #16213e;
    --primary-light: #0f3460;
    --accent: #667eea;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;

    /* Neutrals */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Google Sans', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Layout */
    --max-width: 1200px;
    --nav-width: 280px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    background: var(--highlight-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-lg);
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
}

h3 {
    font-size: 1.25rem;
    color: var(--gray-700);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-dark);
}

strong,
b {
    font-weight: 600;
    color: var(--text-primary);
}

/* Layout Container */
#tlayout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    border: none;
    border-collapse: collapse;
}

#tlayout>tbody {
    display: flex;
    width: 100%;
}

#tlayout>tbody>tr {
    display: flex;
    width: 100%;
}

/* Navigation Sidebar - DeepMind Style */
#layout-menu {
    width: var(--nav-width);
    min-width: var(--nav-width);
    background: var(--primary-gradient);
    padding: var(--space-2xl) var(--space-lg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* Animated gradient border on nav */
#layout-menu::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: var(--highlight-gradient);
    opacity: 0.5;
}

.menu-category {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    position: relative;
}

.menu-category::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
}

.menu-item {
    margin-bottom: var(--space-xs);
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.menu-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: height var(--transition-fast);
}

.menu-item a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    transform: translateX(4px);
}

.menu-item a:hover::before {
    height: 60%;
}

/* Main Content Area */
#layout-content {
    flex: 1;
    margin-left: var(--nav-width);
    padding: var(--space-3xl) var(--space-4xl);
    background: var(--white);
    min-height: 100vh;
    position: relative;
}

/* Top Title Section */
#toptitle {
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--gray-200);
}

#toptitle h1 {
    margin-bottom: var(--space-sm);
}

/* Profile Card - Hero Section */
.imgtable {
    border: none !important;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: var(--space-2xl);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeInUp 0.6s ease;
    position: relative;
}

/* Gradient accent on profile card */
.imgtable::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.imgtable td {
    padding: var(--space-xl);
    vertical-align: top;
    border: none !important;
}

.imgtable img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    object-fit: cover;
}

.imgtable img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

.imgtable ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.imgtable li {
    margin-bottom: var(--space-sm);
    padding-left: 0;
}

.imgtable li::before {
    display: none;
}

.imgtable li p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.imgtable li:first-child p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
}

/* Lists */
ul {
    list-style: none;
    margin-bottom: var(--space-lg);
}

li {
    margin-bottom: var(--space-sm);
    padding-left: var(--space-lg);
    position: relative;
    color: var(--text-secondary);
}

li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent-gradient);
    border-radius: 50%;
}

li p {
    margin: 0;
}

/* Publication Cards */
#layout-content>li,
#layout-content ul>li {
    background: var(--white);
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    border-left: 3px solid transparent;
    border-image: var(--accent-gradient) 1;
    transition: all var(--transition-normal);
    list-style: none;
}

#layout-content>li::before,
#layout-content ul>li::before {
    display: none;
}

#layout-content>li:hover,
#layout-content ul>li:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

/* Buttons */
.btn,
a.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--accent-gradient);
    color: var(--white) !important;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    background: var(--white);
    color: var(--accent) !important;
    border: 2px solid var(--accent);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--accent);
    color: var(--white) !important;
}

/* Alert/Warning Box */
.alert-box,
[style*="background: #fff3cd"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    border-left: 4px solid #f59e0b !important;
    padding: var(--space-md) var(--space-lg) !important;
    border-radius: var(--radius-md) !important;
    margin: var(--space-lg) 0 !important;
}

/* Research Highlight Box */
[style*="background: linear-gradient"] {
    border-radius: var(--radius-lg) !important;
    padding: var(--space-lg) var(--space-xl) !important;
}

/* Footer */
#footer {
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

#footer-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

#footer-text a {
    color: var(--accent);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease;
}

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

/* Content cards animate on load */
.imgtable,
#layout-content>li,
.resource-section,
.lecture-card,
.course-card {
    animation: fadeInUp 0.5s ease backwards;
}

#layout-content>li:nth-child(1) {
    animation-delay: 0.1s;
}

#layout-content>li:nth-child(2) {
    animation-delay: 0.15s;
}

#layout-content>li:nth-child(3) {
    animation-delay: 0.2s;
}

#layout-content>li:nth-child(4) {
    animation-delay: 0.25s;
}

#layout-content>li:nth-child(5) {
    animation-delay: 0.3s;
}

/* Code styling */
code,
pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

code {
    padding: 0.2em 0.4em;
}

pre {
    padding: var(--space-md);
    overflow-x: auto;
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--white);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Responsive Design */
@media (max-width: 1024px) {
    :root {
        --nav-width: 240px;
    }

    #layout-content {
        padding: var(--space-xl) var(--space-2xl);
    }
}

@media (max-width: 768px) {

    #tlayout,
    #tlayout>tbody,
    #tlayout>tbody>tr {
        flex-direction: column;
    }

    #layout-menu {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        padding: var(--space-lg);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-sm);
    }

    #layout-menu::after {
        display: none;
    }

    .menu-category {
        font-size: 1.25rem;
        margin-bottom: 0;
        margin-right: auto;
        padding-bottom: 0;
    }

    .menu-category::after {
        display: none;
    }

    .menu-item {
        margin-bottom: 0;
    }

    .menu-item a {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
    }

    #layout-content {
        margin-left: 0;
        padding: var(--space-lg);
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .imgtable {
        display: block;
    }

    .imgtable tbody,
    .imgtable tr,
    .imgtable td {
        display: block;
        width: 100%;
    }

    .imgtable td {
        padding: var(--space-lg);
        text-align: center;
    }

    .imgtable img {
        max-width: 200px;
        height: auto;
        margin: 0 auto;
    }
}

/* Remove old jemdoc table styling */
table {
    border: none !important;
    border-collapse: separate;
}

td {
    border: none !important;
}

/* Link underline animation */
#layout-content a:not(.btn) {
    position: relative;
    color: var(--accent);
    font-weight: 500;
}

#layout-content a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width var(--transition-fast);
}

#layout-content a:not(.btn):hover::after {
    width: 100%;
}

/* Course-specific styles (for 3610 page) */
.lecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.lecture-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid transparent;
    border-image: var(--accent-gradient) 1;
    transition: all var(--transition-normal);
}

.lecture-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.lecture-num {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lecture-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: var(--space-sm) 0;
    font-weight: 600;
    font-family: var(--font-display);
}

.lecture-links {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.lecture-links a {
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.lecture-links a:hover {
    background: var(--accent);
    color: var(--white);
}

.lecture-links a.primary {
    background: var(--accent-gradient);
    color: var(--white);
}

.lecture-links a.primary:hover {
    box-shadow: var(--shadow-glow);
}

.resource-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid transparent;
    border-image: var(--accent-gradient) 1;
}

.course-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
    border-image: var(--accent-gradient) 1;
    transition: all var(--transition-normal);
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.course-card h3 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--text-primary);
    font-family: var(--font-display);
}

.course-card p {
    margin: 0 0 var(--space-md) 0;
}