/* 主题样式 */

/* 默认主题 */
.theme-default {
    --primary-color: #c62828;
    --primary-dark: #8e0000;
    --primary-light: #ff5f52;
    --secondary-color: #ffb300;
    --secondary-light: #ffe54c;
    --text-color: #333;
    --light-text: #fff;
    --gray-bg: #f5f5f5;
    --dark-bg: #222;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --cart-bg: #fff;
    --card-bg: #fff;
    --body-bg: #f5f5f5;
    --header-bg: var(--primary-color);
    --footer-bg: var(--dark-bg);
}

/* 深色主题 */
.theme-dark {
    --primary-color: #212121;
    --primary-dark: #000000;
    --primary-light: #484848;
    --secondary-color: #ff9800;
    --secondary-light: #ffc947;
    --text-color: #eaeaea;
    --light-text: #fff;
    --gray-bg: #333;
    --dark-bg: #121212;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --cart-bg: #212121;
    --card-bg: #2c2c2c;
    --body-bg: #121212;
    --header-bg: var(--primary-color);
    --footer-bg: #000;
}

/* 浅色主题 */
.theme-light {
    --primary-color: #2196f3;
    --primary-dark: #0069c0;
    --primary-light: #6ec6ff;
    --secondary-color: #64b5f6;
    --secondary-light: #9be7ff;
    --text-color: #444;
    --light-text: #fff;
    --gray-bg: #f9f9f9;
    --dark-bg: #e0e0e0;
    --border-color: #ccc;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --cart-bg: #fff;
    --card-bg: #fff;
    --body-bg: #f9f9f9;
    --header-bg: var(--primary-color);
    --footer-bg: #e0e0e0;
}

/* 温暖主题 */
.theme-warm {
    --primary-color: #ff5722;
    --primary-dark: #c41c00;
    --primary-light: #ff8a50;
    --secondary-color: #ff9800;
    --secondary-light: #ffc947;
    --text-color: #4e342e;
    --light-text: #fff;
    --gray-bg: #fff3e0;
    --dark-bg: #5d4037;
    --border-color: #ffcc80;
    --shadow-color: rgba(255, 111, 0, 0.1);
    --cart-bg: #fffde7;
    --card-bg: #fff8e1;
    --body-bg: #fff3e0;
    --header-bg: var(--primary-color);
    --footer-bg: #5d4037;
}

/* 清凉主题 */
.theme-cool {
    --primary-color: #009688;
    --primary-dark: #00675b;
    --primary-light: #52c7b8;
    --secondary-color: #4caf50;
    --secondary-light: #80e27e;
    --text-color: #37474f;
    --light-text: #fff;
    --gray-bg: #e0f7fa;
    --dark-bg: #263238;
    --border-color: #b2dfdb;
    --shadow-color: rgba(0, 150, 136, 0.1);
    --cart-bg: #e0f2f1;
    --card-bg: #e8f5e9;
    --body-bg: #e0f7fa;
    --header-bg: var(--primary-color);
    --footer-bg: #263238;
}

/* 主题切换器样式 - 改进版 */
.theme-selector {
    position: relative;
    margin-right: 15px;
    z-index: 110; /* 提高z-index确保下拉菜单显示在其他元素之上 */
}

.theme-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    transition: background-color 0.3s;
}

.theme-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 180px; /* 增加宽度 */
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* 增强阴影效果 */
    border-radius: 8px;
    margin-top: 5px;
    z-index: 110;
    display: none;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.theme-dropdown:before {
    content: '';
    position: absolute;
    top: -8px;
    right: 15px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

.theme-dropdown.active {
    display: block;
    animation: fadeIn 0.3s;
}

.theme-option {
    padding: 14px 16px; /* 增加内边距，提高可点击区域 */
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
    color: #333; /* 确保文字颜色足够深 */
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}

.theme-option:last-child {
    border-bottom: none;
}

.theme-option:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid #ddd;
}

.theme-option[data-theme="theme-default"]:before {
    background-color: #c62828;
}

.theme-option[data-theme="theme-dark"]:before {
    background-color: #212121;
}

.theme-option[data-theme="theme-light"]:before {
    background-color: #2196f3;
}

.theme-option[data-theme="theme-warm"]:before {
    background-color: #ff5722;
}

.theme-option[data-theme="theme-cool"]:before {
    background-color: #009688;
}

.theme-option:hover {
    background-color: #f5f5f5;
}

.theme-option.active {
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.05);
}

.theme-option.active:after {
    content: '✓';
    margin-left: auto;
    color: var(--primary-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 应用主题变量 */
body {
    background-color: var(--body-bg);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

header {
    background-color: var(--header-bg);
}

footer {
    background-color: var(--footer-bg);
}

.cart-sidebar {
    background-color: var(--cart-bg);
    color: var(--text-color);
}

.menu-item {
    background-color: var(--card-bg);
}

.nav-tab {
    background-color: var(--gray-bg);
    color: var(--text-color);
}

.nav-tab.active {
    background-color: var(--primary-color);
    color: var(--light-text);
}
