/**
 * 学苑平台 - 组件样式
 * 
 * 包含按钮、卡片、导航栏、页脚等可复用组件
 */

/* ============================================================
   1. 按钮 (Buttons)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    border-radius: 50px;
    /* 全局胶囊形 */
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(142, 151, 117, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #7d96ac;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-white {
    background-color: #ffffff;
    color: var(--text-main);
}

.btn-white:hover {
    background-color: #f9fafb;
    transform: translateY(-2px);
}

/* 按钮尺寸 */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ============================================================
   2. 页头 (Header)
   ============================================================ */
.header {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.logo img {
    max-height: 50px;
    height: auto;
    width: auto;
    object-fit: contain;
}

.logo:hover {
    color: var(--primary);
}

.nav ul {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav li {
    margin: 0;
}

.nav a {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    position: relative;
    transition: all 0.25s ease;
}

.nav a:hover {
    color: var(--primary);
    background-color: rgba(142, 151, 117, 0.08);
}

.nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav a:hover::after {
    width: 60%;
}

/* 移动端菜单切换按钮 */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle .bar {
    width: 24px;
    height: 3px;
    background-color: var(--text-main);
    transition: all 0.3s ease;
}

/* 桌面端隐藏导航内部的移动端专属操作卡片 */
.nav-mobile-actions {
    display: none !important;
}

@media (max-width: 768px) {
    .header-inner {
        position: relative;
    }

    .logo img {
        max-height: 40px;
    }

    /* 移动端隐藏顶部栏操作按钮，彻底解决挤占菜单问题 */
    .header-actions {
        display: none !important;
    }

    /* 移动端汉堡菜单按钮靠右对齐 */
    .mobile-menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .nav {
        position: static;
    }

    .nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        flex-direction: column;
        padding: 1rem 1.25rem 1.25rem;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border);
        gap: 0;
        z-index: 1001;
    }

    .nav.active ul {
        display: flex;
    }

    .nav li {
        width: 100%;
    }

    .nav a {
        display: block;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border);
        border-radius: 8px;
    }

    .nav a::after {
        display: none;
    }

    /* 移动端展开菜单内的用户卡片与操作按钮 */
    .nav-mobile-actions {
        display: block !important;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .mobile-user-card {
        background: #f8fafc;
        border-radius: 8px;
        padding: 0.85rem 1rem;
        border: 1px solid var(--border);
    }

    .mobile-user-greeting {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-main);
        margin-bottom: 0.6rem;
    }

    .mobile-user-greeting i {
        color: var(--primary, #8e9775);
        font-size: 1.1rem;
    }

    .mobile-user-btns .btn,
    .mobile-guest-actions .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
    }
}

/* ============================================================
   3. 页脚 (Footer)
   ============================================================ */
.footer {
    background-color: #555b6e;
    color: #e5e7eb;
    padding: 4rem 0 2rem;
    margin-top: 0;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: #ffffff;
    margin-bottom: 1.5rem;
}

.footer-col p,
.footer-col a {
    color: #d1d5db;
}

.footer-col a:hover {
    color: #ffffff;
    padding-left: 5px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #717789;
    color: #d1d5db;
}

@media (max-width: 768px) {
    .footer-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ============================================================
   4. Hero 区域
   ============================================================ */
.hero {
    /* 加深背景，提升对比度和质感 */
    background: linear-gradient(135deg, #6c8496 0%, #4a5f70 100%);
    color: #ffffff;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: #ffffff;
}

.hero-content .highlight {
    /* 提亮高亮色，使其在深色背景上更清晰 */
    background: linear-gradient(135deg, #eaddc5, #d6c096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    line-height: 1.75;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-illustration {
    font-size: 10rem;
    opacity: 0.3;
}

@media (max-width: 1024px) {
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-image {
        display: none;
    }
}

/* ============================================================
   5. 特性区域 (Features)
   ============================================================ */
.features {
    padding: 5rem 0;
}

.section-header {
    max-width: 800px;
    margin: 0 auto 3rem;
}

.section-title {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.section-desc {
    font-size: 1.125rem;
    color: var(--text-light);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
}

.feature-icon.bg-blue {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.feature-icon.bg-green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.feature-icon.bg-orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-light);
    line-height: 1.75;
}

@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   6. CTA 区域 (Call to Action)
   ============================================================ */
.cta {
    /* 与 Hero 呼应，使用稍深的莫兰迪绿灰 */
    background: linear-gradient(135deg, #7a8264 0%, #5d664a 100%);
    color: #ffffff;
    padding: 5rem 0;
    text-align: center;
}

.cta h2 {
    font-size: 2.5rem;
    color: #ffffff;
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

/* ============================================================
   7. 表单元素
   ============================================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control,
.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: var(--text-main);
}

.form-control:focus,
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(142, 151, 117, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Placeholder 样式 */
.form-control::placeholder,
.form-input::placeholder,
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: var(--text-light);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* 获得焦点时，placeholder 会自动消失（浏览器默认行为）
   但我们也可以让它在焦点时变得更淡 */
.form-control:focus::placeholder,
.form-input:focus::placeholder,
input:focus::placeholder,
textarea:focus::placeholder,
select:focus::placeholder {
    opacity: 0.3;
}

/* ============================================================
   8. 分页 (Pagination)
   ============================================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 3rem 0;
}

.page-number {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    background: var(--bg-card);
    color: var(--text-light);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.page-number:hover,
.page-number.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ============================================================
   9. 标签 (Badge/Label)
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
    background-color: var(--bg-body);
    color: var(--text-main);
}

.badge-primary {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

/* ============================================================
   10. 加载动画
   ============================================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   11. 通知/提示
   ============================================================ */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.alert-info {
    background-color: #dbeafe;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.alert-success {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-error {
    background-color: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

/* ============================================================
   12. 课程角标 (Course Badges)
   ============================================================ */
.course-badge-container {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 10;
}

.c-badge {
    padding: 3px 10px;
    font-size: 0.65rem;
    /* 缩小字号 */
    font-weight: 800;
    border-radius: 50px;
    /* 胶囊圆角 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    animation: badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
}

.c-badge-onboarding {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
}

.c-badge-deadline {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
}

/* 精致化限期必修 */
.c-badge-deadline-date {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-size: 0.65rem;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.c-badge i {
    font-size: 0.7rem;
    opacity: 0.9;
}

@keyframes deadline-pulse {

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
        transform: scale(1.02);
    }
}

.c-badge-deadline-date:not(.expired) {
    animation: deadline-pulse 3s ease-in-out infinite;
}

.c-badge-deadline-date.expired {
    background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
    opacity: 0.9;
    animation: none;
}

/* ============================================================
   列表行操作按钮（全站统一，样式同课程管理）
   用法：<div class="row-actions">
           <button class="btn btn-icon btn-outline-primary btn-action-small" title="编辑"><i class="ti ti-edit"></i></button>
         </div>
   颜色约定：查看/详情/内容 info，编辑 primary，删除 danger，
            停用/禁用/重置密码 warning，激活/达标 success
   ============================================================ */
.row-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.btn-action-small {
    width: 31px !important;
    height: 31px !important;
    min-width: 31px !important;
    max-width: 31px !important;
    min-height: 31px !important;
    max-height: 31px !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 31px !important;
    border-radius: 6px !important;
}

.btn-action-small i {
    font-size: 16px !important;
    margin: 0 !important;
}
