/* ========== 全局基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== 背景渐变 ========== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    transition: background 0.5s ease;
}

.custom-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* 白天模式背景 */
.mode-light .bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

/* 夜间模式背景 */
.mode-dark .bg-gradient {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* ========== 毛玻璃核心样式（严格按照要求） ========== */
.glass-card {
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(22.5px);
    -webkit-backdrop-filter: blur(22.5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    border-radius: 25px;
    -webkit-border-radius: 25px;
    color: rgb(255, 255, 255);
}

.glass-btn {
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(22.5px);
    -webkit-backdrop-filter: blur(22.5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    border-radius: 25px;
    -webkit-border-radius: 25px;
    color: rgb(255, 255, 255);
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-btn:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: rgba(142, 142, 142, 0.25) 0px 8px 20px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.25) 0px 8px 20px 0px;
}

/* 夜间模式毛玻璃 */
.mode-dark .glass-card,
.mode-dark .glass-btn {
    background-color: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: rgba(0, 0, 0, 0.3) 0px 6px 15px 0px;
    -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 6px 15px 0px;
}

.mode-dark .glass-btn:hover {
    background-color: rgba(0, 0, 0, 0.55);
}

/* ========== 模式切换按钮 ========== */
.mode-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.mode-icon {
    position: absolute;
    transition: all 0.3s ease;
}

.mode-light .dark-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.mode-light .light-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.mode-dark .light-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.mode-dark .dark-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ========== 容器 ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    position: relative;
    z-index: 1;
}

/* ========== Hero区域 ========== */
.hero-section {
    text-align: center;
    margin-bottom: 56px;
    padding-top: 40px;
}

.clock-widget {
    display: inline-block;
    padding: 32px 56px;
    margin-bottom: 32px;
    min-width: 340px;
}

.clock-time {
    font-size: 64px;
    font-weight: 200;
    letter-spacing: -2px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.clock-date {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 8px;
    margin-bottom: 20px;
}

.timezone-selector select {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.timezone-selector select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.timezone-selector select option {
    background: #667eea;
    color: #fff;
}

.mode-dark .timezone-selector select {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.mode-dark .timezone-selector select option {
    background: #302b63;
}

.site-info {
    margin-top: 12px;
}

.site-title {
    font-size: 42px;
    font-weight: 600;
    letter-spacing: -1px;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.site-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 400;
}

/* ========== 标签分类 ========== */
.main-content {
    padding-bottom: 40px;
}

.tag-section {
    margin-bottom: 48px;
}

.tag-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 20px;
    padding-left: 8px;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.link-card {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.link-card:hover {
    transform: translateY(-4px);
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: rgba(142, 142, 142, 0.25) 0px 10px 25px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.25) 0px 10px 25px 0px;
}

.mode-dark .link-card:hover {
    background-color: rgba(0, 0, 0, 0.6);
    box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 25px 0px;
    -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 10px 25px 0px;
}

.link-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 16px;
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-name {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 24px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* ========== 登录页 ========== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(22.5px);
    -webkit-backdrop-filter: blur(22.5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    border-radius: 25px;
    -webkit-border-radius: 25px;
    padding: 40px 32px;
    color: #fff;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 32px;
    font-size: 24px;
    font-weight: 600;
}

.error-msg {
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #fff;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.settings-form {
    max-width: 600px;
}

/* ========== 按钮样式（统一毛玻璃） ========== */
.btn {
    padding: 10px 22px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(22.5px);
    -webkit-backdrop-filter: blur(22.5px);
    box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.19) 0px 6px 15px 0px;
    color: #fff;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: rgba(142, 142, 142, 0.25) 0px 8px 20px 0px;
    -webkit-box-shadow: rgba(142, 142, 142, 0.25) 0px 8px 20px 0px;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.8), rgba(88, 86, 214, 0.8));
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.95), rgba(88, 86, 214, 0.95));
}

.btn-danger {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.8), rgba(255, 45, 85, 0.8));
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.95), rgba(255, 45, 85, 0.95));
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 10px;
}

.btn-block {
    width: 100%;
    padding: 13px;
    font-size: 16px;
    border-radius: 16px;
}

