/* === 認證 UI 樣式 === */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.auth-header h2 {
  margin: 0;
  font-size: 28px;
  color: #0f172a;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}

.form-group input {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}

.error-message {
  padding: 12px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  text-align: center;
}

.submit-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-switch {
  text-align: center;
  padding: 12px 0;
  border-top: 1px solid #e2e8f0;
}

.auth-switch p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.auth-switch button {
  background: none;
  border: none;
  color: #3b82f6;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  text-decoration: underline;
  transition: color 0.2s;
}

.auth-switch button:hover:not(:disabled) {
  color: #2563eb;
}

.auth-switch button:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.guest-mode {
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.guest-btn {
  width: 100%;
  padding: 12px 24px;
  background: #f1f5f9;
  color: #475569;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.guest-btn:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.guest-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* === 用戶資訊顯示 === */

.user-info {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-btn:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.user-icon {
  font-size: 18px;
}

.user-name {
  max-width: 120px;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-width: 200px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-menu-item {
  padding: 12px 16px;
  font-size: 14px;
  text-align: left;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s;
}

.user-menu-item:hover {
  background: #f8fafc;
}

.user-email {
  color: #64748b;
  cursor: default;
  border-bottom: 1px solid #e2e8f0;
}

.user-email:hover {
  background: none;
}

.logout-btn {
  color: #ef4444;
  font-weight: 600;
}

.logout-btn:hover {
  background: #fef2f2;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .auth-card {
    padding: 24px;
    max-width: 95%;
  }

  .auth-header h2 {
    font-size: 24px;
  }

  .user-info {
    top: 10px;
    right: 10px;
  }

  .user-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .user-name {
    max-width: 80px;
  }
}
