/* ============================================
   会员密钥管理系统 - 通用样式
   响应式设计 + 现代美观UI
   ============================================ */

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #6366F1;
    --secondary: #8B5CF6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --dark: #1F2937;
    --light: #F3F4F6;
    --border: #E5E7EB;
    --text: #374151;
    --text-light: #6B7280;
    --bg: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.auth-container {
    max-width: 420px;
    margin: 60px auto;
}

/* ============================================
   卡片组件
   ============================================ */

.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

.card-header {
    border-bottom: 2px solid var(--light);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 20px 0;
}

/* ============================================
   表单样式
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control:disabled {
    background: var(--light);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* ============================================
   按钮样式
   ============================================ */

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* ============================================
   表格样式
   ============================================ */

.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

thead {
    background: var(--light);
}

th, td {
    padding: 12px 16px;
    text-align: left;
}

th {
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
}

td {
    border-bottom: 1px solid var(--light);
}

tbody tr:hover {
    background: var(--light);
}

/* ============================================
   徽章
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    color: white;
}

.badge-success {
    background: var(--success);
}

.badge-warning {
    background: var(--warning);
}

.badge-danger {
    background: var(--danger);
}

.badge-info {
    background: var(--info);
}

.badge-secondary {
    background: var(--text-light);
}

/* ============================================
   提示消息
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #D1FAE5;
    border-color: var(--success);
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    border-color: var(--danger);
    color: #991B1B;
}

.alert-warning {
    background: #FEF3C7;
    border-color: var(--warning);
    color: #92400E;
}

.alert-info {
    background: #DBEAFE;
    border-color: var(--info);
    color: #1E40AF;
}

/* ============================================
   导航栏
   ============================================ */

.navbar {
    background: white;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 16px 24px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.navbar-link:hover {
    color: var(--primary);
}

.navbar-link.active {
    color: var(--primary);
}

/* ============================================
   加载动画
   ============================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

/* ============================================
   工具类
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-light); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 600; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }

/* ============================================
   网格布局
   ============================================ */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
}

.col-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .navbar-menu {
        width: 100%;
        justify-content: center;
    }
    
    .row {
        flex-direction: column;
    }
    
    [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
}

/* ============================================
   特殊组件
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
}

.copy-btn {
    cursor: pointer;
    color: var(--primary);
    text-decoration: underline;
    transition: var(--transition);
}

.copy-btn:hover {
    color: var(--primary-dark);
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   VIP会员效果
   ============================================ */

.vip-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    animation: shimmer 2s infinite;
}

.vip-card {
    position: relative;
    overflow: hidden;
}

.vip-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 215, 0, 0.1),
        transparent
    );
    animation: vip-shine 3s infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes vip-shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* VIP等级边框特效 */
.vip-border {
    border: 2px solid;
    border-image: linear-gradient(135deg, #FFD700, #FFA500, #FFD700) 1;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* 用户标签样式 */
.user-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.user-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   管理端顶部折叠导航
   ============================================ */

.admin-top-bar {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.admin-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.admin-brand {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-nav {
    display: flex;
    gap: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.nav-dropdown-toggle:hover {
    background: var(--light);
    color: var(--primary);
}

.nav-dropdown-toggle.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: 5px;
}

.nav-dropdown.show .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-dropdown-item:hover {
    background: var(--light);
    border-left-color: var(--primary);
}

.nav-dropdown-item.active {
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
}

.nav-link-single {
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.nav-link-single:hover {
    background: var(--light);
    color: var(--primary);
}

.nav-link-single.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.dropdown-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.nav-dropdown.show .dropdown-icon {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-dropdown-toggle,
    .nav-link-single {
        width: 100%;
        text-align: left;
    }
    
    .nav-dropdown-menu {
        position: relative;
        box-shadow: none;
        margin-top: 0;
        border-top: 1px solid var(--border);
    }
}

