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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --dark-light: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== Navbar ========== */
.navbar {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: var(--dark);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: '◆';
    color: var(--primary);
    font-size: 1.2rem;
}

/* 桌面端导航 */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-nav a {
    color: var(--gray);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.desktop-nav a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.desktop-nav .btn-nav {
    background: var(--primary);
    color: white !important;
    padding: 8px 20px;
}

.desktop-nav .btn-nav:hover {
    background: var(--primary-dark);
}

.balance-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 8px;
}

/* 手机端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 5px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--bg);
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: all 0.3s;
}

/* 手机端菜单 */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: white;
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.mobile-site-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.mobile-menu-close:hover {
    background: var(--bg);
    color: var(--dark);
}

.mobile-user-info {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-bg), #ffffff);
    border-bottom: 1px solid var(--border);
}

.mobile-username {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.mobile-balance {
    display: block;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 500;
}

.mobile-nav-links {
    padding: 12px 0;
}

.mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.mobile-nav-links a:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-left-color: var(--primary);
}

.mobile-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.mobile-logout {
    color: var(--danger) !important;
}

.mobile-logout:hover {
    background: #fef2f2 !important;
    border-left-color: var(--danger) !important;
}

/* 遮罩层 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

body.menu-open {
    overflow: hidden;
}

/* ========== Main Content ========== */
.main-content {
    min-height: calc(100vh - 64px - 60px);
    padding: 32px 24px;
}

/* ========== Footer ========== */
.footer {
    background: #ffffff;
    color: var(--gray-light);
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ========== Cards ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 16px;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: all 0.2s;
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--gray-light);
}

select.form-control {
    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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.form-control {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

/* ========== Link Type Select ========== */
.link-type-select-wrapper {
    position: relative;
}

.link-type-select {
    height: 48px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    transition: all 0.2s;
}

.link-type-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.type-info-box {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.type-info-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.type-info-label {
    color: var(--gray);
    font-weight: 500;
}

.type-info-box code {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: monospace;
}

.type-price {
    color: var(--success);
    font-weight: 600;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 12px -2px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 12px -2px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.btn-secondary {
    background: var(--border);
    color: var(--dark);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* ========== Alerts ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before {
    font-weight: bold;
    font-size: 1.1rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-success::before { content: '✓'; }

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-error::before { content: '✕'; }

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ========== Tables ========== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: left;
}

.table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    border-bottom: 1px solid var(--border);
}

.table td {
    border-bottom: 1px solid var(--border);
    color: var(--dark-light);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: #f8fafc;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.stat-card h3 {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

/* ========== Status badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ========== Admin Nav ========== */
.admin-nav {
    background: var(--card-bg);
    padding: 0;
    margin-bottom: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    overflow: hidden;
}

.admin-nav a {
    color: var(--gray);
    text-decoration: none;
    padding: 16px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--primary);
    background: var(--primary-bg);
    border-bottom-color: var(--primary);
}

/* ========== Price tag ========== */
.price-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ========== Empty state ========== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========== Login/Register card ========== */
.auth-card {
    max-width: 440px;
    margin: 48px auto;
}

.auth-card .logo-center {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .logo-center h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: 16px;
}

.auth-card .logo-center p {
    color: var(--gray);
    margin-top: 8px;
    font-size: 0.9rem;
}

/* ========== Hero section ========== */
.hero {
    text-align: center;
    padding: 64px 24px;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    border-radius: var(--radius);
    margin-bottom: 32px;
    color: var(--dark);
    position: relative;
    border: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    position: relative;
    color: var(--dark);
    z-index: 1;
}

.hero p {
    font-size: 1.1rem;
    color: var(--gray);
    max-width: 500px;
    margin: 0 auto 32px;
    position: relative;
    z-index: 1;
}

.hero .btn {
    position: relative;
    z-index: 2;
}

/* ========== Link type cards ========== */
.link-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.link-type-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.link-type-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.link-type-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.link-type-card .prefix {
    font-size: 0.85rem;
    color: var(--gray);
    font-family: monospace;
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 12px;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a {
    background: var(--card-bg);
    color: var(--dark);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    color: white;
}

/* ========== Filter tabs ========== */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tabs a {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
    background: var(--bg);
    color: var(--gray);
    border: 1px solid var(--border);
}

.filter-tabs a:hover,
.filter-tabs a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ========== Mobile Card Styles ========== */
.mobile-card-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-card-row:last-child {
    border-bottom: none;
}

.mobile-label {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 12px;
}

.mobile-value {
    font-size: 0.9rem;
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.4s ease-out;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    /* 导航栏 */
    .navbar .container {
        height: 56px;
        padding: 0 16px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .desktop-nav {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu {
        display: block;
    }
    
    /* 主内容区 */
    .main-content {
        padding: 16px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    /* 卡片 */
    .card {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: var(--radius-sm);
    }
    
    .card h2 {
        font-size: 1.1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card h3 {
        font-size: 0.7rem;
    }
    
    .stat-card .number {
        font-size: 1.5rem;
    }
    
    /* Hero */
    .hero {
        padding: 40px 20px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    /* 表格 */
    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    /* 链接类型 */
    .link-type-grid {
        grid-template-columns: 1fr;
    }
    
    .type-info-box {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 分页 */
    .pagination {
        flex-wrap: wrap;
    }
    
    .pagination a,
    .pagination span {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    /* 筛选标签 */
    .filter-tabs {
        gap: 6px;
    }
    
    .filter-tabs a {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
    
    /* 页面标题 */
    .page-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    
    .page-header h1 {
        font-size: 1.4rem;
    }
    
    /* 表单 */
    .form-control {
        padding: 10px 14px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    /* 按钮 */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .btn-sm {
        padding: 5px 12px;
        font-size: 0.8rem;
        width: auto;
    }
    
    /* 公告 */
    .announcement-box {
        padding: 16px !important;
        margin-bottom: 16px !important;
    }
    
    .announcement-box h3 {
        font-size: 1rem !important;
    }
    
    /* 管理员导航 */
    .admin-nav {
        flex-wrap: wrap;
    }
    
    .admin-nav a {
        padding: 12px 16px;
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 1.25rem;
    }
    
    .card {
        padding: 16px;
    }
}
