/* user-resource.css - 我的资源页面样式 */

* {
    margin: 0;
    padding: 0;
    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;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.user-resource-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px 80px;
}

/* ========== 顶部标题栏 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.back-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.back-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-right: auto;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.add-btn svg {
    width: 18px;
    height: 18px;
}

/* ========== 分类标签 ========== */
.category-section {
    margin-bottom: 24px;
}

.category-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 第一行分类（全部、我创建的、我加入的） */
.category-tabs-primary {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.category-tabs-primary .category-tab {
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
}

/* 第二行分类（按类型分类） */
.category-tabs-secondary {
    margin-top: 0;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.category-tab.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.category-tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.category-tab.active .count {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 搜索和排序 ========== */
.filter-section {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #999;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 48px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    color: #333;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box input::placeholder {
    color: #999;
}

.sort-dropdown {
    min-width: 160px;
}

.sort-dropdown select {
    width: 100%;
    height: 48px;
    padding: 0 40px 0 16px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: all 0.2s ease;
}

.sort-dropdown select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========== 资源列表 ========== */
.resources-section {
    min-height: 400px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.resource-item {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.resource-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #d0d0d0;
    transform: translateY(-2px);
}

.resource-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.resource-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resource-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.resource-info {
    flex: 1;
    min-width: 0;
}

.resource-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-category {
    font-size: 12px;
    color: #999;
}

.resource-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #666;
    background: #f5f5f5;
    font-weight: 500;
}

.stat-badge.primary {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.stat-badge.category-badge {
    color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.stat-badge.public-badge {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.stat-badge.private-badge {
    color: #999;
    background: #f0f0f0;
}

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.resource-time {
    font-size: 12px;
    color: #999;
}

.resource-actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-icon-btn:hover {
    background: #e9ecef;
}

.action-icon-btn svg {
    width: 16px;
    height: 16px;
    color: #666;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
    color: #999;
    margin-bottom: 24px;
}

.primary-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 登录按钮 - 和my_cards页面保持一致 */
.login-action-btn {
    padding: 10px 24px;
    background: #6981EA;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(105, 129, 234, 0.4);
    background: #5a72d9;
}

/* ========== 加载状态 ========== */
.loading-state {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-state p {
    font-size: 15px;
    color: #999;
}

/* ========== 操作菜单弹窗 ========== */
.action-modal,
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 24px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.action-btn:hover {
    background: #e9ecef;
}

.action-btn.danger {
    color: #dc3545;
}

.action-btn.danger:hover {
    background: rgba(220, 53, 69, 0.1);
}

.action-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.cancel-btn {
    width: 100%;
    padding: 14px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

/* 确认按钮 */
.confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.confirm-buttons .cancel-btn,
.confirm-buttons .danger-btn {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-buttons .cancel-btn {
    background: white;
    border: 1px solid #e8e8e8;
    color: #666;
}

.confirm-buttons .cancel-btn:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

.danger-btn {
    background: #dc3545;
    border: none;
    color: white;
}

.danger-btn:hover {
    background: #c82333;
}

/* ========== 编辑弹窗样式 ========== */
.edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.edit-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
}

.edit-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f7fa;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #e1e5e9;
}

.modal-close-btn svg {
    width: 18px;
    height: 18px;
    stroke: #666;
}

.edit-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.switch-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.switch-desc {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e1e5e9;
    transition: 0.3s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.edit-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid #e8e8e8;
}

.edit-modal-footer .cancel-btn,
.edit-modal-footer .save-btn {
    flex: 1;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-modal-footer .cancel-btn {
    background: #f5f7fa;
    border: 1px solid #e1e5e9;
    color: #666;
}

.edit-modal-footer .cancel-btn:hover {
    background: #e1e5e9;
}

.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .user-resource-container {
        padding: 16px 20px 60px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-left {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .header-left h1 {
        font-size: 24px;
    }
    
    .header-left .add-btn {
        margin-left: auto;
    }
    
    .filter-section {
        flex-direction: column;
    }
    
    .sort-dropdown {
        min-width: 100%;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-tab {
        flex-shrink: 0;
    }
    
    .edit-modal-content {
        width: 95%;
        max-height: 85vh;
    }
}

