/* 子页面专属样式 */

.page-header {
    min-height: 320px;
    padding: calc(var(--navbar-height) + 56px) 2rem 64px;
    text-align: center;
    background: linear-gradient(to bottom, var(--nav-bg), transparent);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* HTML/CSS 页面样式 */
.demo-section {
    width: 100%;
    margin-bottom: 4.5rem;
}

.demo-section > p {
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    color: var(--text-secondary);
}

.demo-section h2 {
    width: fit-content;
    margin: 0 auto 2rem;
    color: var(--accent-primary);
    border-left: 4px solid var(--accent-primary);
    border-right: 4px solid transparent;
    padding: 0.2rem 1rem;
}

.grid-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 1.5rem;
}

.grid-item {
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}
.grid-item:hover {
    transform: translateY(-10px) scale(1.05);
    background: var(--accent-glow);
}

.flex-demo {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2rem;
    background: var(--glass-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.shape {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--html-color), #ff7b54);
    border-radius: 10px;
    animation: spin 6s linear infinite;
}
.shape.circle { border-radius: 50%; background: linear-gradient(135deg, var(--css-color), #03A9F4); animation-direction: reverse; }
.shape.triangle {
    background: transparent;
    width: 0; height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 80px solid var(--js-color);
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* JavaScript 页面样式 - 任务列表 */
.todo-app {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

.todo-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.todo-input {
    flex: 1;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 1rem;
}

.todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    margin-bottom: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.todo-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.todo-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 0.5rem;
    transition: var(--transition);
}
.todo-actions button.btn-complete:hover { color: #27c93f; }
.todo-actions button.btn-delete:hover { color: #ff5f56; }

/* Ajax 页面样式 - 用户卡片 */
.api-controls {
    text-align: center;
    margin-bottom: 3rem;
}

.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 2rem;
}

.user-card {
    text-align: center;
    padding: 2rem;
}

.user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--accent-primary);
    margin: 0 auto 1rem;
    object-fit: cover;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.loader {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    display: none;
}

/* 项目 页面样式 */
.project-card {
    position: relative;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
}

.project-img {
    width: 100%;
    height: 200px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--glass-border);
}

.project-info {
    padding: 1.5rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    background: rgba(67, 97, 238, 0.1);
    color: var(--accent-primary);
}

/* 移动端修复：防止内容横向溢出并优化按钮布局 */
@media screen and (max-width: 768px) {
    .page-header {
        min-height: 260px;
        padding: calc(var(--navbar-height) + 42px) 1rem 44px;
    }

    .page-header h1 {
        font-size: clamp(2rem, 10vw, 3rem);
        line-height: 1.2;
    }

    .page-header p {
        max-width: 92vw;
        font-size: 0.98rem;
    }

    .page-container {
        width: 100%;
        padding: 2.5rem 1rem;
        overflow-x: hidden;
    }

    .demo-section {
        margin-bottom: 3.5rem;
    }

    .demo-section h2 {
        width: 100%;
        max-width: 100%;
        text-align: center;
        font-size: clamp(1.35rem, 6vw, 1.85rem);
        line-height: 1.35;
        padding: 0.25rem 0.7rem;
        border-left-width: 3px;
        border-right-width: 3px;
    }

    .demo-section > p {
        max-width: 100%;
        text-align: center;
    }

    .grid-demo,
    .user-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .grid-item,
    .user-card,
    .project-info {
        padding: 1.25rem;
    }

    .flex-demo {
        padding: 1.25rem;
        gap: 1.4rem;
    }

    .todo-app {
        width: 100%;
        max-width: 100%;
        padding: 1.25rem;
    }

    .todo-input-group {
        flex-direction: column;
        gap: 0.8rem;
    }

    .todo-input-group .btn,
    .todo-input,
    select.todo-input {
        width: 100%;
        min-width: 0;
    }

    .todo-item {
        align-items: flex-start;
        gap: 0.8rem;
    }

    .todo-item span {
        flex: 1;
        min-width: 0;
        word-break: break-word;
    }

    .todo-actions {
        display: flex;
        flex-shrink: 0;
    }

    .project-tags {
        flex-wrap: wrap;
    }

    .project-img {
        height: 160px;
    }
}

@media screen and (max-width: 420px) {
    .page-container {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .page-header {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .todo-item {
        flex-direction: column;
    }

    .todo-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
