/*
Theme Name: 校园服务平台
Theme URI: https://example.com/campus-service-theme
Author: Custom Developer
Author URI: https://example.com
Description: 专为校园服务平台设计的WordPress主题，支持Banner管理、图标分类、点击统计等功能
Version: 1.6.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: campus-service
*/

/* ==================== 基础样式重置 ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: transparent !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: transparent !important;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* 强制覆盖WordPress admin bar和浏览器默认背景 */
html body, body.wp-admin, body.wp-admin-bar {
    background-color: transparent !important;
    background-image: none !important;
}

/* 网站背景层 - 用html::before实现，不占用DOM */
html::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* iOS优化 */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-font-smoothing: antialiased;
    }
    
    .category-item,
    .quick-access-item {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 修复iOS上点击时的蓝色背景 */
    .category-item:active,
    .quick-access-item:active {
        -webkit-tap-highlight-color: transparent;
        background-color: transparent;
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== 全局背景图 ==================== */
.global-bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.global-bg-image {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    /* 强制GPU层，防止安卓浏览器滑动重绘 */
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
}

/* ==================== 容器布局 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Banner区域 ==================== */
.banner-section {
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: transparent;
}

.banner-slider {
    position: relative;
    width: 100%;
}

.banner-slide {
    display: none;
    width: 100%;
}

.banner-slide.active {
    display: block;
}

.banner-slide a {
    display: block;
    width: 100%;
}

.banner-slide img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Banner指示器 */
.banner-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.banner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}

.banner-dot.active {
    background-color: #fff;
}

/* ==================== 快速访问区域 ==================== */
.quick-access-section {
    padding: 65px 0 40px;
    background-color: transparent;
    position: relative;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 40px;
    font-size: 22px;
    font-weight: 600;
    color: #555;
}

.title-decoration {
    width: 6px;
    height: 24px;
    background-color: #c41e3a;
    border-radius: 2px;
}

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    justify-items: center;
    align-items: start;
}

.quick-access-item {
    width: 100%;
    min-width: 0;
}

.quick-access-box {
    border: 1px solid #c41e3a;
    border-radius: 8px;
    padding: 25px 20px 25px 0px;
}

.quick-access-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s;
}

.quick-access-item:hover {
    transform: translateY(-5px);
}

.quick-access-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-access-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.quick-access-name {
    font-size: 15px;
    color: #666;
    line-height: 1.4;
    word-break: break-all;
    overflow-wrap: break-word;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== 分类区域 ==================== */
.category-section {
    padding: var(--cat-spacing-top, 24px) 0 var(--cat-spacing-bottom, 10px);
    background-color: transparent;
    position: relative;
}

.category-title-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: var(--cat-title-margin-top, 20px) 0 var(--cat-title-margin-bottom, 40px);
    flex-wrap: nowrap;
}

.category-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: #666;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
    vertical-align: middle;
    line-height: 1;
}

.category-subtitle {
    font-size: 14px;
    color: #999;
    font-weight: normal;
    white-space: nowrap;
    display: inline;
    vertical-align: middle;
    line-height: 1;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 1px solid rgba(221, 221, 221, 0.6);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
}

.category-item:hover {
    border-color: #c41e3a;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-name {
    font-size: 16px;
    color: #555;
    text-align: center;
    line-height: 1.4;
    word-break: break-all;
    min-width: 100%;
}

/* ==================== 页脚区域 ==================== */
.footer-section {
    position: relative;
    z-index: 2;
    padding: 0;
}

.footer-copyright-bar {
    padding: 20px 0;
    text-align: center;
}

.footer-content {
    font-size: 14px;
    line-height: 1.8;
}

