/* ========================================================
   PHP Shop Mall - Base Stylesheet
   Designed to match 财小神 1:1 Red-White E-Commerce Theme
======================================================== */

:root {
    --primary-red: #d21e20;
    --hover-red: #e4393c;
    --dark-red: #b91517;
    --text-color: #333333;
    --text-muted: #737373;
    --border-color: #e5e5e5;
    --bg-light: #f5f5f5;
    --container-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #ffffff;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-red);
}

ul, ol {
    list-style: none;
}

img {
    border: none;
    vertical-align: middle;
}

input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.container {
    width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
}

.clearfix::after, .clearfix::before {
    content: "";
    display: table;
}

.clearfix::after {
    clear: both;
}

.pull-left { float: left; }
.pull-right { float: right; }

/* ---------------- 顶部快捷栏 (30px) ---------------- */
.site-topbar {
    height: 30px;
    line-height: 30px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #eeeeee;
    font-size: 12px;
    color: var(--text-muted);
}

.site-topbar a {
    color: var(--text-muted);
}

.site-topbar a:hover {
    color: var(--primary-red);
}

.user-state .welcome-txt {
    color: var(--primary-red);
}

.user-state .user-nickname {
    font-weight: bold;
    color: var(--primary-red);
    margin-right: 8px;
}

.user-state .top-login-btn {
    color: var(--primary-red);
    font-weight: bold;
    margin-right: 12px;
}

.user-state .top-reg-btn {
    color: var(--text-muted);
}

.top-links .sep {
    color: #dddddd;
    margin: 0 8px;
}

.top-cart-link {
    color: var(--primary-red) !important;
    font-weight: bold;
}

.cart-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: var(--primary-red);
    color: #ffffff;
    font-size: 11px;
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 2px;
}

/* ---------------- 头部搜索与 Logo 区 ---------------- */
.site-header {
    padding: 24px 0 20px 0;
    background: #ffffff;
}

.header-logo {
    float: left;
    width: 280px;
}

.site-logo-img {
    height: 52px;
    max-width: 260px;
    object-fit: contain;
    display: block;
    margin-top: -2px;
}

