/* 
 * 寻址网名系统 - 统一样式表
 * Author: Xunzhi System
 */

/* ==================== 变量定义 ==================== */
:root {
    /* 主色调 */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    
    /* 辅助色 */
    --secondary-color: #6366f1;
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    
    /* Admin 主题色 */
    --admin-primary: #ef4444;
    --admin-primary-hover: #dc2626;
    --admin-secondary: #f87171;
    --admin-dark-bg: #111827;
    
    /* 状态色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 中性色 */
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --muted-color: #6b7280;
    --border-color: #e2e8f0;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* 圆角 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ==================== 基础样式 ==================== */
body {
    background-color: var(--light-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #f3f4f6;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #f3f4f6;
    }
    
    .table {
        --bs-table-bg: #2d2d2d;
        --bs-table-color: #f3f4f6;
    }
    
    .form-control, .form-select {
        background-color: #3d3d3d;
        border-color: #4d4d4d;
        color: #f3f4f6;
    }
    
    .navbar {
        background-color: #1f2937 !important;
    }
    
    .sidebar {
        background-color: #2d2d2d;
    }
    
    .text-muted {
        color: #9ca3af !important;
    }
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: rgba(26, 32, 44, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.25rem;
}

.lang-switch {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    transition: all var(--transition-fast);
}

.lang-switch:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    min-height: 100vh;
    background: white;
    box-shadow: var(--shadow-lg);
}

@media (prefers-color-scheme: dark) {
    .sidebar {
        background: #2d2d2d;
    }
}

.sidebar .nav-link {
    color: var(--muted-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin: 0.25rem 0;
    transition: all var(--transition-fast);
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* 用户中心侧边栏链接 */
.sidebar-link {
    border-radius: var(--radius-xl);
    margin-bottom: 0.5rem;
    border: none;
    transition: all var(--transition-normal);
    padding: 0.8rem 1.25rem;
    font-weight: 500;
    color: #4b5563;
}

.sidebar-link:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    border: none;
    color: white !important;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

/* Admin 后台侧边栏链接 */
.admin-sidebar-link {
    border-radius: var(--radius-lg);
    margin-bottom: 0.4rem;
    border: none;
    transition: all var(--transition-fast);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    color: #4b5563;
}

.admin-sidebar-link:hover {
    background-color: #fee2e2;
    color: var(--admin-primary);
}

.admin-sidebar-link.active {
    background: var(--admin-primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* 粘性侧边栏 */
@media (min-width: 992px) {
    .sidebar-sticky {
        position: sticky;
        top: 1.5rem;
        height: calc(100vh - 100px);
        overflow-y: auto;
    }
}

/* ==================== 卡片 ==================== */
.card {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    background: #fff;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
}

/* ==================== 按钮 ==================== */
.btn {
    border-radius: var(--radius-md);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #6d28d9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-color), #fbbf24);
    border: none;
    color: #1f2937;
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--accent-hover), #f59e0b);
    transform: translateY(-2px);
}

.btn-search {
    border-radius: 1.25rem;
    padding: 0.75rem 2.5rem;
    font-weight: 600;
    background: var(--accent-color);
    border: none;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.4);
    transition: all var(--transition-normal);
}

.btn-search:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(245, 158, 11, 0.5);
    color: #fff;
}

/* Admin 主题按钮 */
.btn-admin-primary {
    background-color: var(--admin-primary);
    border: none;
    color: white;
}

.btn-admin-primary:hover {
    background-color: var(--admin-primary-hover);
}

/* ==================== 表单 ==================== */
.form-control, .form-select {
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control-lg {
    border-radius: 1.25rem;
    border: none;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
}

/* ==================== 表格 ==================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f9fafb;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #6b7280;
    border: none;
    padding: 1rem;
}

.table tbody td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.table-hover tbody tr {
    transition: all var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: var(--primary-light);
}

/* ==================== 徽章 ==================== */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

/* ==================== 英雄区域 ==================== */
.hero {
    background: var(--primary-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.5) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.5) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.5) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(79, 70, 229, 0.5) 0px, transparent 50%);
    color: white;
    padding: 100px 0 0;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--light-color), transparent);
    z-index: 1;
}

.search-bar-wrap {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 2;
}

/* ==================== 功能卡片 ==================== */
.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    transition: all var(--transition-normal);
}

.card:hover .feature-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

/* ==================== 最新列表 ==================== */
.latest-item {
    border: none;
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 0.5rem;
    transition: all var(--transition-fast);
}

.latest-item:hover {
    background: #f3f4f6;
}

/* ==================== 代码块 ==================== */
code {
    background: #f1f5f9;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    display: block;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    border-bottom: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-bottom-color: var(--primary-color);
}

@media (prefers-color-scheme: dark) {
    .stat-card {
        background: #2d2d2d;
    }
}

/* ==================== 登录/注册页面 ==================== */
.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.auth-visual {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form {
    padding: 3rem;
}

.auth-visual, .auth-form {
    position: relative;
}

@media (max-width: 768px) {
    .auth-visual {
        padding: 2rem;
    }
    .auth-form {
        padding: 1.5rem;
    }
}

/* 登录卡片特殊样式 */
.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.brand-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05) rotate(5deg);
}

.input-group {
    background: #ffffff;
    border-radius: 1rem;
    border: 1.5px solid #e5e7eb;
    transition: all 0.2s ease;
    overflow: hidden;
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.input-group-text {
    background: transparent;
    border: none;
    color: #9ca3af;
    padding-left: 1.25rem;
    padding-right: 0.75rem;
}

.back-home {
    position: absolute;
    top: 2rem;
    left: 2rem;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.back-home:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
}

/* ==================== 加载动画 ==================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== 按钮加载状态 ==================== */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-left: 0.5em;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 响应式工具 ==================== */
@media (max-width: 768px) {
    .hero {
        padding: 80px 0 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .card {
        border-radius: var(--radius-lg);
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .back-home {
        top: 1rem;
        left: 1rem;
    }
}

/* ==================== 页脚 ==================== */
footer {
    margin-top: auto;
}

/* ==================== 下拉菜单 ==================== */
.dropdown-menu {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* ==================== 警告框 ==================== */
.alert {
    border: none;
    border-radius: var(--radius-md);
}

/* ==================== 标题样式 ==================== */
.section-title {
    position: relative;
    display: inline-block;
    margin-bottom: 3rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* ==================== 价格标签 ==================== */
.price-tag {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--danger-color);
}

/* ==================== 主容器 ==================== */
.main-container {
    flex: 1;
}

/* ==================== Language Switcher ==================== */
.lang-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-switcher a {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s;
    display: inline-block;
}

.lang-switcher a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

/* ==================== QR Code 样式 ==================== */
.qr-code {
    max-width: 200px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
}

/* ==================== Admin 后台特定样式 ==================== */
.admin-body {
    background-color: #f9fafb;
}

.admin-navbar {
    background: var(--admin-dark-bg) !important;
    padding: 0.75rem 0;
}

.admin-stat-card {
    border-bottom: 4px solid transparent;
    transition: all 0.3s;
}

.admin-stat-card:hover {
    transform: translateY(-5px);
    border-bottom-color: var(--admin-primary);
}

.admin-code {
    background: #fee2e2;
    color: var(--admin-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
}

/* ==================== User Dashboard 特定样式 ==================== */
.user-body {
    background: #f3f4f6;
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%);
}

.user-navbar {
    background: rgba(26, 32, 44, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
}

.user-card {
    border: none;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.user-badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-weight: 600;
}

/* ==================== DataTables 自定义 ==================== */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    color: #6b7280;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border: 1px solid var(--primary-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
}