/* 颜色组 */
:root {
    --xzblue: #00359e;
    --xzorange: #e36600;
    --tiaohe: DarkOrchid;
    --jiaohe: ForestGreen;
    --scrollbar-bg: #f1f1f100;
    --scrollbar-thumb: #00359e;
    --scrollbar-thumb-hover: #555;
    --dark-red: #8B0000;
    --newyear: #80171a;
    --newyeargold: #fff9b9;
}

/* 基本样式 */
body {
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden; /* 禁止左右滑动 */
    background-color: rgba(255, 255, 255, 0.8); /* 设置背景为透明度可调 */
}

/* 移动端背景图片设置 */
@media (max-width: 768px) {
    body {
        background-image: linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)), url('images/background_mobile.svg');
        background-repeat: repeat-y;
        background-size: 100% auto;
    }
}

/* 灰色背景 */
body.modal-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 101; /* 调整层级，确保在筛选和搜索弹出窗口之上 */
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

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

/* 页面顶部的bar样式 */
header {
    background-color: var(--newyear);
    color: var(--newyeargold);
    padding: 10px 0px;
    text-align: center;
    font-size: 20px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 10;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 30px;
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
    font-weight: normal; /* 调整字体粗细 */
}

/* 新增的header-logo样式 */
.header-logo {
    height: 24px; /* 调整图片高度 */
    margin-right: 10px; /* 调整图片与文字之间的间距 */
    margin-left: 40px; /* 调整图片与文字之间的间距 */
}

/* 新增的toggle-button样式 */
.toggle-button {
    position: absolute;
    left: 10px;
    background: rgba(255, 255, 255, 0.5); /* 半透明白色背景 */
    border: 2px solid white; /* 白色边框 */
    border-radius: 5px; /* 圆角 */
    width: 30px; /* 固定宽度 */
    height: 30px; /* 固定高度 */
    font-size: 16px;
    cursor: pointer;
    color: inherit;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 新增的menu-btn样式 */
.menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    margin-left: auto; /* 将按钮放在右侧 */
    margin-right: 5px; /* 将按钮放在右侧 */
}

/* 新增的sidebar样式 */
.sidebar {
    position: fixed;
    top: 0;
    right: -260px; /* 将sidebar放在右侧 */
    width: 200px;
    height: 100%;
    background-color: var(--newyear); /* 与Cocktail页面的bar颜色一致 */
    color: var(--newyeargold); /* 文字为白色 */
    transition: right 0.3s ease; /* 修改为right */
    z-index: 1000;
    padding: 20px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5); /* 修改阴影方向 */
}

.sidebar.active {
    right: 0; /* 修改为right */
}

.sidebar .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    position: absolute;
    top: 10px;
    right: 10px;
}

.sidebar h2 {
    margin-top: 50px;
    font-size: 24px;
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
}

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

.sidebar ul li {
    margin: 20px 0;
}

.sidebar ul li a {
    color: inherit;
    text-decoration: none;
    font-size: 18px;
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
}

@media (max-width: 768px) {
    .sidebar {
        width: 120px;
        right: -180px;
    }
}

/* 页面内容容器，避免被固定bar遮挡 */
.cocktail-container {
    display: flex;
    flex-direction: column;
    padding: 20px;
    width: 100%;
    height: auto;
    overflow-y: auto;
    margin-top: 60px; /* 为了避免被固定bar遮挡 */
    box-sizing: border-box; /* 确保内容不会超出容器 */
}

/* 卡片容器 */
.cocktail-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 0 auto; /* 居中显示 */
}

/* 单个卡片样式 */
.cocktail-card {
    border: 1px solid #ccc;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    background-color: #fff;
}

/* 图片样式：移动端不显示图片 */
.cocktail-card img {
    display: none;
}

/* 调和方式和酒精度数样式 */
.mixing-method, .alcohol-content {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 2px;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
    width: 40px; /* 调整宽度到40px */
    margin-right: 10px; /* 保持它们之间的距离 */
    color: gray; /* 默认颜色为灰色 */
    border: 1px solid gray; /* 默认边框颜色为灰色 */
}

