/* 👥 创建群聊页面样式 */

/* CSS变量定义 */
page {
  --primary-color: #007AFF;
  --primary-light: #5AC8FA;
  --primary-dark: #0051D5;
  --success-color: #34C759;
  --background-color: #F2F2F7;
  --surface-color: #FFFFFF;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --border-color: #E5E5EA;
  --shadow-light: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  --radius-small: 8rpx;
  --radius-medium: 12rpx;
  --radius-large: 20rpx;
}

/* 🌙 深色模式支持 */
@media (prefers-color-scheme: dark) {
  page {
    --primary-color: #0A84FF;
    --primary-light: #64D2FF;
    --primary-dark: #0056CC;
    --success-color: #30D158;
    --background-color: #000000;
    --surface-color: #1C1C1E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --text-tertiary: #48484A;
    --border-color: #38383A;
    --shadow-light: 0 1rpx 3rpx rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4rpx 12rpx rgba(0, 0, 0, 0.4);
  }
}

.create-group-container {
  height: 100vh;
  background: var(--background-color);
  display: flex;
  flex-direction: column;
}

/* 🎨 自定义导航栏 */
.custom-navbar {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  box-shadow: var(--shadow-medium);
  z-index: 1000;
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32rpx;
}

.navbar-left, .navbar-right {
  width: 120rpx;
  height: 80rpx;
  display: flex;
  align-items: center;
  border-radius: var(--radius-medium);
  transition: all 0.3s ease;
}

.navbar-left {
  justify-content: flex-start;
}

.navbar-right {
  justify-content: flex-end;
}

.navbar-left:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

.back-icon {
  font-size: 48rpx;
  color: white;
  font-weight: 300;
}

.navbar-title {
  flex: 1;
  text-align: center;
}

.title-text {
  font-size: 36rpx;
  font-weight: 600;
  color: white;
}

.create-text {
  font-size: 32rpx;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  transition: all 0.3s ease;
}

.create-text.active {
  color: white;
}

.create-text:active {
  transform: scale(0.95);
}

/* 🎨 页面内容 */
.page-content {
  flex: 1;
  padding: 32rpx;
}

/* 🎨 群信息设置 */
.group-info-section {
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  padding: 32rpx;
  margin-bottom: 32rpx;
  border: 1rpx solid var(--border-color);
  box-shadow: var(--shadow-light);
}

.group-avatar-setting {
  display: flex;
  justify-content: center;
  margin-bottom: 32rpx;
}

.avatar-container {
  width: 160rpx;
  height: 160rpx;
  border-radius: var(--radius-large);
  overflow: hidden;
  border: 2rpx solid var(--border-color);
  transition: all 0.3s ease;
}

.avatar-container:active {
  transform: scale(0.95);
}

.group-avatar {
  width: 100%;
  height: 100%;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--background-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8rpx;
}

.avatar-icon {
  font-size: 48rpx;
  color: var(--text-secondary);
}

.avatar-text {
  font-size: 24rpx;
  color: var(--text-secondary);
}

.group-name-setting,
.group-desc-setting {
  margin-bottom: 24rpx;
}

.group-desc-setting {
  margin-bottom: 0;
}

.setting-label {
  display: flex;
  align-items: center;
  margin-bottom: 16rpx;
}

.label-text {
  font-size: 28rpx;
  font-weight: 500;
  color: var(--text-primary);
}

.label-required {
  font-size: 28rpx;
  color: #FF3B30;
  margin-left: 8rpx;
}

.group-name-input,
.group-desc-input {
  width: 100%;
  padding: 24rpx;
  border: 1rpx solid var(--border-color);
  border-radius: var(--radius-small);
  font-size: 30rpx;
  color: var(--text-primary);
  background: var(--background-color);
  transition: all 0.3s ease;
}

.group-name-input:focus,
.group-desc-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.1);
}

.group-desc-input {
  min-height: 120rpx;
  resize: none;
}

.input-counter {
  display: flex;
  justify-content: flex-end;
  margin-top: 8rpx;
}

.counter-text {
  font-size: 24rpx;
  color: var(--text-tertiary);
}

/* 🎨 成员选择 */
.member-selection-section {
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  padding: 32rpx;
  margin-bottom: 32rpx;
  border: 1rpx solid var(--border-color);
  box-shadow: var(--shadow-light);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: 600;
  color: var(--text-primary);
}

.member-count {
  font-size: 26rpx;
  color: var(--text-secondary);
}

.search-container {
  margin-bottom: 24rpx;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--background-color);
  border: 1rpx solid var(--border-color);
  border-radius: var(--radius-small);
  padding: 0 24rpx;
  transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.1);
}

.search-icon {
  font-size: 28rpx;
  color: var(--text-secondary);
  margin-right: 16rpx;
}

.search-input {
  flex: 1;
  height: 80rpx;
  font-size: 28rpx;
  color: var(--text-primary);
}

