/* 全局样式 */
* {
    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;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 加载状态样式 */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(74, 111, 165, 0.3);
    border-radius: 50%;
    border-top: 5px solid #4a6fa5;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-left: 1rem;
    font-size: 1.1rem;
    color: #4a6fa5;
}

/* 加载容器增强样式 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    color: #7f8c8d;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 40px 0;
}

/* 错误消息样式 */
.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    text-align: center;
    font-size: 0.95rem;
}

/* 消息提示样式增强 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.message.success {
    background-color: #22c55e;
}

.message.error {
    background-color: #ef4444;
}

.message.info {
    background-color: #3b82f6;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 0;
    color: #7f8c8d;
    font-style: italic;
}

/* 成功消息样式 */
.success-message {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    text-align: center;
    font-size: 0.95rem;
}

/* 头部样式 */
header {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #4a6fa5;
    font-size: 1.8rem;
}

/* 按钮样式 */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    background-color: #e0e0e0;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #d0d0d0;
}

.btn.primary {
    background-color: #4a6fa5;
    color: white;
}

.btn.primary:hover {
    background-color: #3a5a85;
}

.btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* 内容容器 */
#content-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 动画效果增强 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* 分类动画效果 */
.category {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 分类卡片样式 */
.category {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.category h2 {
    color: #4a6fa5;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-actions {
    display: none;
    gap: 0.5rem;
}

.category.admin .category-actions {
    display: flex;
}

/* 链接网格样式 */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.link-item {
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.link-item.admin {
    cursor: default;
}

.link-item.admin:hover {
    transform: none;
    box-shadow: none;
}

.link-item.admin .link-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.link-title {
    font-weight: 600;
    color: #4a6fa5;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.link-description {
    font-size: 0.9rem;
    color: #666;
}

.link-actions {
    display: none;
}

/* 模态框样式 */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

/* 加载状态动画 */
.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal.active .modal-content {
    transform: scale(1);
}

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

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #4a6fa5;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #333;
}

/* 登录模态框 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-modal.active {
    opacity: 1;
    visibility: visible;
}

.login-modal .modal-content {
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.login-modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

input, textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #4a6fa5;
}

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

/* 管理员面板样式 */
.admin-panel {
    background-color: #f0f4f8;
    padding: 2rem;
    margin-top: 2rem;
    border-radius: 8px;
    display: none;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* 管理员模式样式 */
#admin-mode {
    margin-bottom: 2rem;
}

/* 添加分类按钮 */
#add-category-btn {
    margin-bottom: 1.5rem;
    background-color: #4caf50;
    color: white;
}

#add-category-btn:hover {
    background-color: #3d8b40;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .link-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-controls {
        flex-direction: column;
    }
}

/* 编辑模态框样式 */
.edit-modal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

/* 链接表单样式 */
.link-form {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 1rem;
}