/* 合并的主样式文件 - 包含字体、样式和布局 */

/* ========== 字体定义 ========== */

/* 阿里妈妈数黑体 - 用于分类标题 */
@font-face {
    font-family: "alimama";
    src: url("../fonts/alimamashuheiti.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* D-DIN-PRO-400-Regular - 用于价格显示 */
@font-face {
    font-family: "D-DIN-PRO-400-Regular";
    src: url("../fonts/D-DIN-PRO-400-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ========== 使用Tailwind配色方案 ========== */
/* 不再使用CSS变量，直接使用Tailwind的颜色值 */

/* ========== 字体应用类 ========== */

/* 价格字体 */
.price-font {
    font-family: 'D-DIN-PRO-400-Regular', 'Arial', 'Helvetica', sans-serif;
    font-weight: normal;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    font-size: 1.25rem; /* 20px */
}

/* 价格容器 - 货币符号和数字分开处理 */
.price-container {
    display: inline-flex;
    align-items: baseline;
    gap: 0.1em;
}

/* 货币符号 - 使用默认字体，较小尺寸 */
.currency-symbol {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.7em;
    font-weight: normal;
}

/* 价格数字 - 使用专用字体 */
.price-number {
    font-family: 'D-DIN-PRO-400-Regular', 'Arial', 'Helvetica', sans-serif;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* 分类标题字体 */
.category-title-font {
    font-family: 'alimama', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-weight: normal;
}

/* 栏目标题字体 */
.section-title-font {
    font-family: 'alimama', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-weight: normal;
}

/* 数字字体 - 用于统计数据等 */
.number-font {
    font-family: 'D-DIN-PRO-400-Regular', 'Arial', 'Helvetica', monospace, sans-serif;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ========== 基础样式 ========== */

/* 隐藏所有滚动条但保持滚动功能 */
html, body {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.default-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* 按钮样式 - 使用Tailwind CSS变量 */
.default-btn-primary {
    background: var(--color-blue-500);
    color: white;
    border-radius: 6px;
    padding: 10px 20px;
    transition: all 0.2s ease;
    border: none;
}

.default-btn-primary:hover {
    background: var(--color-blue-600);
}

.default-btn-secondary {
    background: transparent;
    color: var(--color-blue-500);
    border: 1px solid var(--color-blue-500);
    border-radius: 6px;
    padding: 9px 19px;
    transition: all 0.2s ease;
}

.default-btn-secondary:hover {
    background: var(--color-blue-500);
    color: white;
}

/* 商品卡片样式 */
.default-goods-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 文字样式 - 使用Tailwind CSS变量 */
.default-text-primary {
    color: var(--color-blue-500);
}

.default-text-secondary {
    color: var(--color-gray-500);
}

.default-text-muted {
    color: #9ca3af;
}

/* 输入框样式 */
.default-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.default-input:focus {
    border-color: var(--color-blue-500);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-blue-500) 10%, transparent);
    outline: none;
}

/* 导航样式 */
.default-nav {
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

/* 价格样式 - 使用Tailwind配色 */
.default-price {
    color: #3b82f6; /* blue-500 */
    font-weight: 700;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 状态样式 - 使用Tailwind配色 */
.default-status-success {
    color: #10b981; /* emerald-500 */
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
}

.default-status-warning {
    color: #f59e0b; /* amber-500 */
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
}

.default-status-error {
    color: #ef4444; /* red-500 */
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* 表格样式 */
.default-table {
    width: 100%;
    border-collapse: collapse;
}

.default-table th,
.default-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.default-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

/* 分页样式 */
.default-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.default-pagination button {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.default-pagination button:hover {
    background: #f3f4f6;
}

.default-pagination button.active {
    background: #3b82f6; /* blue-500 */
    color: white;
    border-color: #3b82f6; /* blue-500 */
}

/* ========== 头部布局 ========== */
/* 使用flex布局代替grid，更容易控制右侧元素固定位置 */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    position: relative;
}

.header-logo {
    flex: 0 0 auto;
    margin-right: 2rem;
}

/* 用户菜单固定宽度，确保不会因内容变化而改变宽度 */
.header-user {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

/* 搜索框样式调整 */
.header-search {
    flex: 0 0 auto;
    max-width: 300px;
    margin-right: 1rem;
    width: 100%;
    transition: none; /* 防止过渡效果导致的抖动 */
}

/* 全局商品图片样式 */
.goods-item-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
}

/* 主题样式已移除，使用Tailwind CSS原生类 */

/* ========== 下拉菜单样式 ========== */
.group:hover .group-hover\:opacity-100 {
    opacity: 1 !important;
}

.group:hover .group-hover\:visible {
    visibility: visible !important;
}

.group:hover .group-hover\:rotate-180 {
    transform: rotate(180deg) !important;
}

/* 分类下拉菜单 - 修复悬停问题 */
nav .group:hover > div.absolute,
nav .group > div.absolute:hover,
nav .group:focus-within > div.absolute {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* 确保下拉菜单容器有正确的初始状态 */
nav .group > div.absolute {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.15s ease;
    margin-top: 2px;
    padding-top: 2px;
    margin-top: 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

/* 确保下拉菜单在悬停时保持显示 */
nav .group {
    position: relative;
}

/* 箭头旋转动画 */
nav .group:hover .fa-chevron-down {
    transform: rotate(180deg);
}

/* 分类菜单项样式 */
.category-menu-item {
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

.category-menu-item:last-child {
    border-bottom: none;
}

.category-parent-link {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.category-parent-link:hover {
    background-color: #f8fafc;
    color: #3b82f6;
    transform: translateX(2px);
}

.category-children {
    margin-left: 16px;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
    background-color: #fafbfc;
    border-radius: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.category-child-link {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #64748b;
    text-decoration: none;
    padding: 4px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.category-child-link:hover {
    background-color: #e0f2fe;
    color: #0369a1;
    transform: translateX(3px);
}

/* 用户菜单下拉 */
#user-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== 响应式设计 ========== */
@media (min-width: 768px) {
    .price-font {
        font-size: 1.5rem; /* 24px */
    }

    .category-title {
        font-size: 1.75rem;
    }

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

@media (min-width: 1024px) {
    .price-font {
        font-size: 1.75rem; /* 28px */
    }

    .category-title {
        font-size: 2rem;
    }
    
    /* 确保搜索框在大屏幕上有足够的空间 */
    .header-search {
        margin: 0 1rem;
        max-width: 280px;
    }

}

@media (max-width: 768px) {
    .default-card {
        border-radius: 6px;
    }

    .default-btn-primary,
    .default-btn-secondary {
        padding: 8px 16px;
        border-radius: 4px;
    }

    .default-input {
        padding: 8px 10px;
    }

    .header-logo {
        width: 120px;
    }

    /* 移动端搜索框样式 */
    .header-search {
        margin: 0 0.5rem;
        max-width: 100%;
    }

    /* 移动端用户菜单固定宽度 */
    .header-user {
        width: 100px !important;
        flex: 0 0 100px;
    }
    
    /* 移动端导航布局调整 */
    .header-nav {
        height: auto;
        min-height: 64px;
    }
}

/* ========== 工具类 ========== */
.default-shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.default-shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.default-shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* 大价格字体 */
.price-font-large {
    font-family: 'D-DIN-PRO-400-Regular', 'Arial', 'Helvetica', sans-serif;
    font-size: 2rem; /* 32px */
    font-weight: bold;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
    .price-font-large {
        font-size: 2.5rem; /* 40px */
    }
}

/* 小价格字体 */
.price-font-small {
    font-family: 'D-DIN-PRO-400-Regular', 'Arial', 'Helvetica', sans-serif;
    font-size: 0.875rem; /* 14px */
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* 分类标题样式 */
.category-title {
    font-family: 'alimama', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: normal;
    line-height: 1.4;
}

/* 栏目标题样式 */
.section-title {
    font-family: 'alimama', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: normal;
    line-height: 1.4;
}
