/* 培根教育平台 - 公共样式文件 */

/* 基础样式重置和通用设置 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* 修复容器最大宽度和边距 */
.container {
    max-width: 640px;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 2rem;
    }
}

/* 修复导航栏布局 */
header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 修复主要内容区域间距 */
main {
    padding-bottom: 5rem;
    /* 为底部导航留出更多空间 */
}

/* 修复轮播区域高度和间距 */
.swiper-container {
    min-height: 120px;
}

/* 修复快捷功能按钮间距 */
.grid.grid-cols-4>div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid.grid-cols-4>div>div {
    width: 3.5rem;
    /* height         : 3.5rem; */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 修复课程卡片高度一致性 */
.grid.grid-cols-2>div {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.grid.grid-cols-2>div>div:first-child {
    flex-shrink: 0;
}

.grid.grid-cols-2>div>div:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 修复底部导航栏高度 */
nav {
    /* height: 3.5rem; */
}

nav .grid {
    height: 100%;
    align-items: center;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #248aff, #248aff);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #248aff, #248aff);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}

/* 进度条样式 */
.progress {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #248aff, #248aff);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* 标签样式 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-blue {
    background: #dbeafe;
    color: #248aff;
}

.tag-green {
    background: #d1fae5;
    color: #065f46;
}

.tag-orange {
    background: #fed7aa;
    color: #9a3412;
}

.tag-purple {
    background: #e9d5ff;
    color: #6b21a8;
}

/* 头像样式 */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 500;
}

.avatar-xs {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
}

.avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1.125rem;
}

/* 徽章样式 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-red {
    background: #ef4444;
    color: white;
}

.badge-blue {
    background: #3b82f6;
    color: white;
}

.badge-green {
    background: #10b981;
    color: white;
}

/* 分割线 */
.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 1rem 0;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滑入动画 */
.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* 响应式设计 */
@media (max-width: 640px) {
    .container {
        padding: 0 0.75rem;
    }

    .card {
        border-radius: 0.5rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
}

/* 触摸反馈 */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.touch-feedback:active::after {
    width: 200px;
    height: 200px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 安全区域适配 */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-left {
    padding-left: env(safe-area-inset-left);
}

.safe-area-right {
    padding-right: env(safe-area-inset-right);
}


.tabbar {
    height: 64px;
}