/* 调和方式样式 */
.mixing-method {
    background-color: white;
    border: 1px solid var(--xzblue);
    color: var(--xzblue);
}

.mixing-method.xzorange {
    background-color: white;
    border: 1px solid var(--xzorange);
    color: var(--xzorange);
}

.mixing-method.gray {
    background-color: white;
    border: 1px solid gray;
    color: gray;
}

.mixing-method.tiaohe {
    background-color: white;
    border: 1px solid var(--tiaohe);
    color: var(--tiaohe);
}

.mixing-method.jiaohe {
    background-color: white;
    border: 1px solid var(--jiaohe); /* 绿色 */
    color: var(--jiaohe);
}

.mixing-method.qita {
    background-color: white;
    border: 1px solid #9E9E9E; /* 灰色 */
    color: #9E9E9E;
}

/* 酒精度数样式 */
.alcohol-content {
    background-color: var(--xzblue);
    color: white;
    border: 1px solid var(--xzblue); /* 酒精度数的边框与内部颜色一致 */
}

.alcohol-content.xzorange {
    background-color: var(--xzorange);
    color: white;
    border: 1px solid var(--xzorange); /* 酒精度数的边框与内部颜色一致 */
}

.alcohol-content.gray {
    background-color: gray;
    color: whitesmoke;
    border: 1px solid gray;
}

.alcohol-content.blueviolet {
    background-color: blueviolet;
    color: white;
    border: 1px solid blueviolet;
}

.alcohol-content.crimson {
    background-color: crimson;
    color: white;
    border: 1px solid crimson;
}

/* 口味样式 */
.taste {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 16px;
    color: white;
    margin-left: 10px;
}

.taste-1 {
    background-color: #12c2e9; /* 甜 */
}

.taste-2 {
    background-color: #6a8edb; /* 偏甜 */
}

.taste-3 {
    background-color: #c471ed; /* 中性 */
}

.taste-4 {
    background-color: #f5af19; /* 偏辣 */
}

.taste-5 {
    background-color: #f12711; /* 辣 */
}

.taste-none {
    background-color: #eee; /* 暂无 */
}

/* 隐藏没有内容的项 */
.hidden {
    display: none;
}

/* 卡片内内容样式 */
.cocktail-info h3, .cocktail-info p {
    font-size: 20px;
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif; /* 保持字体与移动端一致 */
    font-weight: bold; /* 调整字体粗细 */
}

/* 垂直排列的小卡片 */
@media (max-width: 768px) {
    .cocktail-card {
        width: 95%; /* 手机端宽度调整为 90% */
        margin: 0 auto; /* 居中显示 */
        box-sizing: border-box; /* 确保内容不会超出容器 */
    }

    .cocktail-info {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-left: 20px; /* 给酒名添加左边距 */
        padding-right: 15px; /* 调整整体和卡片右侧的距离 */
    }

    .cocktail-info h3 {
        font-size: 24px;
        flex-grow: 1;
        font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
        font-weight: bold; /* 调整字体粗细 */
    }

    .cocktail-info p {
        font-size: 14px;
    }

    .cocktail-card img {
        height: 120px;
        object-fit: cover; /* 保持图片比例 */
    }

    /* 酒名、调和方式和酒精度数在同一行并居中 */
    .cocktail-card .cocktail-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 16px;
    }

    .cocktail-card .cocktail-info .mixing-method,
    .cocktail-card .cocktail-info .alcohol-content {
        width: 40px; /* 固定宽度 */
        font-size: 14px;
    }

    /* 移动端隐藏酒的介绍 */
    .cocktail-card p {
        display: none;
    }

    /* 调整卡片与bar之间的距离 */
    .cocktail-container {
        margin-top: 50px; /* 可调距离 */
    }
}

