/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6F1E86;
    --primary-dark: #4a1459;
    --primary-light: #9c4db3;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e5e5;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--primary);
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 30, 134, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 30, 134, 0.1);
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
}

/* ===== 提示框 ===== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.alert-error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* ===== 登录页面 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    display: flex;
    background: var(--surface);
    border-radius: 20px;
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    min-height: 500px;
    box-shadow: var(--shadow-lg);
}

.login-box {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-header .logo-text {
    color: white;
    font-size: 28px;
    font-weight: 700;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    flex: 1;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.forgot-link {
    font-size: 14px;
    color: var(--primary);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.login-info {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-info h2 {
    font-size: 28px;
    margin-bottom: 24px;
}

.login-info ul {
    list-style: none;
}

.login-info li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 15px;
}

.login-info li i {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

@media (max-width: 768px) {
    .login-info {
        display: none;
    }
}

/* ===== 后台布局 ===== */
.admin-page {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo-text {
    color: white;
    font-size: 20px;
    font-weight: 700;
}

.sidebar-header .brand {
    font-weight: 600;
    font-size: 18px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 15px;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(111, 30, 134, 0.1);
    color: var(--primary);
}

.nav-item i {
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--bg);
    color: var(--danger);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 700;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.green { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-icon.purple { background: linear-gradient(135deg, #6F1E86, #9c4db3); }
.stat-icon.orange { background: linear-gradient(135deg, #f093fb, #f5576c); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* 内容区块 */
.content-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.content-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* 链接列表 */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s;
}

.link-card:hover {
    box-shadow: var(--shadow);
}

.link-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.preview-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
    flex-shrink: 0;
}

.preview-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-info .short-url {
    font-size: 13px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-info .short-url i {
    font-size: 11px;
}

.link-stats {
    display: flex;
    gap: 24px;
}

.link-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.link-stats .stat i {
    color: var(--text-muted);
}

.link-actions {
    display: flex;
    gap: 8px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .link-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .link-stats {
        width: 100%;
    }
}