/* ==================== 响应式适配 - 手机端 (≤480px) ==================== */
@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .container {
        padding: 0 12px;
        max-width: 100%;
    }
    
    /* 全局背景图优化 - 手机端自适应宽度 */
    .global-bg-image {
        height: 55%;
        background-size: 100% auto;
        background-position: center bottom;
    }
    
    /* 页眉优化 - 更紧凑 */
    .site-header {
        height: 45px;
    }
    
    .header-container {
        padding: 0 10px;
    }
    
    .header-logo {
        gap: 8px;
    }
    
    .banner-section {
        padding-top: 0;
    }
    
    .quick-access-section {
        padding: 30px 0 15px;
    }
    
    /* 快速访问一行4个，分类一行3个 */
    .quick-access-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        justify-items: center;
        align-items: start;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .quick-access-box {
        border: 1px solid #c41e3a;
        padding: 12px 4px 12px 1px;
    }

    .quick-access-item {
        width: 100%;
        min-width: 0;
        padding: 4px 2px;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
    }

    .quick-access-icon {
        width: 24px;
        height: 24px;
        margin: 0 auto 3px;
    }

    /* 统一字体 - 手机端缩小字号防换行 */
    .quick-access-name,
    .category-name {
        font-size: 9px;
        line-height: 1.2;
        text-align: center;
    }
    
    .section-title,
    .category-title {
        font-size: 15px;
        margin-bottom: 16px;
    }
    
    .title-decoration {
        height: 14px;
        width: 4px;
    }
    
    .category-item {
        padding: 10px 5px;
        border-radius: 6px;
    }
    
    .category-icon {
        width: 55px;
        height: 55px;
        margin-bottom: 8px;
    }

    /* 标题副标题严格水平对齐 - 手机端 */
    .category-title-wrapper {
        margin: var(--cat-title-margin-top, 16px) 0 var(--cat-title-margin-bottom, 28px);
        display: flex;
        align-items: center;
        gap: 2px;
        flex-wrap: nowrap;
    }
    
    .category-title {
        flex-shrink: 0;
        font-size: 15px;
        line-height: 1;
        margin: 0;
    }
    
    .category-subtitle {
        font-size: 11px;
        line-height: 15px;
        height: 15px;
        display: inline-flex;
        align-items: center;
    }
    
    /* 修复快速访问长标题换行 */
    .quick-access-name {
        -webkit-line-clamp: 2;
    }
    
    /* 分类区域留白 */
    .category-section {
        padding: var(--cat-spacing-top, 18px) 0 var(--cat-spacing-bottom, 8px);
    }
    
    .footer-copyright-bar {
        padding: 12px 10px;
    }
    
    .footer-content {
        font-size: 11px;
    }
}

/* ==================== 响应式适配 - 小平板 (481-640px) ==================== */
@media (min-width: 481px) and (max-width: 640px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    /* 全局背景图优化 */
    .global-bg-image {
        height: 65%;
        background-size: cover;
        background-position: center bottom;
    }
    
    .banner-section {
        padding-top: 0;
    }
    
    /* 快速访问和分类都是4个 */
    .quick-access-box {
        padding: 25px 10px 25px 2px;
    }

    .quick-access-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        justify-items: center;
        align-items: start;
    }

    .quick-access-item {
        width: 100%;
        min-width: 0;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .quick-access-icon {
        width: 48px;
        height: 48px;
    }
    
    /* 统一字体 */
    .quick-access-name,
    .category-name {
        font-size: 12px;
    }
    
    .section-title,
    .category-title {
        font-size: 16px;
        
    }
    
    .category-icon {
        width: 55px;
        height: 55px;
    }
    
    /* 标题副标题严格水平对齐 - 小平板 */
    .category-title-wrapper {
        margin: var(--cat-title-margin-top, 18px) 0 var(--cat-title-margin-bottom, 32px);
        display: flex;
        align-items: center;
        gap: 2px;
        flex-wrap: nowrap;
    }
    
    .category-title {
        font-size: 16px;
        line-height: 1;
        margin: 0;
    }
    
    .category-subtitle {
        font-size: 12px;
        line-height: 16px;
        height: 16px;
        display: inline-flex;
        align-items: center;
    }
    
    /* 分类底部留白 */
    .category-section {
        padding: var(--cat-spacing-top, 20px) 0 var(--cat-spacing-bottom, 9px);
    }
}

