/**
 * FitMate - Component Styles
 * 公共组件样式：卡片、按钮、输入框、进度条等
 */

/* ========================================
   Card - 卡片组件
   ======================================== */
.fit-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-level1);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.fit-card:hover {
    box-shadow: var(--shadow-level2);
}

.fit-card.interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-level2);
}

.fit-card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fit-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.fit-card-body {
    padding: var(--spacing-lg);
}

.fit-card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border);
    background: var(--background);
}

/* ========================================
   Buttons - 按钮组件
   ======================================== */

/* 基础按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn i {
    font-size: 14px;
}

/* Primary 按钮 */
.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary 按钮 */
.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

/* Success 按钮 */
.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #0EA472;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Danger 按钮 */
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger-light);
}

/* 幽灵按钮 */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* 图标按钮 */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* 大按钮 CTA */
.btn-cta {
    height: 48px;
    padding: 0 var(--spacing-xl);
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: white;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

/* 块级按钮 */
.btn-block {
    width: 100%;
}

/* ========================================
   Input - 输入框组件
   ======================================== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 var(--spacing-md);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
    background: var(--background);
    cursor: not-allowed;
}

/* 文本域 */
.form-textarea {
    min-height: 100px;
    padding: var(--spacing-md);
    resize: vertical;
}

/* 输入错误状态 */
.form-input.error {
    border-color: var(--danger);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ========================================
   Progress Bar - 进度条组件
   ======================================== */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.6s ease-out;
}

.progress-bar-success .progress-bar-fill {
    background: var(--success);
}

.progress-bar-warning .progress-bar-fill {
    background: var(--warning);
}

/* 进度条带标签 */
.progress-with-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.progress-with-label .progress-bar {
    flex: 1;
}

.progress-label {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

/* ========================================
   Progress Ring - 进度环组件
   ======================================== */
.progress-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border);
}

.progress-ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease-out;
}

.progress-ring-text {
    position: absolute;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Inter', var(--font-sans);
}

/* ========================================
   Tags & Badges - 标签组件
   ======================================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--background);
    color: var(--text-secondary);
}

.tag-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.tag-success {
    background: var(--success-light);
    color: var(--success);
}

.tag-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.tag-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* 状态徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
}

.badge-success {
    background: var(--success);
}

.badge-warning {
    background: var(--warning);
}

.badge-danger {
    background: var(--danger);
}

/* ========================================
   Avatar - 头像组件
   ======================================== */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 18px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 24px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* AI 头像（带渐变） */
.avatar-ai {
    background: var(--gradient-primary);
    color: white;
}

/* ========================================
   Empty State - 空状态
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-lg);
    background: var(--background);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
    max-width: 300px;
}

/* ========================================
   Loading States - 加载状态
   ======================================== */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

.skeleton-card {
    padding: var(--spacing-lg);
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(
        90deg,
        var(--border-light) 25%,
        var(--border) 50%,
        var(--border-light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.skeleton-line:last-child {
    width: 60%;
}

/* ========================================
   Tooltip - 提示框
   ======================================== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    font-size: 12px;
    color: white;
    background: var(--text-primary);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
