/**
 * Mayoreo Module - Styles
 *
 * 批发页面样式
 *
 * @package Electro_Child
 * @subpackage Mayoreo
 * @version 2.0.0
 * @since 2025-10-31
 */

/* ========================================
   分类列表容器
   ======================================== */
.category-list-wrapper {
    background-color: #00acfc;
    padding: 10px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
}

/* ========================================
   库存筛选下拉框
   ======================================== */
.stock-select-wrapper {
    margin-bottom: 10px;
    padding: 0 10px;
}

#stock-select {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    margin-bottom: 20px;
    border: 2px solid #fff;
    border-radius: 4px;
    background-color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#stock-select:hover {
    border-color: #05b0ff;
}

#stock-select:focus {
    outline: none;
    border-color: #0099e6;
    box-shadow: 0 0 8px rgba(0, 153, 230, 0.3);
}

/* ========================================
   分类列表项
   ======================================== */
.category-list-item {
    border-bottom: 1px solid #ffffff;
    line-height: 2.5;
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), rgba(255,255,255,0));
    transition: background-color 0.3s ease;
}

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

.category-list-item.active {
    background-color: #05b0ff;
}

.category-list-item a {
    color: #ffffff;
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    transition: background-color 0.3s ease, padding-left 0.3s ease;
}

.category-list-item a:hover {
    background-color: #05b0ff;
    padding-left: 25px;
}

/* 加载提示 */
.category-list-item .loader {
    display: inline-block;
    margin-left: 10px;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   产品列表表格
   ======================================== */
.products-list {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.products-list th,
.products-list td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
}

/* 表头 */
.products-list thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.products-list th {
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* 表格行悬停效果 */
.products-list tbody tr {
    transition: background-color 0.2s ease;
}

.products-list tbody tr:hover {
    background-color: #f5f5f5;
}

/* 图片 */
.products-list img {
    width: auto;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 列宽度 */
.column-number { width: 5%; }
.column-model { width: 10%; }
.column-titular { width: 20%; }
.column-description { width: 15%; }
.column-image { width: 15%; }
.column-stock { width: 10%; }
.column-price { width: 10%; }
.column-add { width: 15%; }

/* 产品标题链接 */
.titular-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.titular-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ========================================
   购物车控件
   ======================================== */
.qty-input,
.add-to-cart-btn {
    height: 40px;
    vertical-align: middle;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.qty-input {
    width: 70px;
    padding: 0 8px;
    border: 1px solid #ced4da;
    text-align: center;
    font-size: 14px;
    margin-right: 5px;
}

.qty-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.add-to-cart-btn {
    cursor: pointer;
    border: none;
    background-color: #007bff;
    color: white;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    min-width: 100px;
}

.add-to-cart-btn:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.add-to-cart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   通知消息
   ======================================== */
.mayoreo-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    min-width: 250px;
    max-width: 400px;
}

.mayoreo-notification--success {
    background-color: #28a745;
    color: #fff;
}

.mayoreo-notification--error {
    background-color: #dc3545;
    color: #fff;
}

/* 错误消息 */
.mayoreo-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* ========================================
   响应式设计 - 平板
   ======================================== */
@media (max-width: 768px) {
    .category-list-item a {
        padding: 15px 15px;
        font-size: 16px;
    }

    #stock-select {
        max-width: 100%;
    }

    .products-list th,
    .products-list td {
        padding: 8px;
        font-size: 14px;
    }

    .column-number,
    .column-model,
    .column-titular,
    .column-description,
    .column-image,
    .column-stock,
    .column-price,
    .column-add {
        width: auto;
    }
}

/* ========================================
   响应式设计 - 手机
   ======================================== */
@media screen and (max-width: 1000px) {
    .products-list,
    .products-list thead,
    .products-list tbody,
    .products-list th,
    .products-list td,
    .products-list tr {
        display: block;
    }

    .products-list thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .products-list tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 4px;
        overflow: hidden;
    }

    .products-list td {
        border: none;
        border-top: 1px solid #ddd;
        position: relative;
        padding-left: 50%;
        text-align: right;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .products-list td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #495057;
    }

    /* 为每个列添加标签 */
    .products-list td:nth-of-type(1):before { content: "#"; }
    .products-list td:nth-of-type(2):before { content: "Model"; }
    .products-list td:nth-of-type(3):before { content: "Titular"; }
    .products-list td:nth-of-type(4):before { content: "GS1"; }
    .products-list td:nth-of-type(5):before { content: "Imagen"; }
    .products-list td:nth-of-type(6):before { content: "Existencia"; }
    .products-list td:nth-of-type(7):before { content: "Precios"; }
    .products-list td:nth-of-type(8):before { content: "Agregar"; }

    /* 移动端优化购物车控件 */
    .qty-input {
        width: 60px;
        margin-right: 5px;
    }

    .add-to-cart-btn {
        min-width: 80px;
        padding: 0 12px;
        font-size: 13px;
    }

    /* 移动端通知位置 */
    .mayoreo-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ========================================
   辅助功能增强
   ======================================== */
.category-list-item a:focus,
.add-to-cart-btn:focus,
.qty-input:focus,
#stock-select:focus {
    outline: 2px solid #0099e6;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .category-list-wrapper,
    .stock-select-wrapper,
    .add-to-cart-btn,
    .qty-input {
        display: none;
    }

    .products-list {
        box-shadow: none;
    }
}
