/* 自定义样式 */

/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* 导航栏样式 */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* 网站标志图片样式 */
.navbar-logo {
    height: 48px;
    width: auto;
    display: inline-block;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* 按钮样式 */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    border: none;
    color: #212529;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    transform: translateY(-2px);
    color: #212529;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border: none;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
}

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

/* 表单样式 */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
}

/* 徽章样式 */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
}

/* 表格样式 */
.table {
    border-radius: 0.375rem;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

/* 进度条样式 */
.progress {
    height: 0.75rem;
    border-radius: 0.375rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 0.375rem;
    transition: width 0.3s ease;
}

/* 分页样式 */
.pagination .page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
    border: 1px solid #dee2e6;
    color: #007bff;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
}

/* 模态框样式 */
.modal-content {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* 警告框样式 */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* 英雄区块样式 */
.hero-section {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1) 0%, rgba(0, 123, 255, 0.05) 100%);
    border-radius: 1rem;
    margin: 2rem 0;
    padding: 1rem;
}

/* 特征卡片样式 */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.1);
}

/* 状态样式 */
.status-pending {
    color: #ffc107;
}

.status-sending {
    color: #17a2b8;
}

.status-success {
    color: #28a745;
}

.status-failed {
    color: #dc3545;
}

/* 邮件内容样式 */
.email-content {
    line-height: 1.6;
    word-wrap: break-word;
}

.email-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
}

/* 法律頁面（隱私政策 / 服務條款）樣式 */
.rainbow-privacy-area {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.06);
}

.rainbow-section-gap {
    padding: 3rem 0;
}

.privacy-policy-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    color: #343a40;
    line-height: 1.75;
}

.privacy-policy-wrapper .title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.privacy-policy-wrapper .update-date {
    font-size: 0.9375rem;
    color: #6c757d;
    margin-bottom: 2rem;
}

.privacy-policy-wrapper h3 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.privacy-policy-wrapper h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.privacy-policy-wrapper h5 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.privacy-policy-wrapper p {
    margin-bottom: 0.75rem;
}

.privacy-policy-wrapper ul {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.privacy-policy-wrapper li {
    margin-bottom: 0.5rem;
}

.privacy-policy-wrapper a {
    color: #0056b3;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.privacy-policy-wrapper a:hover {
    color: #004085;
}

@media (max-width: 576px) {
    .rainbow-section-gap {
        padding: 2rem 0;
    }
    .privacy-policy-wrapper {
        padding: 1.25rem 1rem;
    }
    .privacy-policy-wrapper .title {
        font-size: 1.5rem;
    }
    .privacy-policy-wrapper h3 {
        font-size: 1.25rem;
    }
    .privacy-policy-wrapper h4 {
        font-size: 1.125rem;
    }
    .privacy-policy-wrapper h5 {
        font-size: 1rem;
    }
}

.email-content a {
    color: #007bff;
    text-decoration: none;
}

/* 暗黑主题适配（系统偏好） */
@media (prefers-color-scheme: dark) {
    /* 全局背景与文字 */
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    /* 链接颜色 */
    a,
    .email-content a {
        color: #8ab4f8;
    }

    /* 导航栏与下拉菜单 */
    .navbar {
        background-color: #1f1f1f !important;
    }
    .dropdown-menu {
        background-color: #1e1e1e;
        border-color: rgba(255, 255, 255, 0.08);
        color: #e0e0e0;
    }
    .dropdown-item {
        color: #e0e0e0;
    }
    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }

    /* 卡片与模态框 */
    .card,
    .modal-content {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }
    .card-header,
    .modal-header,
    .modal-footer {
        border-color: rgba(255, 255, 255, 0.12);
    }

    /* 表单控件 */
    .form-control,
    .form-select {
        background-color: #121212;
        color: #e0e0e0;
        border-color: rgba(255, 255, 255, 0.16);
    }
    .form-control::placeholder,
    .form-select::placeholder {
        color: #a1a1a1;
    }
    .form-control:focus,
    .form-select:focus {
        border-color: #8ab4f8;
        box-shadow: 0 0 0 0.2rem rgba(138, 180, 248, 0.25);
    }
    .form-label {
        color: #d0d0d0;
    }

    /* 表格 */
    .table thead th {
        background-color: #1b1b1b;
        border-bottom-color: rgba(255, 255, 255, 0.12);
        color: #d0d0d0;
    }
    .table-hover tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.04);
    }

    /* 进度条与分页 */
    .progress {
        background-color: #1b1b1b;
    }
    .pagination .page-link {
        border-color: rgba(255, 255, 255, 0.16);
        color: #8ab4f8;
    }
    .pagination .page-link:hover {
        background-color: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.24);
    }
    .pagination .page-item.active .page-link {
        background-color: #3b82f6;
        border-color: #3b82f6;
        color: #ffffff;
    }

    /* 英雄区块 */
    .hero-section {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.08) 100%);
    }

    /* 警告框与徽章文本可读性 */
    .alert {
        color: #e0e0e0;
    }
    .badge {
        color: #f0f0f0;
    }
}

