/* public/css/components.css — Shared Components */

/* === 按鈕 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--primary-glow);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.btn--primary:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn--secondary:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
}

.btn--block {
  width: 100%;
}

.full-width {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* === 輸入框 === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.form-input::placeholder {
  color: var(--text-muted);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input--error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.form-input-wrapper {
  position: relative;
}
.form-input-wrapper .form-input {
  padding-left: 44px;
}
.form-input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}
.form-input-wrapper .input-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.form-input-wrapper .input-toggle:hover {
  color: var(--text-secondary);
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  min-height: 1.2em;
}

/* === 玻璃卡片 === */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* === Toast 通知 === */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease-out;
  max-width: 400px;
}
.toast--success { background: rgba(52, 211, 153, 0.9); }
.toast--error   { background: rgba(248, 113, 113, 0.9); }
.toast--warning { background: rgba(251, 191, 36, 0.9); color: var(--text-inverse); }
.toast--info    { background: rgba(56, 189, 248, 0.9); }

/* === Modal 覆蓋層 === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay .result-container {
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-out;
}

/* === 表單格線 === */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

/* === 圖示按鈕 === */
.btn-icon {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  opacity: 0.7;
}
.btn-icon:hover {
  opacity: 1;
  background: var(--bg-elevated);
  transform: scale(1.15);
}

/* === 操作按鈕列 === */
.action-buttons {
  display: flex;
  gap: 4px;
}

/* === 標籤徽章 === */
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 99px;
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* === 頁面按鈕 === */
.page-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.page-btn:hover:not(:disabled) {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
