/* ========================================
   乙梵装饰 - 主样式文件
   ======================================== */

/* CSS变量 */
:root {
    /* 主题色 */
    --primary-color: #1890ff;
    --primary-dark: #096dd9;
    --primary-light: #40a9ff;
    
    /* 功能色 */
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --info-color: #1890ff;
    
    /* 中性色 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-placeholder: #999999;
    --text-disabled: #cccccc;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #fafafa;
    
    /* 边框色 */
    --border-color: #e8e8e8;
    --border-light: #f0f0f0;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* 字体大小 */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-md: 16px;
    --font-lg: 18px;
    --font-xl: 20px;
    --font-2xl: 24px;
    
    /* 安全区域 */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-sm);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.5;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
    min-height: 100vh;
    position: relative;
}

/* 全局长文本换行处理 */
* {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 允许输入框选择文本 */
input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* 链接 */
a {
    color: var(--primary-color);
    text-decoration: none;
}

/* 图片 */
img {
    max-width: 100%;
    vertical-align: middle;
}

/* 列表 */
ul, ol {
    list-style: none;
}

/* 按钮重置 */
button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* 输入框重置 */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
}

/* ========================================
   布局类
   ======================================== */

/* 页面容器 */
#app {
    min-height: 100vh;
    background-color: var(--bg-secondary);
    overflow-x: hidden;
    max-width: 100vw;
}

/* 页面 */
.yf-page {
    min-height: 100vh;
    background-color: var(--bg-secondary);
    padding-bottom: var(--safe-area-bottom);
}

/* 页面带底部导航 */
.yf-page.has-tabbar {
    padding-bottom: calc(60px + var(--safe-area-bottom));
}

/* 头部导航 */
.yf-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding-top: var(--safe-area-top);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    z-index: 100;
}

.yf-header-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.yf-header-back,
.yf-header-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: var(--font-xl);
}

/* 内容区域 */
.yf-content {
    padding-top: calc(56px + var(--safe-area-top));
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    padding-bottom: var(--spacing-md);
}

/* 底部导航 */
.yf-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    display: flex;
    z-index: 100;
}

.yf-tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: var(--font-xs);
    transition: color 0.2s;
}

.yf-tabbar-item.active {
    color: var(--primary-color);
}

.yf-tabbar-item-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

/* ========================================
   通用组件
   ======================================== */

/* 卡片 */
.yf-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.yf-card-title {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

/* 按钮 */
.yf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 var(--spacing-lg);
    font-size: var(--font-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.yf-btn-block {
    display: flex;
    width: 100%;
}

.yf-btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.yf-btn-primary:active {
    background-color: var(--primary-dark);
}

.yf-btn-default {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.yf-btn-default:active {
    background-color: var(--bg-secondary);
}

.yf-btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}

.yf-btn-danger:active {
    opacity: 0.8;
}

.yf-btn-text {
    background: transparent;
    color: var(--primary-color);
    padding: 0 var(--spacing-sm);
}

.yf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 输入框 */
.yf-input-group {
    margin-bottom: var(--spacing-md);
}

.yf-input-label {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.yf-input {
    width: 100%;
    height: 48px;
    padding: 0 var(--spacing-md);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.yf-input:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-primary);
}

.yf-input::placeholder {
    color: var(--text-placeholder);
}

.yf-textarea {
    width: 100%;
    min-height: 100px;
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    color: var(--text-primary);
    resize: none;
}

.yf-textarea:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-primary);
}

/* 选择框 */
.yf-select {
    width: 100%;
    height: 48px;
    padding: 0 var(--spacing-md);
    padding-right: 36px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* 标签 */
.yf-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 var(--spacing-sm);
    font-size: var(--font-xs);
    border-radius: var(--radius-sm);
}

.yf-tag-primary {
    background-color: rgba(24, 144, 255, 0.1);
    color: var(--primary-color);
}

.yf-tag-success {
    background-color: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.yf-tag-warning {
    background-color: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.yf-tag-danger {
    background-color: rgba(255, 77, 79, 0.1);
    color: var(--danger-color);
}

/* 空状态 */
.yf-empty {
    padding: var(--spacing-xl) 0;
    text-align: center;
    color: var(--text-placeholder);
}

.yf-empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.yf-empty-text {
    font-size: var(--font-sm);
}

/* 分割线 */
.yf-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: var(--spacing-md) 0;
}

/* 列表项 */
.yf-list-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.yf-list-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.yf-list-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.yf-list-item:only-child {
    border-radius: var(--radius-md);
}

.yf-list-item-content {
    flex: 1;
}

.yf-list-item-title {
    font-size: var(--font-md);
    color: var(--text-primary);
}

.yf-list-item-desc {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.yf-list-item-arrow {
    color: var(--text-placeholder);
    font-size: 16px;
}

/* 头像 */
.yf-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.yf-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yf-avatar-text {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

/* 图片网格 */
.yf-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.yf-image-grid-item {
    position: relative;
    padding-top: 100%;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.yf-image-grid-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 进度条 */
.yf-progress {
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.yf-progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: var(--radius-full);
    transition: width 0.3s;
}

/* 工具类 */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}