.email-content a:hover {
    text-decoration: underline;
}

/* 加载动画 */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .hero-section {
        margin: 1rem 0;
        padding: 2rem 1rem !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .card-columns {
        column-count: 1;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

/* 自定义工具类 */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-dashed {
    border-style: dashed !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .card {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    .table {
        color: #ffffff;
    }
    
    .form-control, .form-select {
        background-color: #2d2d2d;
        border-color: #444444;
        color: #ffffff;
    }
    
    .form-control:focus, .form-select:focus {
        background-color: #2d2d2d;
        border-color: #80bdff;
        color: #ffffff;
    }
}

/* 深色模式：增强文字与组件对比度（优先级更高的覆盖） */
@media (prefers-color-scheme: dark) {
    /* 通用文字颜色增强 */
    h1, h2, h3, h4, h5, h6 { color: #ffffff; }
    p, li, td, th, label, .form-text, small { color: #e8e8e8; }
    .text-muted { color: #bdbdbd !important; }
    .text-secondary { color: #cfd3da !important; }

    /* 导航链接更高对比度 */
    .navbar-nav .nav-link { color: #e6e6e6 !important; }
    .navbar-nav .nav-link:hover { color: #ffffff !important; background-color: rgba(255, 255, 255, 0.08); }

    /* 页脚与浅色背景修正 */
    footer.bg-light { background-color: #1f1f1f !important; border-top: 1px solid #333; }
    footer .text-muted { color: #bdbdbd !important; }
    .bg-light { background-color: #1f1f1f !important; }

    /* 表格正文颜色增强 */
    .table tbody td, .table tbody th { color: #e6e6e6; }

    /* 下拉与列表组可读性 */
    .dropdown-item { color: #e6e6e6; }
    .dropdown-item:hover, .dropdown-item:focus { color: #ffffff; background-color: rgba(255, 255, 255, 0.08); }
    .list-group-item { background-color: #1e1e1e; color: #e0e0e0; border-color: rgba(255, 255, 255, 0.12); }

    /* 面包屑导航 */
    .breadcrumb .breadcrumb-item, .breadcrumb .breadcrumb-item a { color: #cfd3da; }

    /* 警告框文字对比 */
    .alert { color: #f0f0f0; }

    /* alert-warning 在暗色背景下的文字可读性修复 */
    .alert-warning {
        color: #664d03 !important; /* 还原警告文本为高对比的棕色 */
    }
    .alert-warning .alert-link {
        color: #5c3d00 !important;
    }

    /* alert-info 在暗黑模式下的文字可读性修复（保持浅色背景下的深色文本） */
    .alert-info, .alert-info p, .alert-success {
        color: #055160 !important;
        background-color: #cff4fc !important; /* 保持浅色背景，确保对比度 */
        border-color: #b6effb !important;
    }
    .alert-info .alert-link {
        color: #044a4f !important;
    }

    /* alert-danger 在暗黑模式下的可读性修复（提升对比度） */
    .alert-danger, .alert-danger p {
        background-color: rgba(var(--bs-danger-rgb), 0.18) !important; /* 使用 Bootstrap 變數 */
        border-color: rgba(var(--bs-danger-rgb), 0.35) !important;
    }
    .alert-danger .alert-link {
        color: #4f0f16 !important;
    }

    /* confirm_send 统计数值在暗黑模式下的可读性增强 */
    #total-emails,
    #recipients-count,
    #estimated-time {
        color: #055160 !important;
        font-weight: 600;
    }
}

/* 深色模式：表格正文文字对比度增强 */
@media (prefers-color-scheme: dark) {
    /* 统一提升表格颜色变量与背景 */
    .table {
        --bs-table-color: #eaeaea;
        --bs-table-bg: #181818;
        --bs-table-striped-bg: #202020;
        --bs-table-hover-bg: #242424;
        color: #eaeaea;
        background-color: var(--bs-table-bg);
    }
    /* 强制提升 tbody 单元格文字颜色 */
    .table tbody td,
    .table tbody th {
        color: #eaeaea !important;
    }
    /* 表格内的弱色文字在暗色下提亮 */
    .table .text-muted {
        color: #c7c7c7 !important;
    }
    /* 表格浅色背景类在暗色模式下的修正 */
    .table-light,
    .table .bg-light {
        background-color: #202020 !important;
        color: #eaeaea !important;
    }
    /* 悬浮与条纹效果在暗色环境的对比调整 */
    .table-hover tbody tr:hover {
        background-color: var(--bs-table-hover-bg) !important;
    }
    .table-striped > tbody > tr:nth-of-type(odd) {
        background-color: var(--bs-table-striped-bg) !important;
    }
}
