@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Apple-inspired Color Palette */
    --apple-blue: #0071e3;
    --apple-blue-light: #2997ff;
    --apple-purple: #bf5af2;
    --apple-pink: #ff375f;
    --apple-orange: #ff9f0a;
    --apple-green: #30d158;
    --apple-teal: #64d2ff;

    /* Neutral Colors */
    --gray-50: #fafafa;
    --gray-100: #f5f5f7;
    --gray-200: #e8e8ed;
    --gray-300: #d2d2d7;
    --gray-400: #aeaeb2;
    --gray-500: #86868b;
    --gray-600: #6e6e73;
    --gray-700: #48484a;
    --gray-800: #3a3a3c;
    --gray-900: #1d1d1f;

    /* Semantic Colors */
    --bg-primary: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-bg-hover: rgba(255, 255, 255, 0.95);
    --input-bg: rgba(142, 142, 147, 0.12);
    --input-bg-hover: rgba(142, 142, 147, 0.16);

    /* Text */
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #aeaeb2;

    /* Effects */
    --radius-xs: 8px;
    --radius-s: 12px;
    --radius-m: 16px;
    --radius-l: 22px;
    --radius-xl: 32px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.16);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* 极光背景 - 性能优化版 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 60% 60% at 10% 10%, rgba(0, 122, 255, 0.35), transparent 50%),
        radial-gradient(ellipse 50% 50% at 90% 20%, rgba(175, 82, 222, 0.30), transparent 50%),
        radial-gradient(ellipse 55% 55% at 80% 80%, rgba(52, 199, 89, 0.20), transparent 50%),
        radial-gradient(ellipse 45% 45% at 5% 75%, rgba(255, 149, 0, 0.15), transparent 50%);
    filter: blur(40px);
    /* 直接应用模糊，替代成本更高的 backdrop-filter */
    z-index: -2;
    animation: auroraMove 25s ease-in-out infinite alternate;
    will-change: transform;
    /* GPU 加速提示 */
    contain: strict;
    /* 布局隔离 */
}

@keyframes auroraMove {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(2%, 1%) scale(1.02);
    }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    /* 简单白色覆盖层，无模糊 */
    z-index: -1;
    pointer-events: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    z-index: 1;
    transition: max-width 0.4s var(--ease-out-expo);
}

.container.wide {
    max-width: 1100px;
}

/* Logo */
/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-wrapper {
    width: 180px;
    height: auto;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #007AFF 0%, #AF52DE 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
    display: inline-block;
}



.logo-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 36px;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.02),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 16px 32px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
    margin-bottom: 8px;
    color: var(--gray-900);
}

h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--gray-900);
}

h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 40px;
}

/* Inputs - 精致输入框 */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