.clear-search {
  width: 48rpx;
  height: 48rpx;
  border-radius: 24rpx;
  background: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.clear-search:active {
  transform: scale(0.9);
}

.clear-icon {
  font-size: 24rpx;
  color: white;
}

/* 🎨 已选成员 */
.selected-members {
  display: flex;
  flex-wrap: wrap;
  gap: 16rpx;
  margin-bottom: 24rpx;
  padding: 24rpx;
  background: var(--background-color);
  border-radius: var(--radius-small);
  border: 1rpx solid var(--border-color);
}

.selected-member-item {
  display: flex;
  align-items: center;
  background: var(--primary-color);
  border-radius: 32rpx;
  padding: 8rpx 16rpx 8rpx 8rpx;
  transition: all 0.3s ease;
}

.selected-member-item:active {
  transform: scale(0.95);
}

.selected-avatar {
  width: 48rpx;
  height: 48rpx;
  border-radius: 24rpx;
  margin-right: 12rpx;
}

.selected-name {
  font-size: 26rpx;
  color: white;
  margin-right: 12rpx;
  max-width: 120rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-btn {
  width: 32rpx;
  height: 32rpx;
  border-radius: 16rpx;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-icon {
  font-size: 20rpx;
  color: white;
}

/* 🎨 好友列表 */
.friends-list {
  max-height: 600rpx;
  overflow-y: auto;
}

.friend-item {
  display: flex;
  align-items: center;
  padding: 24rpx 0;
  border-bottom: 1rpx solid var(--border-color);
  transition: all 0.3s ease;
}

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

.friend-item:active {
  background: var(--background-color);
}

.friend-item.selected {
  background: rgba(0, 122, 255, 0.05);
}

.friend-avatar-container {
  position: relative;
  margin-right: 24rpx;
}

.friend-avatar {
  width: 80rpx;
  height: 80rpx;
  border-radius: 40rpx;
}

.selection-indicator {
  position: absolute;
  top: -8rpx;
  right: -8rpx;
  width: 40rpx;
  height: 40rpx;
  border-radius: 20rpx;
  border: 2rpx solid var(--surface-color);
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.selection-indicator.selected {
  background: var(--success-color);
}

.indicator-icon {
  font-size: 24rpx;
  color: white;
  font-weight: bold;
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-size: 30rpx;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  margin-bottom: 8rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-status {
  font-size: 26rpx;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 🎨 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80rpx 40rpx;
  text-align: center;
}

.empty-icon {
  font-size: 120rpx;
  margin-bottom: 24rpx;
  opacity: 0.5;
}

.empty-text {
  font-size: 28rpx;
  color: var(--text-secondary);
}

/* 🎨 群设置 */
.group-settings-section {
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  padding: 32rpx;
  border: 1rpx solid var(--border-color);
  box-shadow: var(--shadow-light);
}

.group-settings-section .section-title {
  margin-bottom: 24rpx;
}

.setting-items {
  border-radius: var(--radius-small);
  overflow: hidden;
  border: 1rpx solid var(--border-color);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32rpx;
  border-bottom: 1rpx solid var(--border-color);
  background: var(--background-color);
  transition: all 0.2s ease;
}

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

.setting-item:active {
  background: var(--border-color);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 30rpx;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  margin-bottom: 8rpx;
}

.item-desc {
  font-size: 26rpx;
  color: var(--text-secondary);
  line-height: 1.4;
}

.setting-switch {
  transform: scale(0.8);
}

/* 🎨 加载状态 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  background: var(--surface-color);
  border-radius: var(--radius-medium);
  padding: 48rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24rpx;
  box-shadow: var(--shadow-medium);
}

.loading-spinner {
  width: 60rpx;
  height: 60rpx;
  border: 4rpx solid var(--border-color);
  border-top: 4rpx solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 28rpx;
  color: var(--text-primary);
  font-weight: 500;
}

/* 📱 响应式设计 */
@media screen and (max-width: 375px) {
  .page-content {
    padding: 24rpx;
  }
  
  .group-info-section,
  .member-selection-section,
  .group-settings-section {
    padding: 24rpx;
    margin-bottom: 24rpx;
  }
  
  .avatar-container {
    width: 120rpx;
    height: 120rpx;
  }
  
  .friend-avatar {
    width: 64rpx;
    height: 64rpx;
    border-radius: 32rpx;
  }
  
  .selection-indicator {
    width: 32rpx;
    height: 32rpx;
    border-radius: 16rpx;
  }
}

@media screen and (min-width: 414px) {
  .page-content {
    padding: 40rpx;
  }
  
  .group-info-section,
  .member-selection-section,
  .group-settings-section {
    padding: 40rpx;
    margin-bottom: 40rpx;
  }
  
  .avatar-container {
    width: 180rpx;
    height: 180rpx;
  }
  
  .friend-avatar {
    width: 96rpx;
    height: 96rpx;
    border-radius: 48rpx;
  }
}