/* 弹出框内的样式 */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 90%;
    background-color: rgba(255, 255, 255, 0); /* 修改底色为透明度可调的白色 */
    display: none; /* 默认为隐藏 */
    justify-content: center;
    align-items: center;
    overflow-y: hidden; /* 隐藏纵向滑动条 */
    z-index: 101; /* 确保弹出框在灰色背景之上 */
    border: 2px solid; /* 边框颜色会在JS中设置，粗细为当前的一半并取整 */
}

/* 关闭按钮样式 */
.close-button {
    position: absolute;
    top: 5px; /* 调整位置到滑动条上端平齐 */
    left: 5px; /* 调整位置到左上角 */
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
    z-index: 11; /* 确保关闭按钮在滚动条之上 */
}

.modal-header {
    position: relative;
    display: flex;
    align-items: flex-start;
}

.modal-content {
    display: flex;
    flex-direction: row;
    background-color: rgba(255, 255, 255, 1.0); /* 修改底色 */
    padding: 20px;
    border-radius: 10px;
    width: 75%; /* 弹出框宽度为页面总宽的60% */
    max-height: 100%; /* 移动端弹出框高度为85% */
    overflow-x: hidden; /* 隐藏横向滑动条 */
    overflow-y: auto; /* 添加纵向滑动条 */
    margin: 0 auto; /* 居中显示 */
}

.modal-image {
    width: 40%;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    margin-right: 20px;
}

/* 配方样式 */
.recipe-title {
    color: var(--dark-red);
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
    font-size: 18px;
    margin-top: 20px;
}

.recipe-divider {
    border-top: 1px dashed var(--dark-red);
    margin: 10px 0;
}

.recipe-content {
    white-space: pre-line; /* 保持换行 */
}

/* 调和方式样式 */
.mixing-method-title {
    color: var(--dark-red);
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
    font-size: 18px;
    margin-top: 20px;
}

.mixing-method-content {
    white-space: pre-line; /* 保持换行 */
}

/* 弹出框内图片处理 */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        max-width: 85%; /* 移动端弹出框宽度为85% */
        max-height: 85%; /* 移动端弹出框高度为85% */
    }

    .modal-image {
        width: 100%;
        height: auto;
    }
}

/* 页脚样式 */
footer {
    text-align: center;
    color: gray;
    font-family: "Source Han Serif SC VF", "Source Han Sans SC VF", sans-serif;
    font-size: 12px;
    margin: 10px 0;
}

footer a {
    color: #888;
    text-decoration: none;
}

footer a:visited {
    color: #888;
}

/* 网页端卡片容器 */
@media (min-width: 769px) {
    .cocktail-cards {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin: 0 auto; /* 居中显示 */
        padding: 0 5%; /* 左右两侧留出5%的间隙 */
    }

    /* 网页端单个卡片样式 */
    .cocktail-card {
        width: 150px; /* 固定宽度 */
        height: 120px; /* 固定高度 */
        margin: 15px; /* 调整间隙 */
        padding: 10px 20px; /* 添加左右两侧各留10px的间距 */
    }

    /* 网页端弹出框内的样式 */
    .modal-content {
        display: flex;
        flex-direction: row;
        background-color: rgba(255, 255, 255, 1.0); /* 修改底色 */
        padding: 20px;
        border-radius: 10px;
        width: 60%; /* 弹出框宽度为页面总宽的60% */
        max-height: 100%; /* 移动端弹出框高度为85% */
        overflow-x: hidden; /* 隐藏横向滑动条 */
        overflow-y: auto; /* 添加纵向滑动条 */
        margin: 0 auto; /* 居中显示 */
    }

    .modal-image {
        width: 300px; /* 固定宽度 */
        height: 500px; /* 固定高度 */
        object-fit: cover;
        border-radius: 10px;
        margin-right: 20px;
    }

    .modal-info {
        flex: 1;
        overflow-y: auto; /* 文字部分可以上下滑动 */
    }
}