/* ========== 后台布局（保持简洁） ========== */
.admin-body {
    background: #f5f5f7;
    color: #1d1d1f;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: #1d1d1f;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 28px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-item {
    display: block;
    padding: 11px 20px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    transition: all 0.2s;
    margin: 2px 10px;
    border-radius: 10px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-item.active {
    background: #007AFF;
    color: #fff;
}

.nav-item.logout {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    margin-left: 10px;
    margin-right: 10px;
}

.admin-main {
    flex: 1;
    padding: 32px;
    overflow-x: auto;
}

.admin-header {
    margin-bottom: 28px;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.5px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    padding: 28px 24px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 36px;
    font-weight: 600;
    color: #007AFF;
    margin-bottom: 6px;
    letter-spacing: -1px;
}

.stat-label {
    color: #86868b;
    font-size: 14px;
}

/* ========== 后台卡片 ========== */
.admin-card {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.admin-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
    letter-spacing: -0.2px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin-bottom: 0;
}

/* ========== 表格 ========== */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #f2f2f7;
}

.data-table th {
    background: #fafafa;
    font-weight: 500;
    color: #86868b;
    font-size: 13px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #fafafa;
}

.empty-text {
    text-align: center;
    color: #86868b;
    padding: 40px !important;
}

.url-text {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #86868b;
    font-size: 13px;
}

/* ========== 链接分组 ========== */
.link-group {
    margin-bottom: 32px;
}

.link-group:last-child {
    margin-bottom: 0;
}

.link-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #007AFF;
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid #007AFF;
}

/* ========== 设备统计 ========== */
.device-stats {
    max-width: 600px;
}

.device-item {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.device-name {
    width: 70px;
    font-size: 14px;
    flex-shrink: 0;
}

.device-bar {
    flex: 1;
    height: 28px;
    background: #f2f2f7;
    border-radius: 14px;
    overflow: hidden;
}

.device-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #5856D6);
    border-radius: 14px;
    transition: width 0.6s ease;
}

.device-bar-fill.mobile {
    background: linear-gradient(90deg, #ff2d55, #af52de);
}

.device-count {
    width: 110px;
    text-align: right;
    font-size: 13px;
    color: #86868b;
    flex-shrink: 0;
}

/* ========== 提示框 ========== */
.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #c6f6d5;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #fff;
    padding: 32px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h3 {
    margin-bottom: 24px;
    color: #1d1d1f;
    font-size: 20px;
    font-weight: 600;
}

/* ========== 背景图上传 ========== */
.bg-preview {
    width: 100%;
    max-width: 400px;
    height: 180px;
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    margin-bottom: 16px;
    border: 1px solid #e5e5ea;
}

.bg-upload-area {
    margin-bottom: 12px;
}

.bg-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* ========== 其他 ========== */
.text-muted {
    color: #86868b;
    font-size: 14px;
}

.text-muted ul {
    margin-left: 20px;
    margin-top: 8px;
}

.text-muted li {
    margin-bottom: 6px;
}

code {
    background: #f2f2f7;
    padding: 3px 8px;
    border-radius: 8px;
    font-family: "SF Mono", Consolas, Monaco, monospace;
    font-size: 13px;
    color: #5856D6;
}

/* ========== 广告位样式 ========== */
.ad-banner {
    margin: 24px auto;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.ad-banner img {
    max-width: 100%;
    border-radius: 16px;
}

.ad-top {
    margin-bottom: 32px;
}

.ad-mid {
    margin: 40px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.ad-bottom {
    margin-top: 40px;
    margin-bottom: 20px;
}

/* 侧边浮动广告 */
.ad-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    max-width: 160px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ad-sidebar img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

/* 夜间模式广告位适配 */
.mode-dark .ad-mid {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.mode-dark .ad-sidebar {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ========== 响应式 ========== */
@media (max-width: 1280px) {
    .ad-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }
    
    .mode-toggle {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .clock-widget {
        padding: 24px 32px;
        min-width: 280px;
    }
    
    .clock-time {
        font-size: 48px;
    }
    
    .site-title {
        font-size: 32px;
    }
    
    .link-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .link-card {
        padding: 14px 16px;
        border-radius: 18px;
    }
    
    .link-icon {
        width: 40px;
        height: 40px;
        font-size: 17px;
        margin-right: 12px;
        border-radius: 10px;
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
    }
    
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .nav-item {
        padding: 8px 14px;
        font-size: 13px;
        margin: 2px 4px;
    }
    
    .nav-item.logout {
        margin-top: 0;
        border-top: none;
        padding-top: 8px;
        margin-left: auto;
    }
    
    .admin-main {
        padding: 20px 16px;
    }
    
    .admin-header h1 {
        font-size: 22px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px 16px;
        border-radius: 16px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}