input,
select {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    background: #FAFAFA;
    border: 1.5px solid #E5E5E5;
    border-radius: 14px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

input:hover,
select:hover {
    border-color: #D0D0D0;
    background: #F5F5F5;
}

input:focus,
select:focus {
    background: white;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

input::placeholder {
    color: #A0A0A0;
    font-weight: 400;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 50px;
}

.error-message {
    color: var(--apple-pink);
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
    display: none;
}

/* Buttons - 精致按钮 */
button {
    width: 100%;
    padding: 16px 28px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(180deg, #0A84FF 0%, #007AFF 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

button:hover {
    background: linear-gradient(180deg, #3399FF 0%, #0A84FF 100%);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.35);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #F0F0F0;
    color: #333;
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 10px;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #E5E5E5;
    box-shadow: none;
    transform: translateY(-1px);
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #E8E8E8;
}

/* Stats Grid - 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: linear-gradient(135deg, #FAFBFC 0%, #F5F6F8 100%);
    padding: 24px 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #E8E8E8;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: linear-gradient(135deg, #F5F6F8 0%, #ECEEF0 100%);
    border-color: #D8D8D8;
}

.stat-card h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: #666;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* Settings Panel */
.settings-panel {
    background: #F8F9FA;
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
    border: 1px solid #E8E8E8;
}

/* Collapsible Cards - 可折叠卡片 */
.collapsible-card {
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid #E8E8E8;
    margin-bottom: 20px;
}

.collapsible-header:hover {
    opacity: 0.7;
}

.collapse-icon {
    font-size: 10px;
    margin-left: 10px;
    transition: transform 0.3s ease;
    color: #888;
}

.collapsible-card.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-card.collapsed .collapsible-header {
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s;
    opacity: 1;
}

.collapsible-card.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
}

/* Link List */
.link-list {
    display: flex;
    flex-direction: column;
    background: #FAFAFA;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #E8E8E8;
}

.link-item {
    padding: 18px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid #EEEEEE;
    transition: background 0.2s;
    background: white;
}

.link-item:last-child {
    border-bottom: none;
}

.link-item:hover {
    background: #F8F9FA;
}

.link-info {
    flex: 1 1 280px;
    min-width: 0;
}

.link-slug {
    font-size: 16px;
    font-weight: 600;
    color: var(--apple-blue);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.link-slug:hover {
    color: var(--apple-purple);
}

.link-origin {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    display: block;
    line-height: 1.4;
}

.link-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--apple-orange), var(--apple-pink));
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Action Buttons */
.actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.actions button {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 99px;
    font-weight: 500;
}

.delete-btn {
    background: rgba(255, 55, 95, 0.1) !important;
    color: var(--apple-pink) !important;
}

.delete-btn:hover {
    background: var(--apple-pink) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 55, 95, 0.3) !important;
}

.note-btn {
    background: rgba(255, 159, 10, 0.1) !important;
    color: var(--apple-orange) !important;
}

.note-btn:hover {
    background: var(--apple-orange) !important;
    color: white !important;
}

.edit-btn {
    background: rgba(0, 113, 227, 0.1) !important;
    color: var(--apple-blue) !important;
}

.edit-btn:hover {
    background: var(--apple-blue) !important;
    color: white !important;
}

/* Result Area - 结果展示区 */
.result {
    margin-top: 24px;
    padding: 24px;
    background: rgba(0, 122, 255, 0.04);
    border-radius: var(--radius-m);
    text-align: center;
    display: none;
    border: 1px solid rgba(0, 122, 255, 0.1);
}

.result.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.success-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.short-url {
    font-family: "SF Mono", ui-monospace, monospace;
    font-size: 16px;
    font-weight: 600;
    color: var(--apple-blue);
    margin: 12px 0 20px;
    display: block;
    word-break: break-all;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-xs);
    text-decoration: none;
    transition: background 0.2s;
}

.short-url:hover {
    background: rgba(0, 0, 0, 0.06);
}

.copy-btn {
    background: var(--apple-blue) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--radius-xs) !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
    width: auto !important;
}

.copy-btn:hover {
    background: #0077ED !important;
}

/* Toast - 轻量通知 */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    pointer-events: auto;
    background: var(--gray-900);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.25s ease;
}

.toast.error {
    background: var(--apple-pink);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    margin-top: 48px;
    text-align: center;
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.2s both;
}

footer p {
    font-size: 13px;
    color: var(--text-tertiary);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

footer a:hover {
    color: var(--apple-blue);
}

/* Visits List - 访问记录列表 */
.visits-list {
    display: flex;
    flex-direction: column;
    background: #FAFAFA;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #E8E8E8;
}

.visit-item {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid #EEEEEE;
    transition: background 0.2s;
    background: white;
}

.visit-item:last-child {
    border-bottom: none;
}

.visit-item:hover {
    background: #F8F9FA;
}

.visit-info {
    flex: 1;
    min-width: 0;
}

.visit-slug {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.visit-slug a {
    font-size: 15px;
    font-weight: 600;
    color: #007AFF;
    text-decoration: none;
    transition: color 0.2s;
}

.visit-slug a:hover {
    color: #5856D6;
}

.visit-badge {
    font-size: 14px;
}

.visit-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.visit-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: #F0F0F0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.visit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: #888;
}

.visit-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Checkbox Styling */
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--gray-300);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    accent-color: var(--apple-blue);
}

input[type="checkbox"]:checked {
    background: var(--apple-blue);
    border-color: var(--apple-blue);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-bottom: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0.8;
}

footer a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-blue);
}

/* Responsive */
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .card {
        padding: 28px 20px;
    }

    .logo-text {
        font-size: 36px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 26px;
    }

    .actions {
        flex-wrap: wrap;
    }

    .link-item {
        flex-direction: column;
        align-items: stretch;
    }

    .collapsible-header {
        flex-direction: column;
        align-items: flex-start;
    }
}