* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: '微軟正黑體', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background-color: #2c3e50;
  color: white;
  padding: 20px;
  text-align: center;
  margin-bottom: 30px;
}

/* 品牌列：logo + 標題並排 */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-logo {
  height: 48px;
  width: auto;
  background-color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brand-text {
  text-align: left;
}

header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

header p {
  font-size: 14px;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .brand {
    gap: 12px;
  }

  .brand-logo {
    height: 36px;
  }

  header h1 {
    font-size: 20px;
  }
}

/* 按鈕 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.3s;
  margin: 5px;
}

.btn:hover {
  background-color: #2980b9;
}

.btn-success {
  background-color: #27ae60;
}

.btn-success:hover {
  background-color: #229954;
}

.btn-danger {
  background-color: #e74c3c;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

table thead {
  background-color: #34495e;
  color: white;
}

table th {
  padding: 15px;
  text-align: left;
  font-weight: bold;
}

table td {
  padding: 12px 15px;
  border-bottom: 1px solid #ecf0f1;
}

table tbody tr:hover {
  background-color: #f9f9f9;
}

.table-expandable tbody tr {
  cursor: pointer;
}

.table-expandable .expand-row {
  display: none;
}

.table-expandable .expand-row.show {
  display: table-row;
}

.expand-content {
  padding: 20px;
  background-color: #f9f9f9;
}

/* 表單 */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-row.full {
  grid-template-columns: 1fr;
}

/* 卡片 */
.card {
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  margin-bottom: 15px;
  color: #2c3e50;
  font-size: 20px;
}

/* 警告和訊息 */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 導航 */
.navbar {
  background-color: #2c3e50;
  padding: 10px 20px;
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.navbar a {
  color: white;
  text-decoration: none;
  padding: 10px 15px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.navbar a:hover {
  background-color: #34495e;
}

.navbar a.active {
  background-color: #3498db;
}

/* 計算結果顯示 */
.calculation-display {
  background-color: #ecf0f1;
  padding: 15px;
  border-radius: 4px;
  margin-top: 10px;
}

.calculation-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.calculation-row strong {
  font-weight: bold;
}

.calculation-total {
  border-top: 2px solid #34495e;
  padding-top: 8px;
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  table th,
  table td {
    padding: 8px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 12px;
  }
}

/* 加載動畫 */
.loading {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
}

.spinner {
  border: 3px solid #ecf0f1;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

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