/*
 * Micro-interactions 共用樣式檔案
 * 適用於所有專案頁面
 */

/* ===== 重置與基礎設定 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== CSS 變數（配色方案）===== */
:root {
  /* Micro-interactions 配色 - 明亮清新 */
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --accent: #EC4899;
  --success: #10B981;
  --warning: #F59E0B;

  /* 中性色 */
  --bg-primary: #F9FAFB;
  --bg-secondary: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
}

/* ===== Body 基礎樣式 ===== */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  padding: 20px;
}

/* 動態背景圖案 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  animation: drift 15s ease-in-out infinite;
  z-index: 0;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

/* ===== 主容器 ===== */
.login-container,
.main-container,
.page-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 45% 55%;
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 100px rgba(102, 126, 234, 0.2);
  animation: containerAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes containerAppear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ===== 左側品牌區域 ===== */
.brand-section {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 60px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* CSS 動畫圖形 */
.animated-graphic {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.shape:nth-child(1) {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.3);
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.shape:nth-child(2) {
  width: 120px;
  height: 120px;
  background: rgba(236, 72, 153, 0.3);
  top: 60%;
  left: 70%;
  animation-delay: 2s;
}

.shape:nth-child(3) {
  width: 60px;
  height: 60px;
  background: rgba(99, 102, 241, 0.4);
  top: 30%;
  right: 15%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(20px, -20px) scale(1.1);
  }
  50% {
    transform: translate(-15px, 20px) scale(0.9);
  }
  75% {
    transform: translate(15px, 15px) scale(1.05);
  }
}

.logo-animation {
  position: relative;
  z-index: 2;
  text-align: center;
}

.logo-circle {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 30px;
  font-size: 48px;
  font-weight: 700;
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.3);
  animation: pulse 3s ease-in-out infinite;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-circle:hover {
  transform: scale(1.1) rotate(5deg);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
  }
}

.logo-text {
  font-size: 32px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ===== 右側內容區域 ===== */
.login-section,
.content-section,
.page-section {
  background: white;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-header,
.page-header {
  margin-bottom: 40px;
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.login-title,
.page-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.login-title::after,
.page-title::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-title:hover::after,
.page-title:hover::after {
  width: 100%;
}

.login-subtitle,
.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ===== Tab 切換 ===== */
.login-tabs,
.page-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.tab-button {
  flex: 1;
  padding: 14px 24px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'DM Sans', sans-serif;
  position: relative;
  overflow: hidden;
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.tab-button:hover::before {
  width: 300px;
  height: 300px;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-color: transparent;
  box-shadow:
    0 4px 15px rgba(99, 102, 241, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.tab-button:active {
  transform: translateY(0) scale(0.98);
}

/* ===== 表單樣式 ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--primary-light);
  background: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  background: white;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.1),
    0 4px 12px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

/* ===== 按鈕樣式 ===== */
.submit-button,
.btn-primary {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  box-shadow:
    0 4px 15px rgba(99, 102, 241, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.submit-button::before,
.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.submit-button:hover,
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow:
    0 10px 30px rgba(99, 102, 241, 0.5),
    0 5px 15px rgba(0, 0, 0, 0.1);
}

.submit-button:hover::before,
.btn-primary:hover::before {
  width: 400px;
  height: 400px;
}

.submit-button:active,
.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 18px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* ===== 成功/錯誤訊息 ===== */
.success-message,
.error-message,
.info-message {
  display: none;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  margin-bottom: 20px;
  font-weight: 600;
  animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-message {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.error-message {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.info-message {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

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

.success-message.show,
.error-message.show,
.info-message.show {
  display: flex;
  align-items: center;
  gap: 10px;
}

.success-icon,
.error-icon,
.info-icon {
  animation: checkmark 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkmark {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  50% {
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* ===== 分隔線 ===== */
.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider::before {
  margin-right: 16px;
}

.divider::after {
  margin-left: 16px;
}

/* ===== 連結樣式 ===== */
.forgot-link,
.text-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
}

.forgot-link::after,
.text-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.forgot-link:hover::after,
.text-link:hover::after {
  width: 100%;
}

.forgot-link:hover,
.text-link:hover {
  color: var(--primary-dark);
}

/* ===== 響應式設計 ===== */
@media (max-width: 968px) {
  .login-container,
  .main-container,
  .page-container {
    grid-template-columns: 1fr;
    max-width: 500px;
  }

  .brand-section {
    min-height: 200px;
    padding: 40px 30px;
  }

  .login-section,
  .content-section,
  .page-section {
    padding: 40px 30px;
  }

  .logo-circle {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }

  .logo-text {
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .login-container,
  .main-container,
  .page-container {
    border-radius: 16px;
  }

  .login-section,
  .content-section,
  .page-section {
    padding: 30px 20px;
  }

  .login-title,
  .page-title {
    font-size: 24px;
  }
}