/**
 * Nex Port Data System - 前台公共样式
 *
 * 所有前台页面的公共样式
 *
 * @package    Nex_Port_Data_System
 * @author     Caton
 * @since      1.0.0
 */

/* ================================================================
 * 1. 基础重置
 * ================================================================ */

.nex-port-data-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.nex-port-data-wrap *,
.nex-port-data-wrap *::before,
.nex-port-data-wrap *::after {
    box-sizing: border-box;
}

/* ================================================================
 * 2. 加载动画
 * ================================================================ */

.nex-port-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.nex-port-loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-left: 12px;
    border: 3px solid #f0f0f0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: nex-port-spin 0.8s linear infinite;
}

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

/* ================================================================
 * 3. 卡片样式
 * ================================================================ */

.nex-port-card {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.nex-port-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.nex-port-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
    color: #1e1e1e;
}

/* ================================================================
 * 4. 按钮样式
 * ================================================================ */

.nex-port-btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    text-align: center;
}

.nex-port-btn-primary {
    background: #2271b1;
    color: #ffffff;
}

.nex-port-btn-primary:hover {
    background: #135e96;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.nex-port-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.nex-port-btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

.nex-port-btn-success {
    background: #46b450;
    color: #ffffff;
}

.nex-port-btn-success:hover {
    background: #389a41;
    color: #ffffff;
}

.nex-port-btn-danger {
    background: #dc3232;
    color: #ffffff;
}

.nex-port-btn-danger:hover {
    background: #b22a2a;
    color: #ffffff;
}

.nex-port-btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.nex-port-btn-lg {
    padding: 12px 32px;
    font-size: 16px;
}

.nex-port-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ================================================================
 * 5. 表单样式
 * ================================================================ */

.nex-port-form-group {
    margin-bottom: 16px;
}

.nex-port-form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.nex-port-form-input,
.nex-port-form-select,
.nex-port-form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background: #ffffff;
    color: #333;
}

.nex-port-form-input:focus,
.nex-port-form-select:focus,
.nex-port-form-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.nex-port-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.nex-port-form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.nex-port-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ================================================================
 * 6. 表格样式
 * ================================================================ */

.nex-port-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.nex-port-table th,
.nex-port-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.nex-port-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8e8;
}

.nex-port-table tr:hover td {
    background: #fafafa;
}

.nex-port-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ================================================================
 * 7. 分页样式
 * ================================================================ */

.nex-port-pagination {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.nex-port-pagination .nex-port-page-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #ffffff;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.nex-port-pagination .nex-port-page-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.nex-port-pagination .nex-port-page-btn.active {
    background: #2271b1;
    color: #ffffff;
    border-color: #2271b1;
}

.nex-port-pagination .nex-port-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nex-port-pagination .nex-port-page-ellipsis {
    padding: 6px 8px;
    color: #999;
}

/* ================================================================
 * 8. 徽章/标签样式
 * ================================================================ */

.nex-port-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.8;
}

.nex-port-badge-primary {
    background: #e8f0fe;
    color: #2271b1;
}

.nex-port-badge-success {
    background: #e8f5e9;
    color: #46b450;
}

.nex-port-badge-warning {
    background: #fff3e0;
    color: #f56e28;
}

.nex-port-badge-danger {
    background: #fde8e8;
    color: #dc3232;
}

.nex-port-badge-info {
    background: #e3f2fd;
    color: #2196f3;
}

/* ================================================================
 * 9. 统计卡片
 * ================================================================ */

.nex-port-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.nex-port-stat-item {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nex-port-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.nex-port-stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #2271b1;
    line-height: 1.2;
}

.nex-port-stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* ================================================================
 * 10. 空状态
 * ================================================================ */

.nex-port-empty {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.nex-port-empty .nex-port-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.nex-port-empty .nex-port-empty-title {
    font-size: 18px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.nex-port-empty .nex-port-empty-desc {
    font-size: 14px;
    color: #aaa;
}

/* ================================================================
 * 11. 错误状态
 * ================================================================ */

.nex-port-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc3232;
    background: #fde8e8;
    border-radius: 8px;
    border: 1px solid #f5c6c6;
}

.nex-port-error .nex-port-error-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.nex-port-error .nex-port-error-title {
    font-size: 16px;
    font-weight: 500;
}

/* ================================================================
 * 12. 消息通知
 * ================================================================ */

.nex-port-notice {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.nex-port-notice-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.nex-port-notice-error {
    background: #fde8e8;
    color: #c62828;
    border: 1px solid #f5c6c6;
}

.nex-port-notice-warning {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.nex-port-notice-info {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}

/* ================================================================
 * 13. 工具类
 * ================================================================ */

.nex-port-text-center {
    text-align: center;
}

.nex-port-text-right {
    text-align: right;
}

.nex-port-text-left {
    text-align: left;
}

.nex-port-mt-10 {
    margin-top: 10px;
}

.nex-port-mt-20 {
    margin-top: 20px;
}

.nex-port-mb-10 {
    margin-bottom: 10px;
}

.nex-port-mb-20 {
    margin-bottom: 20px;
}

.nex-port-flex {
    display: flex;
}

.nex-port-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nex-port-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nex-port-gap-10 {
    gap: 10px;
}

.nex-port-gap-20 {
    gap: 20px;
}

.nex-port-flex-wrap {
    flex-wrap: wrap;
}

.nex-port-hidden {
    display: none !important;
}

.nex-port-visible {
    display: block !important;
}

/* ================================================================
 * 14. 响应式设计
 * ================================================================ */

/* 平板 */
@media (max-width: 768px) {
    .nex-port-data-wrap {
        padding: 0 10px;
        font-size: 15px;
    }

    .nex-port-card {
        padding: 16px;
    }

    .nex-port-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .nex-port-stat-number {
        font-size: 22px;
    }

    .nex-port-flex-between {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .nex-port-table th,
    .nex-port-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .nex-port-pagination .nex-port-page-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .nex-port-stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .nex-port-stat-item {
        padding: 12px 8px;
    }

    .nex-port-stat-number {
        font-size: 20px;
    }

    .nex-port-stat-label {
        font-size: 11px;
    }

    .nex-port-card {
        padding: 12px;
    }

    .nex-port-form-input,
    .nex-port-form-select,
    .nex-port-form-textarea {
        font-size: 16px;
        /* 防止 iOS 缩放 */
        padding: 10px 12px;
    }

    .nex-port-btn {
        padding: 6px 16px;
        font-size: 13px;
    }

    .nex-port-btn-lg {
        padding: 10px 24px;
        font-size: 14px;
    }

    .nex-port-table {
        font-size: 12px;
    }

    .nex-port-table th,
    .nex-port-table td {
        padding: 6px 8px;
    }
}

/* ================================================================
 * 15. 打印样式
 * ================================================================ */

@media print {
    .nex-port-btn,
    .nex-port-pagination,
    .nex-port-search-form,
    .nex-port-search-export {
        display: none !important;
    }

    .nex-port-card {
        border: 1px solid #ddd;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .nex-port-stat-item {
        border: 1px solid #ddd;
        box-shadow: none !important;
    }

    .nex-port-data-wrap {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .nex-port-table th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .nex-port-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}