<template>
  <div class="container">
    <div class="gradient-card">
      <div class="card-header">
        <h1>地表径流计算器</h1>
        <p>评估地表径流量及其环境影响</p>
      </div>

      <div class="card-content">
        <div class="input-section">
          <div class="input-group">
            <label class="label">地表径流 (g/ha/a)</label>
            <input v-model="leakage" placeholder="请输入渗漏量" class="custom-input" />
          </div>

          <div class="info-panel">
            <div class="info-item">
              <i class="fas fa-info-circle"></i>
              <span>当前值: {{ leakage || '0.368' }}</span>
            </div>
            <div class="info-item">
              <i class="fas fa-chart-line"></i>
              <span>建议范围: 0.01 - 0.05</span>
            </div>
          </div>
        </div>

        <div class="button-section">
          <button class="calculate-btn" @click="onCalculate">
            <i class="fas fa-calculator"></i> 计算渗漏量
          </button>
        </div>
      </div>

      <div class="card-footer">
        <p><i class="fas fa-lightbulb"></i> 提示: 输入渗漏量后点击计算按钮获取详细分析</p>
      </div>
    </div>
  </div>
</template>

<script>
import { ref } from 'vue';

export default {
  name: 'LeakageCalculator',
  setup() {
    const leakage = ref('0.368');

    const onCalculate = () => {
      alert(`计算完成！当前渗漏量: ${leakage.value || '0.368'} g/ha/a`);
    };

    return {
      leakage,
      onCalculate
    };
  }
};
</script>

<style scoped>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 20px;
  background-size: 400% 400%;
}

.gradient-card {
  background: linear-gradient(135deg,
      rgba(250, 253, 255, 0.8),
      rgba(137, 223, 252, 0.8));
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  padding: 40px;
  width: 700px; /* 固定宽度 */
  height: 700px; /* 固定高度 */
  backdrop-filter: blur(8px);
  border: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  text-align: center;
  margin-bottom: 30px;
}

.card-header h1 {
  font-size: 2.5rem;
  color: #006064;
  margin-bottom: 10px;
  font-weight: 700;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header p {
  font-size: 1.2rem;
  color: #00838f;
  opacity: 0.9;
}

.input-section {
  margin: 30px 0;
}

.input-group {
  margin-bottom: 25px;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 1.4rem;
  margin-bottom: 15px;
  color: #006064;
}

.custom-input {
  width: 100%;
  padding: 18px 10px;
  border-radius: 12px;
  border: 2px solid #80deea;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.custom-input:focus {
  outline: none;
  border-color: #26c6da;
  box-shadow: 0 0 0 4px rgba(38, 198, 218, 0.3);
}

.info-panel {
  background: rgba(178, 235, 242, 0.4);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1.2rem;
  color: #006064;
}

.info-item i {
  margin-right: 12px;
  font-size: 1.4rem;
  color: #00838f;
}

.button-section {
  margin: 35px 0;
  text-align: center;
  flex-grow: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.calculate-btn {
  background: linear-gradient(to right, #8DF9F0, #26B046);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 20px 40px;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 300px;
  position: relative;
  overflow: hidden;
}

.calculate-btn i {
  margin-right: 12px;
  font-size: 1.6rem;
}

.calculate-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
  background: linear-gradient(to right, #7de8df, #20a03d);
}

.calculate-btn:active {
  transform: translateY(-2px);
}

.card-footer {
  text-align: center;
  font-size: 1.2rem;
  color: #00838f;
  font-style: italic;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 150, 136, 0.2);
}

.card-footer i {
  margin-right: 10px;
}

/* 水波纹效果 */
.calculate-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.calculate-btn:active::after {
  width: 300px;
  height: 300px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .gradient-card {
    padding: 25px;
    width: 100%;
    height: auto;
    min-height: 500px;
  }

  .card-header h1 {
    font-size: 2rem;
  }

  .label {
    font-size: 1.2rem;
  }

  .custom-input {
    padding: 15px;
    font-size: 1.1rem;
  }

  .calculate-btn {
    padding: 16px 30px;
    font-size: 1.3rem;
    min-width: 250px;
  }
}
</style>