/**
 * 阿里云风格客户后台样式
 * 设计理念：科技感、简洁、专业、现代
 */

/* ========== CSS变量定义 ========== */
:root {
    /* 主色调 - 科技蓝 */
    --primary-color: #1677ff;
    --primary-light: #4096ff;
    --primary-dark: #0958d9;
    --primary-gradient: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    
    /* 辅助色 - 橙色 */
    --secondary-color: #ff6a00;
    --secondary-light: #ff8533;
    --secondary-dark: #e55c00;
    
    /* 背景色 - 白色主题 */
    --bg-dark: #f5f7fa;
    --bg-darker: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-input: #ffffff;
    
    /* 文字色 - 黑色主题 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    /* 边框色 */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    
    /* 状态色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(22, 119, 255, 0.15);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 过渡 */
    --transition: all 0.2s ease;
    --transition-slow: 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;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 布局结构 ========== */
.customer-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-dark);
}

/* ========== 侧边栏 ========== */
.customer-sidebar {
    width: 220px;
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    box-shadow: var(--shadow-glow);
}

.sidebar-header .logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-menu li {
    margin: 2px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 14px;
    position: relative;
    font-weight: 500;
}

.sidebar-menu li a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-menu li a.active {
    background: rgba(22, 119, 255, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.sidebar-menu li a svg,
.sidebar-menu li a .icon {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.sidebar-menu li a:hover svg,
.sidebar-menu li a:hover .icon {
    opacity: 1;
}

.sidebar-menu li span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 12px 8px;
    display: block;
}

/* ========== 主内容区 ========== */
.customer-main {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.customer-header {
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.header-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.header-breadcrumb a:hover {
    color: var(--primary-color);
}

.header-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
}

.header-search input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px 8px 36px;
    color: var(--text-primary);
    font-size: 14px;
    width: 200px;
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.header-search::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.header-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.user-info:hover {
    background: var(--bg-card);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.user-dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-dropdown-header .avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
}

.user-dropdown-header .info h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}

.user-dropdown-header .info p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.user-dropdown-menu {
    padding: 8px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.user-dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--primary-color);
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.user-dropdown-item:hover svg {
    color: var(--primary-color);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

.user-dropdown-item.danger {
    color: var(--error-color);
}

.user-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.user-dropdown-item.danger svg {
    color: var(--error-color);
}

/* ========== 内容区域 ========== */
.customer-content {
    flex: 1;
    padding: 24px;
    background: var(--bg-dark);
}

/* ========== 页面标题 ========== */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card .stat-icon.primary {
    background: rgba(22, 119, 255, 0.1);
    color: var(--primary-color);
}

.stat-card .stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card .stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card .stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-card .stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 12px;
}

.stat-card .stat-trend.up {
    color: var(--success-color);
}

.stat-card .stat-trend.down {
    color: var(--error-color);
}

/* ========== 数据卡片 ========== */
.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.data-card-actions {
    display: flex;
    gap: 8px;
}

.data-card-body {
    padding: 20px;
}

/* ========== 表格样式 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

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

/* ========== 状态标签 ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.active,
.status-badge.paid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.suspended,
.status-badge.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.status-badge.expired {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-muted);
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state .description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ========== 加载动画 ========== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 消息提示 ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-color);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-color);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

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

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .customer-sidebar {
        width: 60px;
    }
    
    .sidebar-header .logo-text,
    .sidebar-menu li a span:not(.icon-label),
    .sidebar-menu li span {
        display: none;
    }
    
    .customer-main {
        margin-left: 60px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .customer-content {
        padding: 16px;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ========== 科技感装饰 ========== */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(22, 119, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 119, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.glow-effect {
    position: relative;
}

.glow-effect::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-gradient);
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    filter: blur(10px);
    transition: var(--transition);
}

.glow-effect:hover::after {
    opacity: 0.3;
}
