/* =========================================
   个人中心 - 现代化布局
   ========================================= */

.profile-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 顶部用户资料卡片 (Hero) */
.profile-hero {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(46, 125, 50, 0.95) 100%), url('../images/1.png') center/cover no-repeat;
  background-blend-mode: overlay;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(76, 175, 80, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.hero-user-info {
  display: flex;
  align-items: center;
  gap: 30px;
}

.hero-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  background-image: url('../images/avatar.png');
  background-size: cover;
}

.hero-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-name {
  font-size: 28px;
  font-weight: 900;
  color: white;
  letter-spacing: 1px;
}

.hero-badge {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.hero-bio {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero-bio span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  padding-right: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: white;
}

.stat-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

/* 主体分栏区 */
.profile-main {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* 左侧菜单 */
.profile-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: 16px;
  padding: 20px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  position: sticky;
  top: 90px;
}

.menu-group {
  margin-bottom: 20px;
}

.menu-group:last-child {
  margin-bottom: 0;
}

.menu-title {
  font-size: 13px;
  color: #999;
  margin: 0 12px 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.menu-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.menu-item:hover {
  background: #f9f9f9;
  color: var(--text-primary);
}

.menu-item.active {
  background: rgba(76, 175, 80, 0.08);
  color: var(--primary-color);
  font-weight: bold;
}

.menu-item.danger:hover {
  background: #FFEBEE;
  color: #E53935;
}

/* 右侧内容区 */
.profile-content {
  flex: 1;
  min-width: 0;
}

.tab-panel {
  display: none;
  background: var(--white);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  animation: fadeIn 0.3s ease;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.panel-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title i {
  color: var(--primary-color);
}

/* 卡片列表通用样式 */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* =========================================
   设备卡片样式
   ========================================= */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.device-card {
  border: 1px solid #eee;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s;
}

.device-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 25px rgba(0,0,0,0.05);
}

.device-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.device-name {
  font-weight: bold;
  font-size: 16px;
  color: var(--text-primary);
}

.device-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: bold;
}

.status-online {
  background: #E8F5E9;
  color: #4CAF50;
}

.status-offline {
  background: #EEEEEE;
  color: #757575;
}

.status-working {
  background: #E3F2FD;
  color: #2196F3;
}

.device-body {
  padding: 20px;
  display: flex;
  gap: 16px;
}

.device-img {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
  background: #f9f9f9;
}

.device-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.device-meta {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.device-meta span {
  color: var(--text-primary);
  font-weight: 500;
}

.device-actions {
  padding: 12px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* =========================================
   订单卡片样式
   ========================================= */
.order-tabs {
  display: flex;
  gap: 30px;
  margin-bottom: 24px;
}

.order-tab {
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  padding-bottom: 8px;
}

.order-tab.active {
  color: var(--text-primary);
  font-weight: bold;
}

.order-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px;
}

.order-card {
  border: 1px solid #eee;
  border-radius: 16px;
  overflow: hidden;
}

.order-header {
  background: #fafafa;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid #eee;
}

.order-body {
  padding: 20px;
  display: flex;
  gap: 20px;
}

.order-img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #eee;
}

.order-info {
  flex: 1;
}

.order-title {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.order-sku {
  font-size: 13px;
  color: var(--text-secondary);
}

.order-price {
  text-align: right;
  font-weight: bold;
  font-size: 16px;
}

.order-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: normal;
}

.order-footer {
  padding: 16px 20px;
  border-top: 1px dashed #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-logistics {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logistics-hl {
  color: #2196F3;
}

/* =========================================
   历史课程样式
   ========================================= */
.history-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  border: 1px solid #eee;
  border-radius: 16px;
  transition: all 0.2s;
}

.history-card:hover {
  border-color: var(--primary-color);
  background: #fcfcfc;
}

.history-img-wrap {
  width: 180px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.history-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.history-card:hover .play-overlay {
  opacity: 1;
}

.play-overlay i {
  color: white;
  font-size: 32px;
}

.history-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.history-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.history-progress-wrap {
  display: flex;
  align-items: center;
  gap: 15px;
}

.h-progress-bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.h-progress-fill {
  height: 100%;
  background: var(--primary-color);
}

/* 按钮通用小尺寸 */
.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary-sm {
  background: var(--primary-color);
  color: white;
}

.btn-primary-sm:hover {
  background: var(--primary-dark);
}

.btn-outline-sm {
  background: white;
  border-color: #ddd;
  color: var(--text-primary);
}

.btn-outline-sm:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* =========================================
   新增卡片及客服弹窗样式
   ========================================= */

/* 发帖卡片 */
.post-card {
  border: 1px solid #eee;
  border-radius: 16px;
  padding: 20px;
  background: var(--white);
  transition: all 0.2s;
}

.post-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.post-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}

.post-content {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.post-stats {
  display: flex;
  gap: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.post-stats span {
  cursor: pointer;
  transition: color 0.2s;
}

.post-stats span:hover {
  color: var(--primary-color);
}

/* 收藏卡片 */
.fav-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 12px;
  background: var(--white);
  transition: all 0.2s;
}

.fav-card:hover {
  border-color: var(--primary-color);
}

.fav-img {
  width: 120px;
  height: 90px;
  border-radius: 8px;
  object-fit: cover;
}

.fav-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fav-title {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* 客服弹窗 */
.chat-modal {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 360px;
  height: 520px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid #eee;
}

.chat-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.chat-close {
  cursor: pointer;
  font-size: 20px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-close:hover {
  opacity: 1;
}

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f9fbf9;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.chat-msg.left {
  align-self: flex-start;
}

.chat-msg.right {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  color: var(--text-primary);
}

.chat-msg.left .chat-bubble {
  border-top-left-radius: 4px;
}

.chat-msg.right .chat-bubble {
  background: #E8F5E9;
  color: #1B5E20;
  border-top-right-radius: 4px;
}

.chat-footer {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  background: white;
}

.chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary-color);
}

.chat-send {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-send:hover {
  background: var(--primary-dark);
}

/* 响应式 */
@media (max-width: 1024px) {
  .profile-main {
    flex-direction: column;
  }
  .profile-sidebar {
    width: 100%;
    position: static;
  }
}

@media (max-width: 768px) {
  .hero-user-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .hero-avatar {
    margin-top: -60px;
  }
  .hero-stats {
    justify-content: center;
  }
  .profile-hero-content {
    flex-direction: column;
    align-items: center;
  }
  .device-grid {
    grid-template-columns: 1fr;
  }
  .history-card {
    flex-direction: column;
  }
  .history-img-wrap {
    width: 100%;
    height: 180px;
  }
}