/* ===== 重置与基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ===== 顶部导航 ===== */
.topbar {
    background: #1a1a1a;
    color: #fff;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo-icon { font-size: 22px; }
.search-form {
    flex: 1;
    display: flex;
    gap: 0;
}
.search-form input {
    flex: 1;
    padding: 8px 14px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}
.search-form button {
    padding: 8px 18px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.search-form button:hover { background: #0052a3; }
.nav-links a {
    color: #ccc;
    font-size: 14px;
    white-space: nowrap;
}
.nav-links a:hover { color: #fff; }

/* ===== 首页 Hero ===== */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
}
.hero h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #1a1a1a;
}
.hero .subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 32px;
}
.save-form {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}
.save-form input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #ddd;
    border-right: none;
    font-size: 16px;
    outline: none;
    background: #fff;
}
.save-form input:focus { border-color: #0066cc; }
.save-form button {
    padding: 14px 28px;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #1a1a1a;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}
.save-form button:hover { background: #333; }

.stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 36px;
}
.stat-item { text-align: center; }
.stat-num {
    font-size: 32px;
    font-weight: 800;
    color: #1a1a1a;
}
.stat-label {
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== 最近存档 ===== */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #1a1a1a;
}
.archive-list {
    list-style: none;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.archive-item {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.archive-item:last-child { border-bottom: none; }
.archive-item:hover { background: #f9f9f9; }
.archive-info { flex: 1; min-width: 0; }
.archive-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.archive-url {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.archive-meta {
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
    color: #666;
}
.archive-meta .count {
    display: inline-block;
    background: #e8f0fe;
    color: #0066cc;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
}
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== URL 详情页 ===== */
.url-header {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    margin: 24px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.url-header h2 {
    font-size: 18px;
    margin-bottom: 8px;
    word-break: break-all;
}
.url-header .url-link {
    font-size: 14px;
    color: #0066cc;
    word-break: break-all;
}
.url-stats {
    display: flex;
    gap: 32px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.url-stat { font-size: 14px; }
.url-stat .label { color: #888; margin-right: 6px; }
.url-stat .value { font-weight: 600; }

.save-again {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-align: center;
}
.btn-primary { background: #1a1a1a; color: #fff; }
.btn-primary:hover { background: #333; text-decoration: none; }
.btn-outline { background: #fff; color: #1a1a1a; border: 1px solid #ccc; }
.btn-outline:hover { background: #f5f5f5; text-decoration: none; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }

/* ===== 日历 ===== */
.calendar-section { margin: 24px 0; }
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}
.calendar-nav button {
    background: #fff;
    border: 1px solid #ddd;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.calendar-nav button:hover { background: #f5f5f5; }
.calendar-nav .current { font-weight: 700; font-size: 18px; min-width: 120px; text-align: center; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.cal-day-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    padding: 6px 0;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 13px;
    cursor: default;
    position: relative;
    background: #f9f9f9;
}
.cal-day.empty { background: transparent; }
.cal-day.has-archive {
    background: #0066cc;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}
.cal-day.has-archive:hover { background: #0052a3; }
.cal-day .dot-count {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 1px;
}
.cal-day.today { border: 2px solid #1a1a1a; }

/* ===== 快照时间线 ===== */
.timeline-section { margin: 24px 0; }
.timeline {
    list-style: none;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.timeline-item {
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 16px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item:hover { background: #f9f9f9; }
.timeline-time {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 13px;
    color: #0066cc;
    font-weight: 600;
    min-width: 170px;
}
.timeline-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.timeline-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.status-200 { background: #d4edda; color: #155724; }
.status-other { background: #fff3cd; color: #856404; }
.timeline-actions { display: flex; gap: 6px; }
.timeline-actions .btn { padding: 4px 10px; font-size: 12px; }

/* ===== 快照查看页 ===== */
.snapshot-toolbar {
    background: #1a1a1a;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 200;
}
.snapshot-toolbar .tb-logo {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}
.snapshot-toolbar .tb-url {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
    min-width: 200px;
}
.snapshot-toolbar .tb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.snapshot-toolbar .tb-nav button,
.snapshot-toolbar .tb-nav a {
    background: #333;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}
.snapshot-toolbar .tb-nav button:hover,
.snapshot-toolbar .tb-nav a:hover { background: #444; }
.snapshot-toolbar .tb-counter {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
}
.snapshot-toolbar .tb-time {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
    font-family: monospace;
}
.snapshot-frame-wrap {
    flex: 1;
    background: #fff;
}
.snapshot-frame {
    width: 100%;
    height: calc(100vh - 50px);
    border: none;
    display: block;
}

/* ===== 搜索结果页 ===== */
.search-header {
    margin: 24px 0 16px;
}
.search-header h2 { font-size: 22px; margin-bottom: 4px; }
.search-header .result-count { color: #888; font-size: 14px; }

/* ===== 错误页 ===== */
.error-box {
    text-align: center;
    padding: 80px 20px;
}
.error-box .code {
    font-size: 72px;
    font-weight: 800;
    color: #dc3545;
}
.error-box .msg {
    font-size: 18px;
    color: #666;
    margin: 16px 0 24px;
}

/* ===== Footer ===== */
.footer {
    background: #1a1a1a;
    color: #888;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    font-size: 13px;
}

/* ===== 响应式 / 手机端适配 ===== */
@media (max-width: 768px), .is-mobile {
    /* 全局 */
    .container { padding: 0 12px; }

    /* 顶部导航栏 */
    .topbar { padding: 8px 0; }
    .topbar-inner { flex-wrap: wrap; gap: 8px; }
    .logo { font-size: 16px; }
    .logo-icon { font-size: 18px; }
    .search-form { order: 3; width: 100%; }
    .search-form input { padding: 7px 10px; font-size: 13px; }
    .search-form button { padding: 7px 14px; font-size: 13px; }
    .nav-links a { font-size: 13px; }

    /* 首页 Hero */
    .hero { padding: 32px 12px 24px; }
    .hero h1 { font-size: 26px; margin-bottom: 6px; }
    .hero .subtitle { font-size: 13px; margin-bottom: 20px; }
    .save-form { flex-direction: column; box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
    .save-form input {
        border-right: 2px solid #ddd;
        border-bottom: none;
        border-radius: 8px 8px 0 0;
        padding: 12px 14px;
        font-size: 15px;
    }
    .save-form button {
        border-radius: 0 0 8px 8px;
        padding: 12px;
        font-size: 15px;
        width: 100%;
    }
    .stats { gap: 32px; margin-top: 24px; }
    .stat-num { font-size: 24px; }
    .stat-label { font-size: 11px; }

    /* 区块标题 */
    .section-title { font-size: 17px; margin: 28px 0 12px; }

    /* 存档列表 */
    .archive-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px 16px;
    }
    .archive-info { width: 100%; }
    .archive-title { font-size: 14px; }
    .archive-url { font-size: 12px; }
    .archive-meta {
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        font-size: 12px;
        width: 100%;
    }
    .archive-meta .count { margin-bottom: 0; }

    /* URL 详情页 */
    .url-header { padding: 16px; margin: 16px 0; }
    .url-header h2 { font-size: 15px; line-height: 1.4; }
    .url-header .url-link { font-size: 12px; word-break: break-all; }
    .url-stats {
        gap: 12px 20px;
        margin-top: 12px;
        font-size: 12px;
    }
    .url-stat { min-width: 40%; }
    .save-again { flex-wrap: wrap; gap: 8px; }
    .save-again .btn { flex: 1; min-width: 120px; padding: 8px 12px; font-size: 13px; }

    /* 日历 */
    .calendar-section { margin: 16px 0; }
    .calendar-nav { gap: 8px; margin-bottom: 10px; }
    .calendar-nav button { padding: 5px 10px; font-size: 12px; }
    .calendar-nav .current { font-size: 15px; min-width: 90px; }
    .calendar-grid { padding: 8px; gap: 2px; }
    .cal-day-name { font-size: 10px; padding: 4px 0; }
    .cal-day { font-size: 11px; }
    .cal-day .dot-count { font-size: 9px; }

    /* 快照时间线 */
    .timeline-section { margin: 16px 0; }
    .timeline-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }
    .timeline-time {
        min-width: auto;
        font-size: 12px;
        width: 100%;
    }
    .timeline-title {
        width: 100%;
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
    }
    .timeline-status { font-size: 11px; }
    .timeline-actions { margin-left: auto; }
    .timeline-actions .btn { padding: 4px 10px; font-size: 12px; }

    /* 快照查看页工具栏 */
    .snapshot-toolbar {
        padding: 8px 10px;
        gap: 6px;
        flex-wrap: wrap;
    }
    .snapshot-toolbar .tb-logo { font-size: 13px; }
    .snapshot-toolbar .tb-url {
        order: 5;
        width: 100%;
        font-size: 11px;
        min-width: 0;
    }
    .snapshot-toolbar .tb-nav button,
    .snapshot-toolbar .tb-nav a {
        padding: 4px 8px;
        font-size: 11px;
    }
    .snapshot-toolbar .tb-counter { font-size: 11px; }
    .snapshot-toolbar .tb-time { font-size: 11px; }
    .snapshot-toolbar .btn { padding: 4px 10px !important; font-size: 11px !important; }
    .snapshot-frame { height: calc(100vh - 90px); }

    /* 搜索页 */
    .search-header { margin: 16px 0 12px; }
    .search-header h2 { font-size: 18px; }
    .search-header .result-count { font-size: 12px; }

    /* 错误页 */
    .error-box { padding: 48px 16px; }
    .error-box .code { font-size: 56px; }
    .error-box .msg { font-size: 15px; }

    /* 空状态 */
    .empty-state { padding: 40px 16px; }
    .empty-state .icon { font-size: 40px; }
}

/* ===== 按钮加载动画 ===== */
button.is-loading {
    pointer-events: none;
    opacity: 0.85;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: wait;
}
.save-form button.is-loading {
    gap: 8px;
}
.spin-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin-rotate 0.7s linear infinite;
    flex-shrink: 0;
}
.btn-outline .spin-icon,
button.btn-outline.is-loading .spin-icon {
    border-color: rgba(26, 26, 26, 0.25);
    border-top-color: #1a1a1a;
}
.btn-label {
    display: inline-block;
}
@keyframes spin-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== 管理员登录弹窗 ===== */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.admin-modal-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.admin-modal-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
}
.admin-modal-box h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #1a1a1a;
}
.admin-modal-tip {
    margin: 0 0 20px;
    font-size: 13px;
    color: #888;
}
.admin-modal-box input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.admin-modal-box input:focus {
    border-color: #00a1d6;
}
.admin-modal-error {
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #fdf0ef;
    border-radius: 4px;
}
.admin-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}
.admin-modal-actions .btn {
    padding: 8px 20px;
    font-size: 14px;
}
