:root {
    --primary-bg: #ffffff;
    --secondary-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --accent-color: #6c63ff;
    --accent-light: #e6e4ff;
    --header-height: 60px;
    --transition-speed: 0.3s;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.theme-dark {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --card-bg: #242424;
    --text-color: #f0f0f0;
    --border-color: #444444;
    --accent-color: #9c92ff;
    --accent-light: #2a2a4a;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.theme-red {
    --accent-color: #ff6b6b;
    --accent-light: #ffebeb;
}

.theme-orange {
    --accent-color: #ff9e58;
    --accent-light: #fff3e6;
}

.theme-yellow {
    --accent-color: #ffd166;
    --accent-light: #fff9e6;
}

.theme-green {
    --accent-color: #06d6a0;
    --accent-light: #e6faf5;
}

.theme-cyan {
    --accent-color: #4cc9f0;
    --accent-light: #e6f7ff;
}

.theme-blue {
    --accent-color: #4361ee;
    --accent-light: #e6eeff;
}

.theme-purple {
    --accent-color: #9d4edd;
    --accent-light: #f2e6ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--secondary-bg);
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.logo i {
    font-size: 1.8rem;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.theme-selector {
    display: flex;
    gap: 5px;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    flex-shrink: 0;
}

.theme-light { background: #ffffff; }
.theme-dark { background: #121212; }
.theme-red { background: #ff6b6b; }
.theme-orange { background: #ff9e58; }
.theme-yellow { background: #ffd166; }
.theme-green { background: #06d6a0; }
.theme-cyan { background: #4cc9f0; }
.theme-blue { background: #4361ee; }
.theme-purple { background: #9d4edd; }

.view-mode {
    display: flex;
    gap: 5px;
}

.view-mode-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-color: var(--secondary-bg);
    border: none;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.view-mode-btn.active {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background-color: var(--secondary-bg);
    border-radius: 10px;
    font-size: 14px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background-color: var(--accent-light);
    border-radius: 6px;
    color: var(--accent-color);
}

.section-title {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
}

.links-container {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.links-container.view-large {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.links-container.view-small {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.link-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition-speed);
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 12px;
    height: 80px;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.link-card-container {
    cursor: pointer;
    display: block;
    height: 100%;
    text-decoration: none;
    color: inherit;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.link-icon {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background-color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.link-content {
    flex: 1;
    overflow: hidden;
}

.link-title {
    font-weight: 600;
    /*margin-bottom: 5px;*/
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-desc {
    font-size: 0.9rem;
    color: #666;
    /*margin-bottom: 5px;*/
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-url {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-decoration: none;
}

.link-url:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.link-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.link-card:hover .link-actions {
    opacity: 1;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.add-card {
    cursor: pointer;
    background-color: rgba(108, 99, 255, 0.05);
    border: 2px dashed var(--accent-light);
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

.add-link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    /*padding: 10px;*/
    width: 100%;
    height: 100%;
}

.add-link-btn i {
    /*font-size: 2rem;*/
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    background-color: var(--accent-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--secondary-bg);
    color: var(--text-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #5a52e0;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--secondary-bg);
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.admin-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.admin-header h1 {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.admin-actions {
    margin-bottom: 25px;
    text-align: right;
}

/* 图片加载优化 */
.link-icon .default-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.link-icon .actual-icon {
    opacity: 0;
    transition: opacity 0.3s;
}

.link-icon .actual-icon.loaded {
    opacity: 1;
}

.link-icon .default-icon.hidden {
    opacity: 0;
}

/* 小模块样式优化 */
.links-container.view-small .link-card {
    padding: 8px;
    height: 60px;
    gap: 10px;
}

.links-container.view-small .link-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
}

.links-container.view-small .link-icon img {
    width: 24px;
    height: 24px;
}

.links-container.view-small .link-title {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.links-container.view-small .link-desc {
    display: none;
}

.links-container.view-small .link-url {
    display: none;
}

.links-container.view-small .link-card:hover .link-desc {
    display: block;
    position: absolute;
    bottom: -40px;
    left: 0;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    width: 100%;
    white-space: normal;
    font-size: 0.85rem;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .links-container.view-large {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .links-container.view-small {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .user-info span {
        display: none;
    }
    
    .user-menu {
        flex-direction: column;
        gap: 5px;
    }
    
    .info-bar {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .links-container.view-large, .links-container.view-small {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 0 10px;
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
    }
    
    .logo span {
        font-size: 1.2rem;
    }
    
    .theme-btn {
        width: 20px;
        height: 20px;
    }
    
    .view-mode-btn {
        width: 30px;
        height: 30px;
    }
    
    .user-controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
}