/**
 * QiuMo OAuth Server 样式文件 - 重构版
 *
 * 全新的用户中心设计
 * 使用主题变量但不依赖主题类名
 *
 * @package QiuMo_OAuth_Server
 * @since 2.0.0
 */

/* ========================================
   1. 容器和布局
   ======================================== */

.qmos-apps-container {
  width: 100%;
  padding: 0;
}

/* 顶部工具栏 */
.qmos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  margin-bottom: 24px;
  background: var(--main-bg-color, #fff);
  border-radius: var(--main-radius, 8px);
  box-shadow: 0 2px 8px var(--main-shadow, rgba(116, 116, 116, 0.08));
}

.qmos-toolbar-left {
  display: flex;
  align-items: center;
}

.qmos-toolbar-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.qmos-stats-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--key-color, #333);
}

.qmos-stats-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--theme-color, #f04494);
}

.qmos-stats-limit {
  font-size: 14px;
  color: var(--muted-2-color, #999);
}

.qmos-toolbar-right {
  display: flex;
  align-items: center;
}

.qmos-limit-tip {
  font-size: 13px;
  color: var(--muted-2-color, #999);
  padding: 8px 16px;
  background: var(--muted-bg-color, #eee);
  border-radius: var(--main-radius, 8px);
}

/* 应用网格 */
.qmos-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
/* ========================================
   2. 应用卡片
   ======================================== */

.qmos-app-item {
  background: var(--main-bg-color, #fff);
  border-radius: var(--main-radius, 8px);
  box-shadow: 0 2px 8px var(--main-shadow, rgba(116, 116, 116, 0.08));
  transition: all 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.qmos-app-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px var(--main-shadow, rgba(116, 116, 116, 0.12));
}

/* 卡片头部 - 横向布局 */
.qmos-item-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
}

.qmos-item-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.qmos-item-logo img {
  width: 100%;
  height: 100%;
  border-radius: var(--main-radius, 8px);
  object-fit: cover;
  box-shadow: 0 2px 4px var(--main-shadow, rgba(116, 116, 116, 0.08));
}

.qmos-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qmos-item-badge {
  display: inline-block;
  align-self: flex-start;
}

.qmos-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--key-color, #333);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.qmos-item-time {
  font-size: 11px;
  color: var(--muted-2-color, #999);
  display: flex;
  align-items: center;
  gap: 4px;
}

.qmos-item-time i {
  font-size: 10px;
}

/* 卡片主体 - 描述区域 */
.qmos-item-body {
  padding: 12px 16px;
  flex: 1;
  display: flex;
  align-items: center;
}

.qmos-item-desc {
  font-size: 12px;
  color: var(--muted-color, #777);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.qmos-desc-empty {
  color: var(--muted-3-color, #b1b1b1);
  font-style: italic;
}

/* 卡片底部操作 */
.qmos-item-footer {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
  background: rgba(0, 0, 0, 0.02);
}

/* ========================================
   3. 按钮样式
   ======================================== */

/* 主按钮 - 创建应用 */
.qmos-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--main-radius, 8px);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.qmos-btn-primary {
  background: var(--theme-color, #f04494);
  color: #fff;
}

.qmos-btn-primary:hover {
  opacity: 0.85;
  color: #fff;
}

.qmos-btn-primary:active {
  transform: scale(0.98);
}

/* 操作按钮 */
.qmos-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: calc(var(--main-radius, 8px) - 2px);
  font-size: 14px;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.qmos-action-btn i {
  font-size: 14px;
}

.qmos-btn-view {
  background: #2196f3;
  color: #fff;
}

.qmos-btn-view:hover {
  background: #1976d2;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.qmos-btn-edit {
  background: #ff9800;
  color: #fff;
}

.qmos-btn-edit:hover {
  background: #f57c00;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.qmos-btn-delete {
  background: #f44336;
  color: #fff;
}

.qmos-btn-delete:hover {
  background: #d32f2f;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.qmos-btn-disabled {
  background: var(--muted-bg-color, #eee);
  color: var(--muted-2-color, #999);
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.qmos-btn-disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ========================================
   4. 空状态
   ======================================== */

.qmos-empty-state {
  text-align: center;
  padding: 80px 20px;
}

.qmos-empty-icon {
  margin-bottom: 20px;
}

.qmos-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--key-color, #333);
  margin-bottom: 8px;
}

.qmos-empty-desc {
  font-size: 14px;
  color: var(--muted-2-color, #999);
}

/* ========================================
   5. 骨架屏加载动画
   ======================================== */

.qmos-skeleton-card {
  background: var(--main-bg-color, #fff);
  border-radius: var(--main-radius, 8px);
  padding: 24px;
  box-shadow: 0 2px 8px var(--main-shadow, rgba(116, 116, 116, 0.08));
}

.qmos-skeleton-header {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.qmos-skeleton-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--main-radius, 8px);
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

.qmos-skeleton-info {
  flex: 1;
}

.qmos-skeleton-title {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.qmos-skeleton-meta {
  height: 14px;
  width: 60%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

.qmos-skeleton-actions {
  height: 40px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ========================================
   6. 响应式设计
   ======================================== */

@media (max-width: 768px) {
  .qmos-toolbar {
    flex-direction: row;
    padding: 12px 16px;
    gap: 12px;
    margin-bottom: 16px;
  }

  .qmos-toolbar-left {
    flex: 1;
  }

  .qmos-toolbar-stats {
    gap: 6px;
  }

  .qmos-stats-label {
    font-size: 13px;
  }

  .qmos-stats-count {
    font-size: 18px;
  }

  .qmos-stats-limit {
    font-size: 11px;
  }

  .qmos-apps-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .qmos-item-header {
    padding: 12px;
  }

  .qmos-item-logo {
    width: 48px;
    height: 48px;
  }

  .qmos-item-title {
    font-size: 14px;
  }

  .qmos-item-body {
    padding: 10px 12px;
  }

  .qmos-item-desc {
    font-size: 11px;
  }

  .qmos-item-footer {
    flex-direction: row;
    gap: 6px;
    padding: 10px;
  }

  .qmos-action-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
  }

  .qmos-action-btn i {
    font-size: 13px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .qmos-apps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .qmos-apps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
