/**
 * 公共组件样式 (Common Components)
 * @version 2.0.0
 * @description 面包屑、分页器、页面横幅等公共组件
 * @updated 2026-01-05
 */

/* ============================================
   页面横幅 (Page Banner)
   ============================================ */
.page-banner {
    width: 100%;
    overflow: hidden;
}

.page-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   面包屑导航 (Breadcrumb)
   ============================================ */
.breadcrumb {
    background: #f8f9fa;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
}

.breadcrumb__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb__icon {
    width: 18px;
    height: 18px;
    stroke: var(--color-primary);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.breadcrumb__text {
    font-size: 14px;
    color: var(--color-text-light);
}

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

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

/* ============================================
   分页器 (Pagination)
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination__item:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination__item.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.pagination__item--text {
    font-size: 13px;
    padding: 0 16px;
}

.pagination__item svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.pagination__current {
    font-size: 13px;
    color: var(--color-text-light);
    padding: 0 8px;
}

/* ============================================
   空状态 (Empty State)
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.empty-state__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    stroke: var(--color-text-light);
    stroke-width: 1.5;
    fill: none;
}

.empty-state p {
    font-size: 15px;
    color: var(--color-text-light);
    margin: 0;
}

/* ============================================
   加载状态 (Loading State)
   ============================================ */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   标签 (Tags)
   ============================================ */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-bg-light, #f8f9fa);
    border-radius: 20px;
    font-size: 13px;
    color: var(--color-text-light);
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--color-primary);
    color: white;
}

/* ============================================
   消息提示 (Message/Alert)
   ============================================ */
.message {
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.message--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message--warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.message--info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   返回顶部按钮 (Back to Top)
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(232, 149, 19, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(232, 149, 19, 0.4);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ============================================
   遮罩层 (Overlay)
   ============================================ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   模态框 (Modal)
   ============================================ */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.is-active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal__header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal__close:hover {
    background: var(--color-bg-light);
}

.modal__close svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-light);
    stroke-width: 2;
    fill: none;
}

.modal__body {
    padding: 24px;
}

.modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================
   表单公共样式 (Form Common)
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.form-label .required {
    color: #e74c3c;
    margin-left: 4px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--color-text);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(232, 149, 19, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-lighter, #999);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   页面主体容器 (Page Main Container)
   ============================================ */
.page-main {
    padding: 40px 0 60px;
    background: #f5f5f5;
}

.page-main__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 30px;
}

/* 内容区域 */
.page-content {
    flex: 1;
    min-width: 0;
}

/* ============================================
   产品列表网格 (Products List Grid)
   ============================================ */
.products-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

/* ============================================
   产品卡片 (Product Card)
   ============================================ */
.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-card__image {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    aspect-ratio: 1/1;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-card__image img {
    transform: scale(1.05);
}

.product-card__body {
    padding: 16px 20px;
    text-align: center;
}

.product-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
    padding-bottom: 12px;
}

.product-card__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), #f59e0b);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.product-card:hover .product-card__title::after {
    width: 60%;
}

.product-card__actions {
    display: flex;
    border-top: 1px solid #f0f0f0;
}

.product-card__btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-light);
    transition: all 0.3s ease;
    border-right: 1px solid #f0f0f0;
}

.product-card__btn:last-child {
    border-right: none;
}

.product-card__btn:hover {
    color: var(--color-primary);
    background: rgba(232, 149, 19, 0.05);
}

.product-card__btn--primary {
    color: var(--color-primary);
    font-weight: 600;
}
