/* ==================== Global Styles ==================== */
:root {
    --primary-color: #1e3a8a;
    --secondary-color: #374151;
    --success-color: #059669;
    --info-color: #0891b2;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --light-color: #f8fafc;
    --dark-color: #111827;

    /* Hero gradient colors - Professional blue and silver theme */
    --hero-gradient-1: #1e40af;
    --hero-gradient-2: #3730a3;
    --hero-gradient-3: #6366f1;
    --hero-gradient-4: #8b5cf6;

    /* Alternative professional gradients */
    --hero-gradient-silver-1: #64748b;
    --hero-gradient-silver-2: #475569;
    --hero-gradient-silver-3: #334155;
    --hero-gradient-silver-4: #1e293b;

    /* Dark theme variables */
    --bg-primary-dark: #0f172a;
    --bg-secondary-dark: #1e293b;
    --text-primary-dark: #f8fafc;
    --text-secondary-dark: #cbd5e1;
    --card-bg-dark: #1e293b;
    --border-dark: #334155;

    /* Light theme variables */
    --bg-primary-light: #ffffff;
    --bg-secondary-light: #f1f5f9;
    --text-primary-light: #0f172a;
    --text-secondary-light: #475569;
    --card-bg-light: #ffffff;
    --border-light: #e2e8f0;

    /* Animation variables */
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
}

* {
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== Theme Switch Styles ==================== */
.light-theme {
    --bg-primary: var(--bg-primary-light);
    --bg-secondary: var(--bg-secondary-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --card-bg: var(--card-bg-light);
    --border-color: var(--border-light);
}

.dark-theme {
    --bg-primary: var(--bg-primary-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --card-bg: var(--card-bg-dark);
    --border-color: var(--border-dark);
}

.app-container {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ==================== Theme Switch ==================== */
.theme-switch-section {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
}

.theme-switch-container {
    gap: 15px;
    align-items: center;
}

.theme-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
    margin-right: 0;
}

.theme-switch .form-check-label {
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    margin: 0;
    line-height: 1.5;
}

/* ==================== Hero Section ==================== */
.hero-section {
    min-height: 90vh;
    background: linear-gradient(135deg, var(--hero-gradient-1) 0%, var(--hero-gradient-2) 25%, var(--hero-gradient-3) 50%, var(--hero-gradient-4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-row {
    position: relative;
    z-index: 2;
}

.hero-content {
    color: white;
    text-align: center;
}

.hero-avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
}

.hero-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.hero-name {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-name .underline {
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 14px;
}

.hero-tagline {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Hero contact buttons */
.hero-contact-buttons {
    margin-top: 2rem;
}

.hero-contact-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    margin: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.hero-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.hero-contact-btn i {
    font-size: 1rem;
}

/* ==================== Common Section Styles ==================== */
.about-section,
.skills-section {
    padding: 3rem 0;
    background-color: var(--bg-secondary);
}

.projects-section {
    padding: 5rem 0;
    background-color: var(--bg-secondary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* ==================== About Section ==================== */
.about-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-top: 2rem;
}

.about-content h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.about-content ul {
    margin-left: 1.5rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

/* Resume button in About section */
.resume-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 25px;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    margin-top: 1rem;
    box-shadow: var(--box-shadow);
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    border: none;
    color: white;
}

.resume-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
    text-decoration: none;
    background: linear-gradient(135deg, var(--hero-gradient-2), var(--hero-gradient-3));
    color: white;
}

.resume-btn i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

/* ==================== Skills Section ==================== */
.skills-container {
    max-width: 1000px;
    margin: 0 auto;
}

.skill-badge {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-radius: 20px;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    color: white;
    border: none;
}

.skill-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
    background: linear-gradient(135deg, var(--hero-gradient-2), var(--hero-gradient-3));
}

/* ==================== Projects Section ==================== */
.project-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
    border-color: var(--primary-color);
}

.project-card .card-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.project-card .card-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-card .card-body {
    padding: 1.5rem;
}

.project-card .card-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-card .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    margin: 0.2rem;
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    color: white;
    border: none;
}

/* Project view button */
.project-card .btn-primary {
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    border: none;
    color: white;
}

.project-card .btn-primary:hover {
    background: linear-gradient(135deg, var(--hero-gradient-2), var(--hero-gradient-3));
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-hover);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .hero-name {
        font-size: 2.5rem;
    }

    .hero-tagline {
        font-size: 1.2rem;
    }

    .hero-avatar {
        width: 150px;
        height: 150px;
    }

    .section-title {
        font-size: 2rem;
    }

    .theme-switch-section {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
    }

    .hero-contact-btn {
        margin: 0.3rem;
        min-width: 100px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        min-height: 70vh;
    }

    .hero-name {
        font-size: 2rem;
    }

    .hero-tagline {
        font-size: 1rem;
    }

    .about-section,
    .skills-section,
    .projects-section {
        padding: 3rem 0;
    }
}

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

.hero-content,
.about-content,
.skills-container,
.project-card,
.hero-contact-btn,
.resume-btn {
    animation: fadeInUp 0.8s ease-out;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--hero-gradient-2), var(--hero-gradient-3));
}

/* ==================== Text Selection Styles ==================== */
::selection {
    background-color: var(--primary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-color);
    color: white;
}

/* ==================== About Section Two-Column Layout ==================== */
.about-left-column,
.about-right-column {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    height: 100%;
    transition: all var(--transition-speed) ease;
}

.about-left-column:hover,
.about-right-column:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-2px);
}

.about-left-column h4,
.about-right-column h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    font-size: 1.25rem;  /* Smaller font size */
}

.about-left-column h4::after,
.about-right-column h4::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* ==================== Chatbot Styles ==================== */
/* 外层：限定高度，不负责滚动 */
.chatbot-container {
    max-height: 400px;
    overflow: hidden;      /* 或者 overflow-y:hidden; */
}

/* 内层：真正可滚动的区域 */
.chatbot-container .dash-chat {
    max-height: 100%;
    overflow-y: auto;      /* 让 scrollIntoView 只滚这里 */
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
}


.chatbot-container .dash-chat .dash-chat-message {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin: 0.5rem 0;
    padding: 1rem;
    transition: all var(--transition-speed) ease;
}

.chatbot-container .dash-chat .dash-chat-message:hover {
    box-shadow: var(--box-shadow);
}

.chatbot-container .dash-chat .dash-chat-message.user {
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    color: white;
    border-color: var(--primary-color);
}

.chatbot-container .dash-chat .dash-chat-message.assistant {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.chatbot-container .dash-chat .dash-chat-input {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    padding: 0.75rem;
    margin-top: 1rem;
}

.chatbot-container .dash-chat .dash-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
}

.chatbot-container .dash-chat .dash-chat-send {
    background: linear-gradient(135deg, var(--hero-gradient-1), var(--hero-gradient-2));
    border: none;
    border-radius: var(--border-radius);
    color: white;
    padding: 0.75rem 1.5rem;
    margin-top: 1rem;
    transition: all var(--transition-speed) ease;
}

.chatbot-container .dash-chat .dash-chat-send:hover {
    background: linear-gradient(135deg, var(--hero-gradient-2), var(--hero-gradient-3));
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-hover);
}

/* ==================== Responsive Design for About Section ==================== */
@media (max-width: 991px) {
    .about-left-column,
    .about-right-column {
        margin-bottom: 2rem;
    }

    .chatbot-container {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .about-left-column,
    .about-right-column {
        padding: 1.5rem;
    }

    .chatbot-container {
        height: 300px;
    }
}