﻿:root {
    --background-color: #ffffff;
    --text-color: #000000;
    --box-color: #e0e0e0;
    --cc-color: #cf1818;
    --hover-color: #f5f5f5;
    --nav-hover: #f0f0f0;
    --icon-color: #333333;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --text-color: #ffffff;
        --box-color: #444444;
        --cc-color: #cccccc;
        --hover-color: #2a2a2a;
        --nav-hover: #333333;
        --icon-color: #cccccc;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont,"Microsoft YaHei", "微软雅黑","Microsoft JhengHei", "微軟正黑體","Segoe UI", Roboto,"Helvetica Neue", Arial,sans-serif;
    font-size: 16px;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
    transition: background-color 0.3s, color 0.3s;
}
::selection {color: var(--nav-hover); background: var(--text-color);}
::-moz-selection {var(--nav-hover); background: var(--text-color);}
img{border:none;}
/* 导航面板样式 */
.nav-panel {
    width: 100%;
    background-color: var(--background-color);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 999;
    overflow-y: auto;
}

.panel-header {
    background-color: var(--nav-hover);
    color: var(--cc-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: bold;
}
.panel-title a {
    background-color: var(--nav-hover);
    color: var(--cc-color);
    text-decoration: none;
}

/* 导航菜单样式 */
.nav-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* 深色/浅色模式切换按钮 */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-color);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* 导航菜单按钮 */
.nav-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-color);
    margin: 2px 0;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 导航菜单 */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.nav-menu.active {
    transform: translateX(0);
}

.nav-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: center;
}

.nav-menu-list li {
    padding: 15px 0;
    border-bottom: 1px solid var(--box-color);
}

.nav-menu-list a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2rem;
    display: block;
    transition: color 0.3s;
}

.nav-menu-list a:hover {
    color: var(--text-color);
    opacity: 0.9;
    transform: scale(1.1);
}

/* 网址链接网格 */
.links-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.link-item {
    position: relative;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: var(--hover-color);
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: var(--box-color);
}

.link-favicon {
    width: 55px;
    height: 55px;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: var(--box-color);
}

.link-title {
    display: -webkit-box;
    font-size: 1rem;
    color: var(--icon-color);
    word-break: break-word;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #999;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.link-item:hover .delete-btn {
    display: flex;
}

.delete-btn:hover {
    background-color: #555;
    transform: scale(1.1);
}

/* 操作按钮区域 */
.actions {
    padding: 5px;
    border-top: 1px solid var(--box-color);
    display: flex;
    gap: 10px;
    position: relative;
    bottom: 0;
    background-color: var(--background-color);
}

.btn {
    background-color: var(--icon-color);
    color: var(--nav-hover);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background-color 0.3s;
    flex: 1;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.9;
}

/* 提示信息 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--icon-color);
    color: var(--background-color);
    padding: 12px 24px;
    border-radius: 5px;
    display: none;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* 导入导出模态框 */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 1002;
    border: 1px solid var(--box-color);
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-transition: opacity 0.3s ease, transform 0.3s ease;
    -moz-transition: opacity 0.3s ease, transform 0.3s ease;
    -o-transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

/* 内容层 */
.modal-content {
    background-color: var(--background-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--box-color);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -o-transform: scale(1);
}

.modal-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--icon-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--icon-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--box-color);
}

