/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 导航栏 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1890ff 0%, #36cfc9 100%);
    padding: 0 20px;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
    white-space: nowrap;
}

.subject-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.subject-nav::-webkit-scrollbar {
    display: none;
}

.subject-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 14px;
}

.subject-btn:hover,
.subject-btn.active {
    background: white;
    color: #1890ff;
}

.nav-right {
    display: flex;
    gap: 12px;
}

.notice-btn,
.account-btn,
.logout-btn {
    padding: 8px 20px;
    border: 2px solid white;
    border-radius: 20px;
    background: transparent;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.notice-btn:hover,
.account-btn:hover,
.logout-btn:hover {
    background: white;
    color: #1890ff;
}

/* 主体内容 */
.main-content {
    margin-top: 80px;
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.content-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.resource-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.resource-card h3 {
    color: #1890ff;
    margin-bottom: 10px;
    font-size: 18px;
}

.resource-card .subject-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #e6fffb;
    color: #36cfc9;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 10px;
}

.resource-card .description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* 登录页面 */
.login-page {
    background: linear-gradient(135deg, #1890ff 0%, #36cfc9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    color: #1890ff;
    margin-bottom: 8px;
    font-size: 28px;
}

.subtitle {
    text-align: center;
    color: #999;
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1890ff;
}

.role-selector {
    display: flex;
    gap: 20px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.role-option:hover {
    border-color: #1890ff;
}

.role-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.role-option input[type="radio"]:checked + span {
    color: #1890ff;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1890ff 0%, #36cfc9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-options {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-options a {
    color: #1890ff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.login-options a:hover {
    color: #36cfc9;
}

/* 个人中心 */
.welcome-text {
    color: white;
    font-size: 16px;
}

.dashboard-content {
    margin-top: 80px;
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #1890ff 0%, #36cfc9 100%);
    color: white;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.9;
}

.collapse-arrow {
    font-size: 14px;
    margin-left: 8px;
    transition: transform 0.2s;
}

.badge {
    background: white;
    color: #1890ff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
}

.card-body {
    padding: 20px;
    min-height: 150px;
}

.empty-text {
    color: #999;
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}

.btn-primary {
    padding: 8px 20px;
    background: linear-gradient(135deg, #1890ff 0%, #36cfc9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 任务/需求/投诉列表项 */
.list-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.3s ease;
}

.list-item:hover {
    background: #f8f9ff;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.list-item-meta {
    font-size: 12px;
    color: #999;
}

.list-item-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 4px;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
}

.status-resolved {
    background: #d4edda;
    color: #155724;
}

/* 管理员区域 */
.admin-section {
    margin-top: 20px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    box-sizing: border-box;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* 弹窗内表单元素防止错位 */
.modal-content form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.modal-content .form-group {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
    clear: both;
    display: block;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}

.modal-content .form-group input,
.modal-content .form-group select,
.modal-content .form-group textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
}

.modal-content .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 10px;
    }

    .nav-left {
        width: 100%;
        margin-bottom: 6px;
        gap: 10px;
    }

    .logo {
        font-size: 20px;
    }

    .subject-nav {
        width: 100%;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .nav-right {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }

    .notice-btn, .account-btn {
        padding: 7px 14px;
        font-size: 14px;
        min-height: 38px;
    }

    .main-content {
        margin-top: 110px;
        padding: 12px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .login-box {
        padding: 30px 20px;
    }

    .role-selector {
        flex-direction: column;
    }

    .section-header h3 {
        font-size: 18px;
    }

    .signup-card {
        padding: 15px;
    }
}

/* 报名页面样式 */
.signup-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.section-header h3 {
    font-size: 22px;
    color: #1890ff;
    margin: 0;
}

.section-desc {
    color: #999;
    font-size: 14px;
}

.signup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.signup-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.signup-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.signup-card h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.signup-desc {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.signup-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 10px;
    margin-right: 10px;
}

.signup-tag.free {
    background: #d4edda;
    color: #155724;
}

.signup-tag.paid {
    background: #fff3cd;
    color: #856404;
}

.detail-item {
    display: flex;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item label {
    font-weight: 500;
    color: #1890ff;
    min-width: 80px;
    margin-right: 10px;
}

.detail-item span {
    color: #333;
    flex: 1;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 笔记页面样式 */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* 小按钮样式 */
.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    margin-right: 6px;
    margin-top: 4px;
}

/* 文件上传样式 */
input[type="file"] {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* 登录页移动端优化 */
@media (max-width: 480px) {
    .login-box {
        padding: 24px 16px;
        border-radius: 12px;
    }
    .login-box h1 {
        font-size: 24px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    .login-btn {
        padding: 12px;
        font-size: 16px;
    }
    .role-option {
        padding: 6px 10px;
        font-size: 13px;
    }
    .login-options {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    /* 全局按钮触控优化 — 确保手指友好 */
    .btn-primary, .btn-danger, .notice-btn, .account-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* 模态框触控优化 */
    .modal-content {
        margin: 10px;
        padding: 15px;
    }
    .modal-content .close-btn {
        font-size: 28px;
        width: 36px;
        height: 36px;
        line-height: 36px;
    }
    .subject-options .btn-primary {
        padding: 14px 20px;
        font-size: 15px;
        min-width: 100px;
    }
    /* 详情弹窗按钮 */
    #accept-btn, #cancel-btn, #extend-btn, #dispute-btn, #revoke-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 70px;
    }
    /* 列表内按钮 */
    .list-item .btn-primary,
    .list-item .btn-danger {
        padding: 8px 14px !important;
        font-size: 13px !important;
        min-height: 38px;
    }
}

/* 平板优化 */
@media (min-width: 481px) and (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .resource-grid,
    .signup-grid,
    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 侧边栏布局 */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - 60px);
    margin-top: 60px;
}

.dashboard-sidebar {
    width: 220px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 20px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 4px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
    transition: background 0.2s;
    font-size: 15px;
}

.sidebar-header:hover {
    background: #e9ecef;
}

.sidebar-header.active {
    background: #e7f3ff;
    color: #1890ff;
    border-left: 3px solid #1890ff;
}

.sidebar-body {
    display: none;
}

.sidebar-body.expanded {
    display: block;
}

.sidebar-item {
    padding: 10px 20px 10px 40px;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover, .sidebar-item.active {
    color: #1890ff;
    background: #f0f7ff;
    border-left-color: #1890ff;
}

.sidebar-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.sidebar-arrow.rotated {
    transform: rotate(90deg);
}

.sidebar-logout {
    margin-top: 20px;
    padding: 0 20px;
}

.sidebar-logout button {
    width: 100%;
    padding: 10px;
    background: #fff;
    border: 1px solid #e9ecef;
    color: #e74c3c;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-logout button:hover {
    background: #fff5f5;
    border-color: #e74c3c;
}

.dashboard-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fa;
}

.content-section {
    display: none;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.content-section .card-footer {
    text-align: left;
}

.content-section .card-footer .btn-primary {
    margin-right: 10px;
}

.content-section.active {
    display: block;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    color: #333;
    margin-top: 10px;
}

/* 移动端侧边栏 */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
        margin-top: 105px;
    }
    .dashboard-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding: 10px 8px;
        display: flex;
        flex-wrap: wrap;
        overflow: visible; /* 不裁剪换行内容 */
    }
    .dashboard-sidebar .sidebar-section {
        flex-shrink: 0;
    }
    .sidebar-header {
        padding: 8px 13px;
        font-size: 14px;
        white-space: nowrap;
        border-radius: 18px;
        margin: 2px;
        border-left: none !important;
    }
    .sidebar-header:hover {
        background: #e9ecef;
    }
    .sidebar-header.active {
        background: #e7f3ff;
        color: #1890ff;
        border-left: none !important;
    }
    .sidebar-body.expanded {
        position: relative;
        width: 100%;
        display: block;
    }
    .sidebar-item {
        padding: 8px 15px 8px 30px;
        font-size: 13px;
        white-space: nowrap;
    }
    .collapsible-header {
        display: flex;
        align-items: center;
    }
    .dashboard-main {
        padding: 12px;
    }
    .sidebar-logout {
        padding: 0 10px;
        margin-top: 2px;
        align-self: center;
    }
    .sidebar-logout button {
        padding: 6px 14px;
        width: auto;
        font-size: 13px;
    }
}