.logo-box {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.logo-icon {
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: linear-gradient(135deg, #ff4d4f 0%, #d21e20 100%);
    color: #ffffff;
    font-size: 26px;
    font-weight: bold;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(210, 30, 32, 0.3);
    margin-right: 12px;
}

.logo-text .main-title {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #222222;
    letter-spacing: 1px;
    line-height: 1.2;
}

.logo-text .sub-title {
    display: block;
    font-size: 10px;
    color: #888888;
    letter-spacing: 0.5px;
}

.header-search {
    float: left;
    width: 580px;
    margin-left: 50px;
    margin-top: 4px;
}

.search-form {
    display: flex;
    position: relative;
}

.search-input {
    flex: 1;
    height: 40px;
    border: 2px solid var(--primary-red);
    padding: 0 16px;
    font-size: 14px;
    border-right: none;
    border-radius: 2px 0 0 2px;
}

.search-btn {
    width: 90px;
    height: 40px;
    background-color: var(--primary-red);
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 0 2px 2px 0;
    transition: background-color 0.2s;
}

.search-btn:hover {
    background-color: var(--hover-red);
}

.hot-search-tags {
    margin-top: 8px;
    font-size: 12px;
    color: #999999;
}

.hot-search-tags .hot-item {
    color: #666666;
    margin-right: 12px;
}

.hot-search-tags .hot-item:hover {
    color: var(--primary-red);
}

.header-qrcode {
    float: right;
    width: 180px;
    text-align: right;
}

.qr-box {
    display: inline-flex;
    align-items: center;
    background: #fafafa;
    border: 1px solid #eeeeee;
    padding: 6px 10px;
    border-radius: 4px;
}

.qr-img-placeholder {
    font-size: 28px;
    margin-right: 8px;
}

.qr-text {
    font-size: 12px;
    line-height: 1.3;
    color: #666666;
    text-align: left;
}

/* ---------------- 红色主导航条 (底色 #d21e20) ---------------- */
.site-nav {
    height: 42px;
    background-color: var(--primary-red);
    border-bottom: 2px solid var(--dark-red);
    position: relative;
    z-index: 100;
}

.category-nav-box {
    float: left;
    width: 210px;
    position: relative;
}

.category-nav-title {
    height: 42px;
    line-height: 42px;
    background-color: var(--dark-red);
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.category-dropdown-menu {
    position: absolute;
    top: 42px;
    left: 0;
    width: 210px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
    border-top: none;
    z-index: 999;
}

.category-nav-box.hover-trigger .category-dropdown-menu {
    display: none;
}

.category-nav-box.hover-trigger:hover .category-dropdown-menu {
    display: block;
}

.cat-item {
    position: relative;
    border-bottom: 1px dashed #efefef;
}

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

.cat-link-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    transition: all 0.2s;
}

.cat-name-lvl1 {
    font-size: 14px;
    color: #333333;
}

.cat-arrow {
    color: #999999;
    font-size: 12px;
}

.cat-item:hover {
    background: #fbfbfb;
}

.cat-item:hover .cat-name-lvl1 {
    color: var(--primary-red);
    font-weight: bold;
}

/* 级联滑出的二、三级分类抽屉 */
.cat-sub-panel {
    display: none;
    position: absolute;
    left: 209px;
    top: 0;
    width: 600px;
    min-height: 280px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.12);
    padding: 16px 20px;
    z-index: 1000;
}

.cat-item:hover .cat-sub-panel {
    display: block;
}

.cat-lvl2-row {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f2f2f2;
}

.cat-lvl2-title {
    float: left;
    width: 90px;
    font-weight: bold;
    color: var(--primary-red);
    font-size: 13px;
    text-align: right;
    padding-right: 12px;
}

.cat-lvl2-title a {
    color: var(--primary-red);
}

.cat-lvl3-items {
    float: left;
    width: 470px;
}

.cat-lvl3-items a {
    display: inline-block;
    margin-right: 16px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #666666;
}

.cat-lvl3-items a:hover {
    color: var(--primary-red);
}

/* 横向主菜单 */
.main-menu-list {
    float: left;
    margin-left: 20px;
}

.main-menu-list li {
    float: left;
}

.main-menu-list li a {
    display: block;
    height: 42px;
    line-height: 42px;
    padding: 0 24px;
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.main-menu-list li:hover a, .main-menu-list li.active a {
    background-color: var(--dark-red);
}

/* ---------------- 通用底部组件 ---------------- */
.site-footer {
    background: #f8f8f8;
    border-top: 1px solid #eaeaea;
    margin-top: 40px;
}

.footer-service {
    padding: 30px 0;
    border-bottom: 1px solid #eaeaea;
}

.service-item {
    float: left;
    width: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-icon {
    width: 44px;
    height: 44px;
    line-height: 44px;
    text-align: center;
    background: var(--primary-red);
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    border-radius: 50%;
    margin-right: 12px;
}

.service-text h4 {
    font-size: 15px;
    color: #333333;
    margin-bottom: 2px;
}

.service-text p {
    font-size: 12px;
    color: #888888;
}

.footer-info {
    padding: 24px 0 32px 0;
    text-align: center;
    font-size: 12px;
    color: #666666;
    line-height: 1.8;
}

.footer-links a {
    color: #666666;
}

.footer-links .sep {
    margin: 0 10px;
    color: #cccccc;
}

.contact-info a {
    color: #666666;
}

/* ---------------- 悬浮工具条 ---------------- */
.floating-toolbar {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 9999;
}

.float-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 11px;
    color: #555555;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.float-item:hover {
    background: var(--primary-red);
    color: #ffffff;
    border-color: var(--primary-red);
}

.float-item .icon {
    font-size: 16px;
}

.float-cart .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary-red);
    color: #ffffff;
    font-size: 10px;
    height: 16px;
    min-width: 16px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    padding: 0 3px;
}

.float-item:hover .badge {
    background: #ffffff;
    color: var(--primary-red);
}

/* ---------------- 通用弹窗 Modal ---------------- */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-dialog {
    background: #ffffff;
    width: 520px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
}

.modal-header {
    background: #f7f7f7;
    padding: 14px 20px;
    border-bottom: 1px solid #eaeaea;
}

.modal-header h3 {
    float: left;
    font-size: 16px;
    color: #333333;
}

.modal-header .close-btn {
    float: right;
    font-size: 22px;
    cursor: pointer;
    color: #888888;
}

.modal-body {
    padding: 20px;
}

.form-row {
    margin-bottom: 14px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #444444;
}

.modal-input {
    width: 100%;
    height: 36px;
    border: 1px solid #cccccc;
    border-radius: 3px;
    padding: 0 10px;
}

.modal-footer {
    text-align: right;
    margin-top: 20px;
}

.modal-footer button {
    padding: 8px 20px;
    border-radius: 3px;
    border: none;
    font-size: 13px;
    cursor: pointer;
}

.btn-cancel {
    background: #e0e0e0;
    color: #555555;
    margin-right: 10px;
}

.btn-confirm {
    background: var(--primary-red);
    color: #ffffff;
}

/* ---------------- 通用分页组件 ---------------- */
.pagination-bar, .admin-pagination {
    text-align: center;
    margin: 30px 0;
}

.page-num, .page-link {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #dddddd;
    margin: 0 4px;
    color: #555555;
    border-radius: 2px;
}

.page-num.active, .page-link.active {
    background: var(--primary-red);
    color: #ffffff;
    border-color: var(--primary-red);
}


/* 商家入驻导航角标与主菜单微调 */
.main-menu-list li a {
    padding: 0 16px;
}
.nav-merchant-link {
    position: relative;
}
.nav-hot-badge {
    display: inline-block;
    background: #facc15;
    color: #991b1b;
    font-size: 11px;
    font-weight: 800;
    line-height: 14px;
    padding: 1px 5px;
    border-radius: 8px;
    vertical-align: middle;
    margin-left: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
