:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --primary-color: #4a90e2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e1e4e8;
    padding-bottom: 10px;
}

header h2 {
    margin: 0;
    flex-shrink: 0;
}

/* 搜索栏样式 */
.search-bar {
    flex: 1;
    min-width: 200px;
}

.search-bar input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background-color: var(--card-bg);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.search-bar input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 分类管理按钮 */
.category-manage-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.category-manage-btn:hover {
    background-color: #357abd;
}

/* 表单样式 */
.add-form {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.add-form input, .add-form select, .add-form button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.add-form input, .add-form select { 
    flex: 1; 
    min-width: 150px; 
}

.add-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.add-form button:hover { 
    background-color: #357abd; 
}

/* 导航卡片布局 */
.category-section {
    margin-bottom: 25px;
}

.category-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #555;
    font-weight: 600;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.link-card {
    background: var(--card-bg);
    padding: 12px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.08);
}

.link-card a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions {
    display: none;
    gap: 6px;
    margin-left: 10px;
    flex-shrink: 0;
}

.link-card:hover .card-actions {
    display: flex;
}

.edit-category-btn, .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    transition: opacity 0.2s;
}

.edit-category-btn {
    color: #1890ff;
    title: '修改分类';
}

.edit-category-btn:hover {
    opacity: 0.7;
}

.delete-btn {
    color: #ff4d4f;
}

.delete-btn:hover {
    opacity: 0.7;
}

/* 授权码对话框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e4e8;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.close {
    cursor: pointer;
    font-size: 24px;
    color: #999;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
}

.modal-body input:focus {
    border-color: var(--primary-color);
}

.modal-body select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
}

.modal-body select:focus {
    border-color: var(--primary-color);
}

.modal-body select option:disabled {
    opacity: 0.6;
    color: #999;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e1e4e8;
}

.btn-cancel, .btn-confirm {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-cancel {
    background-color: #f0f0f0;
    color: #333;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-confirm {
    background-color: var(--primary-color);
    color: white;
}

.btn-confirm:hover {
    background-color: #357abd;
}

/* 分类管理样式 */
.category-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.category-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
}

.category-input-group input:focus {
    border-color: var(--primary-color);
}

.btn-small {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-small:hover {
    background-color: #357abd;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e1e4e8;
}

.category-name {
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.default-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: normal;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.btn-rename, .btn-delete {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-rename {
    background-color: #f0ad4e;
    color: white;
}

.btn-rename:hover:not(:disabled) {
    background-color: #ec971f;
}

.btn-delete {
    background-color: #d9534f;
    color: white;
}

.btn-delete:hover:not(:disabled) {
    background-color: #c9302c;
}

.btn-rename:disabled, .btn-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}