/**
 * Volume Calculator Styles
 * 材積自動換算計算器樣式
 */

.volume-calculator {
  max-width: 600px;
  margin: 2rem auto;
  font-family: 'Noto Sans TC', sans-serif;
}

.calculator-container {
  background: #f6f6f6;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #eaeaea;
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #040404;
  font-size: 0.9rem;
}

.calc-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #eaeaea;
  border-radius: 8px;
  font-size: 1rem;
  background-color: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  color: #444444;
}

.calc-input:focus {
  outline: none;
  border-color: #121212;
  box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.1);
}

.calc-input::placeholder {
  color: #717171;
}

.calc-input:invalid {
  border-color: #dc3545;
}

.calc-button {
  background: linear-gradient(135deg, #f6f6f6, #eaeaea);
  color: #040404;
  padding: 1rem 2rem;
  border: 2px solid #eaeaea;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.calc-button:hover {
  background: linear-gradient(135deg, #eaeaea, #d5d5d5);
  border-color: #d5d5d5;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calc-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.results-container {
  margin-top: 2rem;
  background: #f6f6f6;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #eaeaea;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-title {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #040404;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.75rem 0;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eaeaea;
}

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

.result-label {
  font-weight: 600;
  color: #444444;
  font-size: 0.95rem;
}

.result-value {
  font-weight: 700;
  font-size: 1rem;
  color: #717171;
}

.result-value.primary {
  color: #040404;
  font-size: 1.1rem;
  font-weight: 800;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .volume-calculator {
    margin: 1rem;
  }
  
  .calculator-container {
    padding: 1.5rem;
  }
  
  .calc-input {
    padding: 0.65rem;
  }
  
  .calc-button {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }
  
  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .result-value {
    font-size: 1.05rem;
  }
}

/* 暗色模式支援 */
.dark .volume-calculator,
@media (prefers-color-scheme: dark) {
  .calculator-container {
    background: #222222;
    border-color: #3E3E3E;
    color: #B4AFB6;
  }
  
  .input-label {
    color: #fff;
  }
  
  .calc-input {
    background-color: #222222;
    border-color: #3E3E3E;
    color: #B4AFB6;
  }
  
  .calc-input::placeholder {
    color: #B4AFB6;
  }
  
  .calc-input:focus {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
  }
  
  .calc-button {
    background: #fff;
    color: #1c1c1c;
  }
  
  .calc-button:hover {
    background: #f6f6f6;
  }
  
  .results-container {
    background: #222222;
    border-color: #3E3E3E;
  }
  
  .results-title {
    color: #fff;
  }
  
  .result-label {
    color: #B4AFB6;
  }
  
  .result-value {
    color: #B4AFB6;
  }
  
  .result-value.primary {
    color: #fff;
  }
}

/* 無障礙支援 */
.calc-input:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.calc-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* 載入動畫 */
.volume-calculator.loading .calc-button {
  opacity: 0.7;
  cursor: wait;
}

.volume-calculator.loading .calc-button::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}