<template>
  <div v-if="visible" class="farm-popup-overlay" @click="closePopup">
    <div class="farm-popup" @click.stop>
      <div class="popup-header">
        <h3>{{ farm.name }}</h3>
        <button class="close-btn" @click="closePopup">×</button>
      </div>
      <div class="popup-content">
        <div class="farm-info">
          <div class="info-item">
            <!-- <span class="label">养殖类型：</span>
            <span class="value">{{ farm.type }}</span> -->
          </div>
          <div class="info-item">
            <span class="label">存栏数量：</span>
            <span class="value highlight">{{ farm.livestock.toLocaleString() }} 头</span>
          </div>
          <div class="info-item">
            <span class="label">占地面积：</span>
            <span class="value">{{ farm.area }}</span>
          </div>
          <div class="info-item">
            <span class="label">成立时间：</span>
            <span class="value">{{ farm.established }}</span>
          </div>
          <div class="info-item">
            <span class="label">联系方式：</span>
            <span class="value">{{ farm.contact }}</span>
          </div>
        </div>
        <div class="popup-actions">
          <!-- <button class="action-btn primary">查看详情</button>
          <button class="action-btn secondary">联系养殖场</button> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FarmPopup',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    farm: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ['close'],
  methods: {
    closePopup() {
      this.$emit('close');
    }
  }
};
</script>

<style scoped>
.farm-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.farm-popup {
  background: rgba(15, 25, 45, 0.95);
  border: 2px solid #00d4ff;
  border-radius: 12px;
  padding: 0;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 
    0 0 30px rgba(0, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: popupSlideIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popup-header {
  background: #00d4ff;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 212, 255, 0.3);
}

.popup-header h3 {
  margin: 0;
  color: white;
  font-size: 18px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.popup-content {
  padding: 20px;
}

.farm-info {
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

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

.label {
  color: #a0a8b8;
  font-size: 14px;
  font-weight: 500;
}

.value {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.value.highlight {
  color: #00d4ff;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.popup-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.action-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-btn.primary {
  background: #00d4ff;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.action-btn.secondary {
  background: transparent;
  color: #00d4ff;
  border: 2px solid #00d4ff;
}

.action-btn.secondary:hover {
  background: #00d4ff;
  color: white;
  transform: translateY(-2px);
}
</style>