/* ============================================================
   components.css - 组件样式（表格、卡片、表单、弹窗等）
   ============================================================ */

/* ===== 公告栏 ===== */
.announcement-bar {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
    border: 1px solid #d0d7ff;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.announcement-empty {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.announcement-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.announcement-icon {
    color: #667eea;
    font-size: 18px;
    flex-shrink: 0;
}

.announcement-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    word-break: break-word;
    min-width: 100px;
}

.announcement-time {
    font-size: 11px;
    color: #8e8e93;
    flex-shrink: 0;
}

.announcement-edit-btn {
    background: transparent;
    border: 1px solid #d0d7ff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.announcement-edit-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    background: white;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    margin-bottom: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    flex: 1;
}

.filter-group label {
    font-size: 12px;
    color: #8e8e93;
    font-weight: 500;
}

.filter-group select {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    width: 100%;
}

.filter-group select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.btn-clear {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
}

.btn-clear:hover {
    color: #e53e3e;
}

.btn-refresh {
    padding: 6px 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: #e9ecef;
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-add {
    padding: 6px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.btn-clear-all {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.btn-clear-all:hover {
    background: #f5f5f5;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid #eaeaea;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.stat-title {
    font-size: 12px;
    color: #8e8e93;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.stat-value small {
    font-size: 12px;
    font-weight: 400;
    color: #8e8e93;
}

/* ===== 表格卡片 ===== */
.table-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    overflow: hidden;
}

.table-header {
    padding: 14px 20px;
    border-bottom: 1px solid #eaeaea;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex-wrap: wrap;
}

.table-hint {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 400;
    margin-left: auto;
}

.badge-count {
    background: #667eea;
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-paused {
    background: #ffc107;
    color: #333;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.fund-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.fund-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.fund-table th {
    background: #f8f9fa;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eaeaea;
    white-space: nowrap;
}

.fund-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
}

.fund-table tbody tr:hover {
    background: #f8f9ff;
}

.fund-table .row-paused {
    opacity: 0.7;
    background: #fff8e1;
}

.fund-table .row-paused:hover {
    background: #fff3cd;
}

/* ===== 表格内元素 ===== */
.editable-cell {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: background 0.2s;
}

.editable-cell:hover {
    background: #f0f0f0;
}

.edit-input,
.edit-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #667eea;
    border-radius: 4px;
    outline: none;
    background: white;
    min-width: 80px;
}

.edit-input:focus,
.edit-select:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.clickable-name {
    cursor: pointer;
    transition: color 0.2s;
}

.clickable-name:hover {
    color: #667eea;
}

.nav-date {
    font-size: 10px;
    color: #8e8e93;
    margin-left: 4px;
}

.realtime-time {
    font-size: 10px;
    color: #8e8e93;
    margin-left: 4px;
    font-weight: normal;
}

.small-percent {
    font-size: 10px;
    color: #8e8e93;
    margin-left: 3px;
}

.badge-paused-tag {
    background: #ffc107;
    color: #333;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.text-pending {
    color: #8e8e93 !important;
    font-style: italic;
}

/* ===== 操作按钮 ===== */
.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5a67d8;
}

.btn-delete {
    background: #e53e3e;
    color: white;
}

.btn-delete:hover {
    background: #c53030;
}

.btn-pause {
    background: #ffc107;
    color: #333;
}

.btn-pause:hover {
    background: #e0a800;
}

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

.btn-resume:hover {
    background: #1e7e34;
}

/* ===== 设置页面 ===== */
.settings-page {
    max-width: 600px;
    margin: 0 auto;
}

.settings-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #eaeaea;
    padding: 28px 32px;
}

.settings-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.settings-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.settings-card hr {
    margin: 24px 0;
    border: none;
    border-top: 1px solid #eaeaea;
}

.invite-section p {
    font-size: 13px;
    color: #8e8e93;
    margin-bottom: 12px;
}

.invite-url-box {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.invite-url-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    background: #f8f9fa;
}

.invite-url-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-copy {
    padding: 10px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-copy:hover {
    background: #5a67d8;
}

.invite-stats {
    font-size: 13px;
    color: #333;
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.password-form input {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
}

.password-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-save-password {
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-save-password:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-save-password:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== 颜色工具 ===== */
.text-danger {
    color: #dc3545 !important;
    font-weight: 500;
}

.text-success {
    color: #28a745 !important;
    font-weight: 500;
}

.text-muted {
    color: #8e8e93 !important;
}

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

.py-4 {
    padding-top: 24px;
    padding-bottom: 24px;
}

/* ===== 详情弹窗 ===== */
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    color: #8e8e93;
    font-size: 13px;
}

.detail-value {
    font-weight: 500;
    font-size: 14px;
}

/* ===== 历史净值 ===== */
.history-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.history-header .fund-code {
    font-size: 12px;
    opacity: 0.9;
}

.history-header .fund-name {
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
}

/* ===== 每日盈亏 ===== */
.daily-profit-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ===== 会员剩余天数提醒 ===== */
.remaining-warning {
    color: #dc3545;
    font-weight: 600;
}

.remaining-normal {
    color: #28a745;
}

/* ===== Toast 容器 ===== */
#toastContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

#toastContainer .alert {
    margin: 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        padding: 12px 16px;
        gap: 8px;
    }

    .filter-group {
        min-width: 100%;
        width: 100%;
    }

    .filter-actions {
        margin-left: 0;
        width: 100%;
        justify-content: stretch;
    }

    .filter-actions button {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 12px;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .stat-value {
        font-size: 17px;
    }

    .stat-value small {
        font-size: 10px;
    }

    .settings-card {
        padding: 20px 16px;
    }

    .invite-url-box {
        flex-direction: column;
    }

    .invite-url-box input {
        width: 100%;
    }

    .btn-copy {
        width: 100%;
        justify-content: center;
    }

    .fund-table th,
    .fund-table td {
        font-size: 10px;
        padding: 6px 4px;
    }

    .btn-action {
        font-size: 10px;
        padding: 3px 6px;
    }

    .table-header {
        font-size: 12px;
        padding: 10px 14px;
        flex-wrap: wrap;
    }

    .table-hint {
        display: none;
    }

    .detail-item {
        flex-direction: column;
        gap: 2px;
    }

    .detail-label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .stat-card {
        padding: 10px 12px;
    }

    .stat-value {
        font-size: 15px;
    }

    #toastContainer {
        bottom: 80px;
        right: 12px;
        max-width: calc(100% - 24px);
    }
}