/* 用户端统一响应式样式 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
}

/* 头部样式 */
.user-header {
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #ddd;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.site-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 700;
}

.site-title .badge {
    background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.6em;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #2c3e50;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(9px, 9px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.user-nav {
    padding: 10px 0;
}

.user-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.user-nav li {
    margin: 0;
}

.user-nav a {
    display: block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.user-nav a:hover,
.user-nav a.active {
    background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 123, 84, 0.4);
}

/* 主内容区域 */
.user-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 2.2em;
    font-weight: 600;
}

.user-info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.balance, .concurrency {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: white;
    color: #2c3e50;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    min-width: 120px;
}

.balance span, .concurrency span {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
}

.balance strong, .concurrency strong {
    font-size: 1.3em;
    font-weight: 700;
}

/* 内容卡片 */
.content-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border: 1px solid #f0f0f0;
    margin-bottom: 30px;
}

.content-card h3 {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    position: relative;
}

.content-card h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, #ff7b54 0%, #ff6b35 100%);
}

/* Tab导航样式 */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
    gap: 5px;
    flex-wrap: wrap;
}

.tab-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 25px 25px 0 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.tab-btn:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 123, 84, 0.4);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.data-table thead {
    background: linear-gradient(135deg, #343a40 0%, #212529 100%);
    color: white;
}

.data-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
}

.data-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

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

/* 状态徽章 */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active, .email-status-active {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-inactive, .email-status-inactive {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.email-status-exhausted {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.email-status-expired {
    background-color: #e9ecef;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 123, 84, 0.4);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.6);
    text-decoration: none;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85em;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #ff7b54;
    box-shadow: 0 0 0 3px rgba(255, 123, 84, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
    appearance: none;
}

/* 警告和提示 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background-color: #cce7ff;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.3s ease;
}

.close:hover {
    color: #dc3545;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 30px 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff7b54 0%, #ff6b35 100%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.stat-label {
    color: #6c757d;
    font-size: 1.1em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 邮箱管理特殊样式 */
.email-tables-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.email-table-column {
    flex: 1;
    min-width: 0;
}

.dynamic-cost {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.dynamic-cost.empty {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.dynamic-cost.sufficient {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dynamic-cost.insufficient {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-help {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    background-color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.page-btn:hover {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
}

.page-btn.active {
    background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
    color: white;
    border-color: #ff6b35;
}

.page-info {
    color: #6c757d;
    font-size: 12px;
    margin-left: 15px;
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.4em;
    }

    .site-title .badge {
        font-size: 0.55em;
        padding: 3px 8px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .user-nav {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .user-nav.active {
        max-height: 80vh; /* 使用视口高度，确保不会超出屏幕 */
        overflow-y: auto; /* 允许垂直滚动 */
        overflow-x: hidden; /* 隐藏水平滚动 */
        -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
        scrollbar-width: thin; /* Firefox 细滚动条 */
        scrollbar-color: #ff7b54 #f0f0f0; /* Firefox 滚动条颜色 */
    }
    
    /* Webkit 浏览器滚动条样式 */
    .user-nav.active::-webkit-scrollbar {
        width: 6px;
    }
    
    .user-nav.active::-webkit-scrollbar-track {
        background: #f0f0f0;
        border-radius: 3px;
    }
    
    .user-nav.active::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #ff7b54 0%, #ff6b35 100%);
        border-radius: 3px;
    }
    
    .user-nav.active::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    }

    .user-nav ul {
        flex-direction: column;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px; /* 底部留白，确保最后一项可见 */
    }
    
    /* 滚动提示渐变效果 */
    .user-nav.active::after {
        content: '';
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        height: 30px;
        background: linear-gradient(to top, rgba(255,255,255,0.95), transparent);
        pointer-events: none;
        display: block;
    }

    .user-nav a {
        text-align: center;
        font-size: 1em;
        padding: 12px 20px;
    }

    .user-container {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .page-header h2 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .user-info {
        justify-content: center;
        gap: 15px;
    }

    .balance, .concurrency {
        min-width: 100px;
        padding: 12px 20px;
    }

    .content-card {
        padding: 20px;
    }

    .content-card h3 {
        font-size: 1.3em;
    }

    .tab-nav {
        flex-direction: column;
        gap: 5px;
    }

    .tab-btn {
        border-radius: 25px;
        text-align: center;
    }

    /* 表格响应式处理 */
    .data-table {
        font-size: 0.85em;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border-radius: 10px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 8px;
        min-width: 120px;
    }

    .data-table th {
        font-size: 0.8em;
    }

    /* 表格滚动提示 */
    .data-table::after {
        content: '← 左右滑动查看更多 →';
        display: block;
        text-align: center;
        color: #6c757d;
        font-size: 0.8em;
        padding: 10px;
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        white-space: normal;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 25px 20px;
    }

    .stat-value {
        font-size: 2.2em;
    }

    .email-tables-container {
        flex-direction: column;
        gap: 30px;
    }

    .pagination {
        flex-direction: column;
        gap: 10px;
    }

    .page-info {
        margin-left: 0;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .user-container {
        padding: 10px;
    }

    .page-header h2 {
        font-size: 1.5em;
    }

    .stat-card {
        padding: 20px 15px;
    }

    .stat-value {
        font-size: 2em;
    }

    .content-card {
        padding: 15px;
    }

    .btn {
        font-size: 0.85em;
        padding: 8px 15px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 6px;
        min-width: 100px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    .balance, .concurrency {
        min-width: 90px;
        padding: 10px 15px;
    }
}

/* 平板优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .user-container {
        padding: 30px;
    }

    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-card {
        padding: 35px 30px;
    }
}

/* 加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.content-card {
    animation: fadeInUp 0.6s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

/* 主题切换动画 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 页脚样式 */
footer {
    background: rgba(255,255,255,0.95);
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

footer p {
    text-align: center;
    color: #6c757d;
    margin: 0;
    font-size: 0.9em;
}

/* 特殊功能样式 */
.token-actions, .page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.auto-refresh-notice {
    text-align: center;
    color: #6c757d;
    font-weight: 500;
    margin-top: 10px;
}

#import-progress {
    display: none;
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff7b54 0%, #ff6b35 100%);
    transition: width 0.3s ease;
}

#import-result {
    display: none;
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.dashboard-section {
    margin-bottom: 30px;
}