.form-group {
    display: block;
}
.form-group p{
    margin-bottom: 10px;
    color: var(--icon-color);
}
.form-group a{
    color: var(--icon-color);
}
.modal textarea {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 1px solid var(--box-color);
    border-radius: 5px;
    font-family: monospace;
    font-size: 1rem;
    resize: vertical;
    background-color: var(--background-color);
    color: var(--icon-color);
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-actions .btn {
    width: 100%;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: block;
    padding: 10px 20px;
    background-color: var(--box-color);
    color: var(--icon-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.25rem;
    text-align: center;
    transition: background-color 0.3s;
}

.file-input-label:hover {
    background-color: var(--icon-color);
    color: var(--background-color);
}

.empty-state {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--icon-color);
    min-height: 100px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.5;
}

.so {
    width: auto;
    height: auto;
    padding: 0 20px;
}

.so input {
    margin: 20px 0 10px 0;
    width: 100%;
    color: var(--text-color);
    padding: 5px;
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    transform: none;
    -webkit-appearance: none;
    border: 0;
    max-height: none;
    outline: none;
    background-image: none;
    background-color: transparent;
    border-radius: 0;
    border-bottom: 0.5px solid var(--box-color);
    cursor: pointer;
}

.footer {
    width: 100%;
    height: auto;
    margin-top: 1px;
    padding: 20px 0;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
    font-weight: 400;
    color: var(--icon-color);
    line-height: 20px;
    text-align: center;
    position: relative;
}

.footer a, .footer a:active, .footer a:focus {
    text-decoration: none;
    color: var(--icon-color);
}

.footer a:hover {
    color: var(--text-color);
}

    /* 返回顶部按钮样式 */
    #backToTop {
      position: fixed;
      bottom: 10px;
      right: 10px;
      width:2.75rem;
      height: 2.75rem;
      line-height: 2.75rem;
      background-color: var(--cc-color);
      color: #FFF;
      border: none;
      border-radius: 50%;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      cursor: pointer;
      opacity: 0;
      visibility: hidden;
      overflow: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
     -webkit-transform: opacity 0.3s ease, visibility 0.3s ease;
      transform: rotate(0deg);
      -webkit-transform: rotate(0deg);
      z-index: 9999;
    }
    #backToTop.show {
      opacity: 1;
      visibility: visible;
    }
    @media (max-width: 600px) {
      #backToTop {
        font-size: 1.25rem;
      }
    }
    /* 可选：按钮 hover 效果 */
    #backToTop:hover {
      background-color: var(--cc-color);
    }

.search-info {
    margin-top:-10px;
    display: flex;
    align-items: center; 
}

.dark-mode .search-info ,.light-mode .search-info {
    background-color: var(--nav-hover);
    font-size: 1rem;
    font-weight: bold;
    padding: 5px 5px;
    color: var(--icon-color);
    min-height: 30px;
    border-bottom: 0.5px solid var(--box-color);
}

.batch-delete-btn {
    background-color: var(--icon-color);
    color: var(--nav-hover);
    border: none;
    padding: 5px 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    text-decoration: none;
    margin-left: auto;
}

.batch-delete-btn:hover {
        opacity: 0.9;
}

.dark-mode .batch-delete-btn,.light-mode .batch-delete-btn {
    color: var(--nav-hover);
}

.dark-mode .batch-delete-btn:hover,.light-mode .batch-delete-btn:hover {
    opacity: 0.9;
}

.invalid-url {
    opacity: 0.5;
    background-color: #cf1818;
}
.invalid-url .link-title {
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
}

/* 响应式设计 */
@media (max-width: 850px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .link-favicon {
        width: 55px;
        height: 55px;
    }
    .modal {
        width: 95%;
        padding: 20px;
    }
}
@media (max-width: 600px) {
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .link-favicon {
        width: 55px;
        height: 55px;
    }
    .link-title {
    font-size: 0.9rem;
    }
}

/* 深色模式样式 */
body.dark-mode {
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --box-color: #444444;
    --cc-color: #cccccc;
    --hover-color: #2a2a2a;
    --nav-hover: #333333;
    --icon-color: #cccccc;
}

/* 浅色模式样式 */
body.light-mode {
    --background-color: #ffffff;
    --text-color: #000000;
    --box-color: #e0e0e0;
    --cc-color: #cf1818;
    --hover-color: #f5f5f5;
    --nav-hover: #f0f0f0;
    --icon-color: #333333;
}