/* ==================== 响应式适配 - 平板端 (641-768px) ==================== */
@media (min-width: 641px) and (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .container {
        padding: 0 18px;
        max-width: 100%;
    }
    
    /* 全局背景图优化 */
    .global-bg-image {
        height: 70%;
        background-size: cover;
        background-position: center bottom;
    }
    
    /* 页眉优化 */
    .site-header {
        height: 55px;
    }
    
    .header-container {
        padding: 0 15px;
    }
    
    .header-logo img {
        height: 36px;
        max-width: 180px;
        object-fit: contain;
    }
    
    .header-site-title {
        font-size: 15px;
    }
    
    .banner-section {
        padding-top: 55px;
    }
    
    /* 快速访问和分类都是4个 */
    .quick-access-box {
        padding: 30px 12px 30px 2px;
    }

    .quick-access-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        justify-items: center;
        align-items: start;
    }

    .quick-access-item {
        width: 100%;
        min-width: 0;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    .quick-access-icon {
        width: 55px;
        height: 55px;
    }
    
    /* 统一字体 */
    .quick-access-name,
    .category-name {
        font-size: 13px;
    }
    
    .section-title,
    .category-title {
        font-size: 17px;
        
    }
    
    .category-icon {
        width: 60px;
        height: 60px;
    }
    
    .category-subtitle {
        font-size: 13px;
    }
    
    /* 标题副标题同行 */
    .category-title-wrapper {
        margin: var(--cat-title-margin-top, 20px) 0 var(--cat-title-margin-bottom, 34px);
        flex-wrap: nowrap;
        align-items: center;
        gap: 2px;
    }
}

/* ==================== 响应式适配 - 大平板 (769-1024px) ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    /* 全局背景图优化 */
    .global-bg-image {
        height: 80%;
        background-size: cover;
        background-position: center bottom;
    }
    
    /* 统一字体大小 */
    .quick-access-name,
    .category-name {
        font-size: 14px;
    }
    
    .quick-access-grid,
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .quick-access-icon {
        width: 65px;
        height: 65px;
    }
    
    .category-icon {
        width: 75px;
        height: 75px;
    }
    
    /* 标题副标题同行 */
    .category-title-wrapper {
        margin: var(--cat-title-margin-top, 22px) 0 var(--cat-title-margin-bottom, 38px);
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }
}

/* ==================== 后台管理样式 ==================== */
.campus-admin-wrap {
    max-width: 1200px;
    padding: 20px;
}

.campus-admin-wrap h1 {
    margin-bottom: 20px;
    color: #23282d;
}

.campus-admin-wrap .nav-tab-wrapper {
    margin-bottom: 20px;
}

.campus-form-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.campus-form-table th {
    width: 200px;
    padding: 15px 10px;
    text-align: left;
    vertical-align: top;
    font-weight: 600;
    color: #23282d;
}

.campus-form-table td {
    padding: 15px 10px;
    vertical-align: top;
}

.campus-form-table input[type="text"],
.campus-form-table input[type="number"],
.campus-form-table input[type="color"],
.campus-form-table input[type="url"],
.campus-form-table select,
.campus-form-table textarea {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.campus-form-table .description {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

.campus-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.campus-btn:hover {
    background-color: #a01830;
}

.campus-btn-danger {
    background-color: #dc3232;
}

.campus-btn-danger:hover {
    background-color: #b32d2b;
}

.campus-btn-success {
    background-color: #46b450;
}

.campus-btn-success:hover {
    background-color: #389e42;
}

/* 统计页面样式 */
.campus-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
}

.campus-stats-table th,
.campus-stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.campus-stats-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.campus-stats-table tr:hover {
    background-color: #f9f9f9;
}

/* 图标管理样式 */
.icon-preview {
    width: 60px;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.icon-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Banner管理样式 */
.banner-preview {
    max-width: 300px;
    max-height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.banner-preview img {
    width: 100%;
    height: auto;
}

/* 排序句柄 */
.sort-handle {
    cursor: move;
    color: #999;
    padding: 5px;
}

.sort-handle:hover {
    color: #666;
}
