/* wwwroot/assets/css/modules/farm-list.css */

/* ============================================
   在线农场列表页样式
   ============================================ */

/* --- 页面头部 --- */
.farm-page-header h4 {
    color: #2d6a4f;
}

/* ========== 固定顶部 ========== */
.farm-list-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    padding: 12px 16px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.header-top {
    display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px;
}
.header-top h4 { margin: 0; font-size: 1.1rem; }
.header-count { font-size: 0.75rem; color: #999; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input-wrap {
    flex: 1; display: flex; align-items: center;
    background: #f5f5f5; border-radius: 20px; padding: 0 14px;
}
.search-input-wrap input {
    flex: 1; border: none; background: transparent;
    padding: 10px 8px; font-size: 0.85rem; outline: none;
}
.search-clear { color: #999; padding: 4px; }
.search-btn {
    background: #198754; color: #fff; border: none;
    border-radius: 20px; padding: 0 18px; font-size: 0.85rem; font-weight: 600;
}
.farm-list-page { padding: 12px 16px; }

/* ========== 内容 ========== */
.farm-list-page { padding: 12px 16px; min-height: 60vh; }
.farm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.empty-state { text-align: center; padding: 60px 0; color: #999; }
.empty-state span { font-size: 3rem; display: block; margin-bottom: 10px; }
.btn-retry {
    display: inline-block; margin-top: 10px;
    padding: 8px 20px; border-radius: 20px;
    background: #198754; color: #fff; text-decoration: none; font-size: 0.85rem;
}

/* ========== 分页 ========== */
.pagination-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 20px 0;
}
.page-btn {
    padding: 6px 12px;
    border-radius: 16px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    font-size: 0.78rem;
}
.page-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}
.page-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    font-size: 0.78rem;
}
.page-num.active {
    background: #198754;
    color: #fff;
}

/* --- 农场卡片网格 --- */
.farm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* --- 单个农场卡片 --- */
.farm-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.farm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: #a5d6a7;
}

/* --- 卡片封面 --- */
.farm-card-cover {
    height: 140px;
    overflow: hidden;
}
.farm-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 卡片头部 --- */
.farm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}
.farm-status {
    font-size: 12px;
    font-weight: 600;
}
.farm-status.online {
    color: #2e7d32;
}
.farm-status.offline {
    color: #999;
}
.farm-cert {
    font-size: 11px;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
}

/* --- 卡片内容 --- */
.farm-card-body {
    padding: 14px;
    flex: 1;
}
.farm-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}
.farm-type {
    font-size: 13px;
    color: #2d6a4f;
    margin-bottom: 4px;
}
.farm-location {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}
.farm-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- 卡片底部 --- */
.farm-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}
.farm-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
}
.farm-arrow {
    color: #ccc;
    font-size: 14px;
}

/* ============================================
   农场详情页样式
   ============================================ */
.farm-detail-header {
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.farm-status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}
.farm-status-badge.online {
    background: #e8f5e9;
    color: #2e7d32;
}
.farm-status-badge.offline {
    background: #f5f5f5;
    color: #999;
}
.device-status {
    padding: 8px 0;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.product-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    overflow: hidden;
    transition: all 0.2s;
}
.product-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-color: #a5d6a7;
}
.product-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}
.product-info {
    padding: 8px 10px;
}
.product-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-price {
    font-size: 14px;
    font-weight: 700;
    color: #e53935;
    margin-top: 2px;
}

/* --- 响应式 --- */
@media (max-width: 576px) {
    .farm-grid {
        grid-template-columns: 1fr;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}