/* 全局样式 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 页头 */
header {
    background-color: #b19cd9; /* 淡紫色 */
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px;
}

.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin-left: 20px;
}

.nav-links a {
    color: #fffacd; /* 淡黄色 */
    text-decoration: none;
    font-size: 18px;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: #fffacd; /* 淡黄色 */
    margin: 4px 0;
    transition: transform 0.3s ease;
}

/* 汉堡菜单动画效果 */
.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* 页面切换 */
.page {
    display: none;
    padding: 20px;
    flex: 1;
    min-height: calc(100vh - 100px); /* 减去页头和页脚的高度 */
}

.page.active {
    display: block;
}

/* 配方生成 */
#generate {
    text-align: center;
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 350px; /* 缩小轮播图宽度 */
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.carousel-item {
    display: none;
    width: 100%;
    transition: opacity 0.5s ease-in-out;
}

.carousel-item.active {
    display: block;
    opacity: 1;
}

.carousel-item img {
    width: 100%;
    border-radius: 10px;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 20px;
    border-radius: 50%;
    user-select: none;
}

.carousel-control.prev {
    left: 10px;
}

.carousel-control.next {
    right: 10px;
}

.generate-btn {
    background-color: #FFDE59; /* 淡黄色 */
    color: #000000; /* 黑色 */
    border: none;
    padding: 20px 40px; /* 增大按钮尺寸 */
    font-size: 24px; /* 增大字体尺寸 */
    cursor: pointer;
    border-radius: 50px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.generate-btn:hover {
    background-color: #ffe4b5; /* 鼠标悬停时更亮的淡黄色 */
}

/* AI 对话界面 */
#ai-dialog {
    background-color: #f9f4ff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

#ai-dialog.active {
    display: flex;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ffeb3b;
}

.dialog-header h3 {
    color: #7b1fa2;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.header-spacer {
    width: 60px;
}

.back-btn {
    background: none;
    border: none;
    color: #7b1fa2;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 0;
    width: 60px;
    text-align: left;
}

/* 消息滚动容器 */
.message-scroll-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    position: relative;
    scroll-behavior: smooth;
}

.message-container {
    padding: 10px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message, .user-message {
    display: flex;
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 80%;
    min-width: 120px;
}

.message-time {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 3px;
}

.ai-message .message-time {
    text-align: left;
}

.user-message .message-time {
    text-align: right;
}

.text {
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #333;
    line-height: 1.4;
    white-space: pre-line;
}

.ai-bubble .text {
    background-color: white;
    border-radius: 0 12px 12px 12px;
}

.user-bubble .text {
    background-color: #fff9c4;
    border-radius: 12px 0 12px 12px;
}

/* 输入区域容器 */
.input-area-container {
    background-color: #f9f4ff;
    padding-top: 8px;
    position: relative;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.quick-btn {
    background-color: #e1bee7;
    color: #7b1fa2;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 90px;
    text-align: center;
}

.quick-btn:hover {
    background-color: #ce93d8;
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

.user-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1c4e9;
    border-radius: 20px;
    outline: none;
    font-size: 15px;
}

.send-btn {
    background-color: #7b1fa2;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    width: 70px;
    font-size: 14px;
}

.send-btn:hover {
    background-color: #9c27b0;
}

/* 配方样式 */
.recipe-title {
    font-weight: bold;
    color: #7b1fa2;
    margin-bottom: 6px;
    font-size: 15px;
}

.recipe-section {
    margin-bottom: 8px;
}

.recipe-section-title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 14px;
}

.recipe-list {
    padding-left: 16px;
    margin: 4px 0;
    font-size: 13px;
}

.recipe-list li {
    margin-bottom: 3px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    #ai-dialog {
        padding: 15px;
    }

    .quick-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 80px;
    }

    .send-btn {
        width: 60px;
        font-size: 13px;
    }

    .user-input {
        font-size: 14px;
    }
}

/* 全局样式，设置页面字体、外边距、内边距和背景颜色 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f4ff; /* 加入淡紫色背景 */
}

/* 页面整体的内边距 */
.page {
    padding: 20px;
}

/* 用户档案标题样式，居中显示并设置颜色 */
.profile-title {
    text-align: center;
    color: #6a5acd; /* 淡紫色标题 */
}

/* 卡片容器样式，使用 flex 布局，垂直排列，卡片之间有间距 */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 顶部卡片布局（个人卡片和调酒次数统计卡片） */
.top-cards {
    display: flex;
    gap: 20px;
}

/* 中部卡片布局（状态解读和心情卡片） */
.middle-cards {
    display: flex;
    gap: 20px;
}

/* 底部卡片布局（我的最爱、新鲜发现、我的饮酒人格、性格色彩） */
.bottom-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* 通用卡片样式 */
.personal-card,
.mixing-count-card,
.status-card,
.mood-card,
.grid-item {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    flex: 1; /* 并列排布时卡片大小一样 */
    transition: transform 0.3s ease;
}

/* 卡片标题样式 */
.card-title {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 12px;
    color: #6a5acd; /* 淡紫色标题 */
    margin: 0;
}

/* 卡片关键词样式 */
.card-keyword {
    font-size: 18px;
    font-weight: bold;
    margin-top: 20px;
}

/* 卡片图片样式，缩小头像图片尺寸 */
.personal-card img {
    width: 75px;
    height: 75px;
    margin: 10px 0;
}
.grid-item img {
    width: 150px;
    height: 150px;
    margin: 10px 0;
}

/* 调酒次数统计卡片中的总次数样式，设置字体大小和加粗 */
.total-count {
    font-size: 24px;
    font-weight: bold;
}

/* 本周状态解读卡片中的图标样式，设置宽度、高度和右边距，并再次增大 */
.status-card img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

/* 本周状态解读卡片中的文本样式，加粗并设置为和卡片标题一样大小 */
.status-card p {
    font-size: 12px;
    font-weight: bold;
    color: #000;
}

/* 本周心情指数卡片样式 */
.mood-card {
    display: flex;
    flex-direction: column;
}

/* 心情指数的表情并列排布 */
.mood-items {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

/* 本周心情指数卡片中的每个小项样式 */
.mood-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.mood-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
    transition: transform 0.3s ease;
}

/* 心情指数图片的交互效果，鼠标悬停时放大 */
.mood-item img:hover {
    transform: scale(1.1);
}

/* 心情指数里面的内容文字样式，变小加粗 */
.mood-item p {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}

/* 多宫格元素鼠标悬停时的样式，放大元素 */
.grid-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

/* 描述信息样式 */
.description {
    font-size: 12px;
    color: #000;
    font-weight: bold;
    margin-top: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .middle-cards {
        flex-direction: column;
    }
    .bottom-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 页脚 */
footer {
    background-color: #b19cd9; /* 淡紫色 */
    color: #fffacd; /* 淡黄色 */
    text-align: center;
    padding: 10px;
    margin-top: auto;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        background-color: #b19cd9; /* 淡紫色 */
        position: absolute;
        top: 60px;
        right: 20px;
        width: auto;
        margin: 0;
        padding: 0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-radius: 5px;
        z-index: 10; /* 设置层叠顺序，确保导航列表显示在更上层 */
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        margin: 0;
    }

    .nav-links a {
        color: #fffacd; /* 淡黄色 */
        text-decoration: none;
        font-size: 18px;
        padding: 10px 20px;
        display: block;
    }

    .hamburger {
        display: flex;
    }
}