* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
    background: #f5f7fa;
    color: #333;
}

.admin-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 15px 0;
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,0.1);
    padding-right: 30px;
    margin-right: 30px;
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 0;
}

.sidebar-header p {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 0;
    display: flex;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    gap: 8px;
    border-radius: 6px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: #667eea;
    color: white;
}

.icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 0;
    border-top: none;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 30px;
    margin-left: 30px;
}

.btn-back {
    display: block;
    text-align: center;
    padding: 10px 20px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-back:hover {
    background: rgba(255,255,255,0.2);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.topbar h1 {
    font-size: 24px;
    color: #2c3e50;
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    font-family: 'Arial', sans-serif;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.card-body {
    padding: 25px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

tbody tr:hover {
    background: #f8f9fa;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-danger {
    background: #ff4d4f;
    color: white;
}

.btn-danger:hover {
    background: #ff7875;
}

.btn-success {
    background: #52c41a;
    color: white;
}

.btn-success:hover {
    background: #73d13d;
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .sidebar-header {
        padding: 15px 20px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-item {
        flex-direction: column;
        padding: 12px 20px;
        gap: 5px;
        font-size: 12px;
        min-width: auto;
    }
    
    .icon {
        font-size: 20px;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .topbar {
        padding: 15px 20px;
    }
    
    .topbar h1 {
        font-size: 20px;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card .value {
        font-size: 28px;
    }
    
    .card-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* 表格移动端优化 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    thead {
        display: none;
    }
    
    tbody {
        display: block;
    }
    
    tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #f0f0f0;
        border-radius: 8px;
        padding: 15px;
        background: #fafafa;
    }
    
    td {
        display: block;
        padding: 8px 0;
        border: none;
        text-align: left;
    }
    
    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 12px;
        display: block;
        margin-bottom: 5px;
    }
    
    .btn {
        width: 100%;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 12px 15px;
    }
    
    .sidebar-header h2 {
        font-size: 16px;
    }
    
    .nav-item {
        padding: 10px 15px;
        font-size: 11px;
    }
    
    .icon {
        font-size: 18px;
    }
    
    .topbar {
        padding: 12px 15px;
    }
    
    .topbar h1 {
        font-size: 18px;
    }
    
    .content-area {
        padding: 12px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 13px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    tr {
        padding: 12px;
    }
}


/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

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

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.1);
}

.short-code-display {
    padding: 10px 12px;
    background: #f5f7fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

.btn-default {
    background: white;
    color: #666;
    border: 1px solid #d9d9d9;
}

.btn-default:hover {
    border-color: #667eea;
    color: #667eea;
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 320px;
    margin-top: 20px;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
}

/* 链接选择器 */
.link-selector {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.link-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.link-selector select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.link-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.1);
}

/* 链接统计表格 */
.links-stats-table {
    max-height: none;
    overflow-y: visible;
}

.links-stats-table table {
    width: 100%;
}

.link-code-cell {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.link-code-cell:hover {
    text-decoration: underline;
}

.clicks-badge-small {
    display: inline-block;
    background: #52c41a;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

/* 链接统计卡片 */
.link-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.link-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.link-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.link-stat-body {
    display: flex;
    gap: 20px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-item .stat-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.stat-item .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

@media (max-width: 768px) {
    .link-stat-card {
        padding: 15px;
    }
    
    .link-stat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .link-stat-body {
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px 5px;
    }
    
    .stat-item .stat-label {
        font-size: 11px;
    }
    
    .stat-item .stat-value {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .chart-container {
        height: 250px;
    }
}


/* 页面标题栏 */
.page-title-bar {
    margin-bottom: 20px;
}

.page-title-bar h2 {
    font-size: 24px;
    color: #2c3e50;
    font-weight: 600;
}

/* 时间切换标签 */
.time-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.time-tab {
    padding: 8px 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.time-tab:hover {
    border-color: #ff8c3c;
    color: #ff8c3c;
}

.time-tab.active {
    background: #ff8c3c;
    border-color: #ff8c3c;
    color: white;
}

/* 新的统计卡片样式 */
.stats-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
}

.stat-card-new {
    flex: 1;
    min-width: 0;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 5px solid;
    transition: all 0.3s;
}

.stat-card-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card-new.blue {
    border-left-color: #667eea;
}

.stat-card-new.green {
    border-left-color: #52c41a;
}

.stat-card-new.orange {
    border-left-color: #ff8c3c;
}

.stat-card-new .stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 500;
}

.stat-card-new .stat-number {
    font-size: 36px;
    font-weight: 700;
    font-family: 'Arial', sans-serif;
}

.stat-card-new.blue .stat-number {
    color: #667eea;
}

.stat-card-new.green .stat-number {
    color: #52c41a;
}

.stat-card-new.orange .stat-number {
    color: #ff8c3c;
}

@media (max-width: 768px) {
    .stats-cards {
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .stat-card-new {
        padding: 15px;
        min-width: 110px;
        flex-shrink: 0;
    }
    
    .stat-card-new .stat-label {
        font-size: 12px;
    }
    
    .stat-card-new .stat-number {
        font-size: 24px;
    }
    
    .time-tabs {
        gap: 8px;
    }
    
    .time-tab {
        padding: 6px 16px;
        font-size: 13px;
    }
}


/* 链接列表项 */
.link-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.link-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.link-code .label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.short-link {
    font-size: 16px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.short-link:hover {
    text-decoration: underline;
}

.clicks-badge {
    background: #52c41a;
    color: white;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.link-body {
    margin-bottom: 15px;
}

.link-url-section {
    margin-bottom: 15px;
}

.link-url-section .label,
.link-time .label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.url-display-simple {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.url-display-simple:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.url-label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.url-text-simple {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-hint {
    margin-left: 10px;
    color: #667eea;
    font-size: 12px;
    white-space: nowrap;
}

.current-url-display {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    word-break: break-all;
    line-height: 1.6;
    max-height: 100px;
    overflow-y: auto;
}

.link-time {
    margin-bottom: 0;
}

.time-text {
    font-size: 14px;
    color: #666;
}

/* 移除旧的编辑区域样式 */

.link-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-delete {
    padding: 8px 20px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #ff7875;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .link-item {
        padding: 15px;
    }
    
    .link-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .page-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-title-bar .btn {
        width: 100%;
    }
}


/* 自定义提示框 */
.custom-alert {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.custom-alert.show {
    display: flex;
}

.custom-alert-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: alertSlideIn 0.3s ease;
}

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

.custom-alert-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.custom-alert-message {
    font-size: 16px;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.custom-alert-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.custom-alert-btn:hover {
    background: #5568d3;
}

.custom-alert-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.custom-alert-buttons .btn {
    flex: 1;
    max-width: 120px;
}

.btn-danger {
    background: #ff4d4f;
    color: white;
}

.btn-danger:hover {
    background: #ff7875;
}
