/**
 * 校园二手交易平台 - 自定义样式
 */

/* 全局样式 */
* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
}

/* 行数限制 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 图片加载占位 */
img {
    background-color: #f3f4f6;
}

/* 表单焦点增强 */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 按钮点击效果 */
button:active {
    transform: scale(0.98);
}

/* Flash消息动画 */
.flash-message { animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 商品卡片悬停效果 */
.goods-card { transition: all 0.3s ease; }
.goods-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }

/* 聊天气泡 */
.chat-bubble-self { border-radius: 18px 18px 4px 18px; }
.chat-bubble-other { border-radius: 18px 18px 18px 4px; }

/* 消息气泡（兼容旧版） */
.bubble-left {
    background: white;
    border-radius: 0 12px 12px 12px;
}

.bubble-right {
    background: #3b82f6;
    color: white;
    border-radius: 12px 0 12px 12px;
}

/* 图片轮播 */
.goods-gallery { position: relative; }
.goods-gallery .thumb { cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; }
.goods-gallery .thumb.active { border-color: #3b82f6; }
.goods-gallery .thumb:hover { border-color: #93c5fd; }

/* 搜索联想下拉 */
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 50; max-height: 240px; overflow-y: auto; }
.search-dropdown-item { padding: 10px 16px; cursor: pointer; transition: background 0.15s; }
.search-dropdown-item:hover { background: #f3f4f6; }

/* 星级评分 */
.star-rating { display: inline-flex; gap: 2px; }
.star-rating .star { color: #d1d5db; cursor: pointer; transition: color 0.15s; }
.star-rating .star.active { color: #f59e0b; }
.star-rating .star:hover { color: #fbbf24; }

/* 进度条 */
.progress-bar { height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 1.5; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-yellow { background: #fef3c7; color: #92400e; }
.tag-orange { background: #ffedd5; color: #9a3412; }
.tag-purple { background: #f3e8ff; color: #6b21a8; }

/* 模态框 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 12px; max-width: 600px; width: 90%; max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease-out; }
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 分页 */
.pagination { display: flex; gap: 4px; justify-content: center; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.pagination a:hover { background: #f3f4f6; }
.pagination .active { background: #3b82f6; color: white; border-color: #3b82f6; }

/* 文件上传区域 */
.upload-zone { border: 2px dashed #d1d5db; border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-zone:hover { border-color: #3b82f6; background: #eff6ff; }
.upload-zone.dragover { border-color: #3b82f6; background: #dbeafe; }

/* 图片预览列表 */
.image-preview-list { display: flex; flex-wrap: wrap; gap: 8px; }
.image-preview-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; background: rgba(239,68,68,0.8); color: white; border-radius: 50%; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* 侧边栏 */
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 8px; color: #6b7280; transition: all 0.15s; }
.sidebar-link:hover { background: #f3f4f6; color: #1f2937; }
.sidebar-link.active { background: #eff6ff; color: #2563eb; font-weight: 600; }

/* 订单状态步骤条 */
.order-steps { display: flex; align-items: center; justify-content: space-between; margin: 24px 0; }
.order-step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.order-step .step-dot { width: 32px; height: 32px; border-radius: 50%; background: #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #9ca3af; z-index: 1; }
.order-step.completed .step-dot { background: #10b981; color: white; }
.order-step.current .step-dot { background: #3b82f6; color: white; }
.order-step .step-label { margin-top: 8px; font-size: 12px; color: #9ca3af; }
.order-step.completed .step-label { color: #10b981; }
.order-step.current .step-label { color: #3b82f6; font-weight: 600; }
.order-step::after { content: ''; position: absolute; top: 16px; left: 50%; width: 100%; height: 2px; background: #e5e7eb; }
.order-step:last-child::after { display: none; }
.order-step.completed::after { background: #10b981; }

/* 管理后台表格 */
.admin-table th {
    white-space: nowrap;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 价格标签 */
.price-tag {
    color: #ef4444;
    font-weight: 700;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

/* 响应式 */
@media (max-width: 768px) {
    .goods-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .order-steps { flex-wrap: wrap; gap: 8px; }
    .order-step::after { display: none; }
}
