/*
 * File: main.css
 * Description: 包含网站全局基础样式、布局样式、导航栏、面包屑和页脚样式。
 */

/* ==========================================================================
   1. Base Styles & Layout (基础样式与布局)
   ========================================================================== */

/* Sticky Footer - 设置 html 和 body 元素的高度为 100%，并去除默认的外边距和内边距 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #f4f6f8 !important; /* 统一设置背景颜色，确保页面在内容不足时也有颜色 */
}

/* 将 body 元素设置为弹性布局，垂直排列子元素 */
body {
    display: flex;
    flex-direction: column;
    padding-top: 60px; /* 根据你的固定导航栏高度调整 */
}

/* 设置包装器元素，使其可以弹性伸缩，通常用于包裹主要内容区域，使其在 body 中占据剩余空间 */
.wrapper {
    flex: 1; /* 确保 wrapper 占据 body 中除固定导航栏和页脚之外的所有垂直空间 */
    display: flex;
    flex-direction: column; /* 确保其内部内容（如 main-content-wrapper）可以垂直堆叠 */
}

/* === 主内容容器（版心）样式 === */
.main-content-wrapper {
    background-color: #ffffff; /* 白色背景 */
    box-shadow: 0 2px 4px rgba(0,0,0,.08); /* 轻微阴影，增加层次感 */
    max-width: 1200px; /* 最大宽度，模拟天猫的版心宽度，可调整 */
    width: 100%; /* 确保在 max-width 限制下也能占据可用宽度 */
    margin: 30px auto; /* 上下外边距，左右自动，实现居中 (根据你的需求调整) */
    padding: 20px; /* 内部留白 */
    border-radius: 8px; /* 轻微圆角 */
    flex: 1; /* 确保它在 .wrapper 内部能撑开，从而将 footer 推到底部 */
}

/* ==========================================================================
   2. Navigation Bar (导航栏)
   ========================================================================== */

/* 确保导航栏的背景颜色和移除可能导致过度高度的 margin-bottom */
.navbar {
    background-color: #007bff !important; /* 主蓝色，使用 !important 确保覆盖 Bootstrap 默认 */
    margin-bottom: 0 !important; /* 移除导航栏底部外边距，防止额外空间 */
    min-height: 56px; /* 明确设置一个最小高度，避免内容过少时导航栏过窄 */
    box-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;
}

/* 核心调整：针对 .navbar 内部的 .container-fluid */
.navbar .container-fluid {
    display: flex;
    align-items: center;
    height: auto;
    padding-top: 0rem;
    padding-bottom: 0rem;
    flex-wrap: wrap; /* 允许换行，在移动端菜单展开时需要 */
    justify-content: flex-start !important; /* 确保内容从左侧开始排列 */
    /* 移除 gap，因为我们会在内部元素使用 margin-right */
}

/* 针对导航切换按钮，使其在移动端靠右，宽屏隐藏 */
.navbar-toggler {
    margin-left: auto !important; /* 确保在移动端时，toggler 按钮靠右对齐 */
}

/* ============================ 宽屏模式 (lg 及以上) ============================ */
@media (min-width: 992px) { /* Bootstrap 的 lg 断点 */
    .navbar-toggler {
        display: none !important; /* 宽屏下隐藏切换按钮 */
    }

    .navbar-brand {
        margin-right: 1.5rem !important; /* Logo 和导航链接之间增加间距 */
    }

    /* 确保 .navbar-collapse 在宽屏下水平显示，并占据所有可用空间 */
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important; /* **关键**：让内部元素两端对齐 */
        flex-grow: 1 !important; /* 允许它占据剩余空间 */
        height: auto !important;
        flex-basis: auto !important;
        flex-wrap: nowrap !important; /* 不换行 */
    }

    /* 导航链接组 - 推到最左边 */
    .navbar-expand-lg .navbar-nav:first-child { /* 使用 :first-child 更精确地选择导航链接组 */
        flex-direction: row !important;
        align-items: center !important;
        margin-bottom: 0 !important;
        /* 移除 margin-right: auto; 因为父级的 space-between 已经处理了 */
        /* margin-right: auto !important; */
    }

    /* 右侧功能区：搜索框和用户状态的父容器 */
    .navbar-expand-lg .d-flex.align-items-center {
        flex-direction: row !important;
        align-items: center !important;
        margin-bottom: 0 !important;
        flex-grow: 0 !important; /* 明确不让这个容器自身伸缩 */
        /* 使用 margin-left: auto 将其推到最右侧，因为父级 space-between 已经有了，这个更强 */
        margin-left: auto !important; /* **关键**：将整个右侧功能区推到最右边 */
        gap: 15px; /* 搜索框和用户中心之间的间距 */
    }

    /* 搜索框组 - 限制宽度 */
    .navbar-expand-lg .input-group {
        max-width: 300px; /* 限制搜索框的最大宽度，根据需要调整 */
        width: auto !important; /* 允许宽度自适应内容，但在max-width限制下 */
        flex-grow: 0 !important; /* 不让搜索框自身伸缩 */
        margin-right: 0 !important; /* 间距由父级 gap 或用户状态区的 margin 处理 */
        margin-bottom: 0 !important; /* 移除移动端可能带来的底部间距 */
        margin-top: 0 !important; /* 移除移动端可能带来的顶部间距 */
    }
}

/* ============================ 移动端模式 (lg 以下) ============================ */
@media (max-width: 991.98px) { /* Bootstrap 的 lg 断点以下 */
    /* 调整 Logo 和 Toggler 按钮的对齐 */
    .navbar-brand {
        margin-right: 0 !important; /* 移除 Logo 和 Toggler 之间的默认间距 */
    }
    .navbar-toggler {
        margin-left: auto !important; /* 确保 Toggler 按钮在 Logo 右侧，并推到最右边 */
    }

    /* 确保 .navbar-collapse 垂直堆叠，并占据整个宽度 */
    .navbar-collapse {
        flex-direction: column !important; /* 强制垂直堆叠 */
        align-items: flex-start !important; /* 内容左对齐 */
        width: 100% !important; /* 占据父容器的全部宽度 */
        margin-top: 1rem !important; /* Logo和菜单之间的间距 */
    }

    /* 导航链接组、搜索框容器和用户状态组都垂直堆叠并占据 100% 宽度 */
    .navbar-collapse .navbar-nav,
    .navbar-collapse .d-flex.align-items-center {
        flex-direction: column !important; /* 强制垂直堆叠 */
        align-items: flex-start !important; /* 左对齐 */
        width: 100% !important; /* 占据父容器的全部宽度 */
        margin-left: 0 !important; /* 移除可能影响对齐的左右外边距 */
        margin-right: 0 !important;
        margin-bottom: 0.5rem !important; /* 组之间的垂直间距 */
        gap: 0.5rem; /* 组内部元素的垂直间距 */
    }

    /* 搜索框组在移动端应独占一行 */
    .navbar-collapse .input-group {
        width: 100% !important; /* 确保搜索框占据一行 */
        margin-top: 0.5rem !important; /* 上下间距 */
        margin-bottom: 0.5rem !important;
    }

    /* 移动端导航链接样式调整 */
    .navbar-collapse .nav-link {
        width: 100% !important; /* 链接占据整行 */
        text-align: left !important; /* 文字左对齐 */
        padding-left: 1rem !important; /* 适当的左内边距，让文字看起来有缩进 */
        padding-right: 1rem !important;
    }

    /* 确保移动端用户中心和退出链接也是100%宽度 */
    .navbar-collapse .navbar-nav.ms-lg-auto {
        width: 100% !important;
    }
    .navbar-collapse .navbar-nav.ms-lg-auto .nav-item {
        width: 100% !important;
    }

    .navbar-nav .dropdown.tm-hover-dropdown {
        flex-direction: row !important;
        align-items: center !important;
    }
    .navbar-nav .dropdown.tm-hover-dropdown .nav-link {
        width: auto !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .navbar .dropdown-menu {
        left: 0 !important;
        right: auto !important;
        top: 100% !important;
        transform: none !important;
        min-width: 160px;
        margin-top: 0.5rem;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    }
    .navbar-nav .dropdown-toggle-split {
        margin-left: 8px !important;
        margin-right: 0 !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    #mobile-stock-menu {
        display: none;
        transition: all 0.3s;
    }
    #mobile-stock-menu.show {
        display: block;
    }
    #mobile-stock-toggle {
        cursor: pointer;
    }
}

/* 其他导航栏样式 - 保持不变 */
.navbar-nav .nav-link {
    color: white !important;
    position: relative;
    padding-bottom: 5px;
}

/* 导航栏激活下划线统一样式 */
.navbar-nav .nav-link.active {
    border-bottom: 2px solid #fff;
}

.navbar-brand {
    color: white !important;
    font-size: 1.25rem;
}

.navbar .btn {
    color: white !important;
    border-color: white !important;
}

.navbar .input-group .form-control {
    border-color: white !important;
}

.navbar .input-group .btn-outline-light {
    color: white !important;
    border-color: white !important;
}

.navbar .input-group .btn-outline-light:hover,
.navbar .input-group .btn-outline-light:focus {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-color: white !important;
}

.navbar .input-group .btn-outline-light:active,
.navbar .input-group .btn-outline-light.active {
    background-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    border-color: white !important;
}

.navbar .btn-outline-warning {
    color: #ffc107 !important;
    border-color: #ffc107 !important;
}

.navbar .btn-outline-warning:hover,
.navbar .btn-outline-warning:focus,
.navbar .btn-outline-warning:active {
    color: #fff !important;
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
}

/* 强制修复导航栏下拉菜单被遮挡问题 */
.navbar .dropdown-menu {
    z-index: 2000 !important;
    margin-top: 0 !important;
    top: 100% !important;
}

/* ==========================================================================
   3. Breadcrumbs (面包屑)
   ========================================================================== */

/* 设置面包屑导航中链接的颜色和去除下划线 */
.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    font-size: 0.9rem;
}

/* 设置面包屑导航中链接的悬停样式 */
.breadcrumb-item a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* 设置激活的面包屑导航项的颜色和字体粗细 */
.breadcrumb-item.active {
    color: #6c757d;
    font-weight: bold;
}

/* 设置面包屑导航项的字体大小 */
.breadcrumb-item {
    font-size: 0.9rem;
}

/* ==========================================================================
   4. Table Styles (表格样式)
   ========================================================================== */

table {
    border-collapse: collapse;
    margin-top: 20px;
    width: 100%;
}

/* 通用表格单元格样式 */
th, td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.5;
}

/* 表头背景色 */
th {
    background-color: #f2f2f2;
}

/* 表格行悬停效果 */
tr:hover {
    background-color: #f5f5f5;
}

/* 表格内容字体大小 */
table tbody td {
    font-size: 14px;
}

/* 股票信息容器样式 */
.stock-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 股票信息链接样式 */
.stock-info a {
    color: #495057;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    font-size: 14px;
}

/* 股票信息链接悬停效果 */
.stock-info a:hover {
    color: #212529;
    text-decoration: underline;
}

/* 股票高亮样式 */
table tbody td.highlight {
    background-color: #ffe066 !important;
}

/* ==========================================================================
   5. 全站统一简洁现代的超链接样式
   ========================================================================== */

/* 全站统一简洁现代的超链接样式 */
a, .link-primary {
    color: #2563eb;           /* 更现代的蓝色，可自定义 */
    text-decoration: none;    /* 默认无下划线 */
    transition: color 0.2s;
}

a:hover, .link-primary:hover {
    color: #1e40af;           /* 悬停时更深的蓝色 */
    text-decoration: underline; /* 悬停时才有下划线 */
}

a:active, .link-primary:active {
    color: #1e3a8a;
}

a:visited, .link-primary:visited {
    color: #6366f1;           /* 访问过的链接颜色，可自定义 */
}

/* ==========================================================================
   6. 统一日期控件样式（频道：日期选择/筛选条）
   ========================================================================== */

/* 统一日期控件外层容器 */
.tm-datebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 1rem 0.5rem;
}

/* 日期label */
.tm-datebar label {
    margin-bottom: 0;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

/* 日期输入框 */
.tm-datebar input[type='date'] {
    min-width: 140px;
    max-width: 220px;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0 0.75rem;
    font-size: 1rem;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.tm-datebar input[type='date']:focus {
    border-color: #2563eb;
    outline: none;
    background: #fff;
}

/* 查询按钮 */
.tm-datebar .btn {
    min-width: 80px;
    height: 2.25rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-left: 0.5rem;
}

/* 复选框区域 */
.tm-datebar .form-check {
    margin-left: 0.5rem;
}

/* 移动端优化 */
@media (max-width: 600px) {
    .tm-datebar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 0.25rem;
    }
    .tm-datebar input[type='date'] {
        width: 100%;
        margin-left: 0;
    }
    .tm-datebar .btn {
        width: auto !important;
        min-width: 80px;
        margin-left: 0.5rem;
    }
    .tm-datebar .form-check {
        margin-left: 0;
    }
}

/* ==========================================================================
   7. Footer (页脚)
   ========================================================================== */

/* 设置页脚的背景颜色、文字颜色、内边距、外边距和字体大小 */
.footer {
    background-color: #343a40;
    color: white;
    padding: 30px 0;
    margin-top: auto;
    font-size: 0.9em;
    flex-shrink: 0;
}

/* 确保页脚内的容器与主内容区保持相同的版心宽度并居中 */
.footer .container {
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* 设置页脚中链接的颜色和去除下划线 */
.footer a {
    color: #adb5bd;
    text-decoration: none;
}

/* 设置页脚中链接的悬停颜色 */
.footer a:hover {
    color: white;
}

/* 设置页脚中二维码区域的文本居中 */
.footer .qr-code-section {
    text-align: center;
}

/* 设置页脚中二维码图片的宽度、高度、边框圆角和底部外边距 */
.footer .qr-code-section img {
    width: 100px;
    height: 100px;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* 设置页脚中二维码区域文字的底部外边距和颜色 */
.footer .qr-code-section p {
    margin-bottom: 0;
    color: #adb5bd;
}

/* 设置页脚中联系信息区域的文本右对齐 */
.footer .contact-info {
    text-align: right;
}

/* ==========================================================================
   Media Queries (媒体查询)
   ========================================================================== */

/* 当屏幕宽度小于 767.98px (Bootstrap 的 sm 尺寸) 时，调整页脚中二维码区域和联系信息区域的样式 */
@media (max-width: 767.98px) {
    .footer .qr-code-section,
    .footer .contact-info {
        text-align: center;
        margin-bottom: 20px;
    }
    .footer .contact-info {
        margin-bottom: 0;
    }
}

/* 股票频道主链接和小三角间距优化 */
.navbar-nav .dropdown.tm-hover-dropdown {
    gap: 0;
}
.navbar-nav .dropdown-toggle-split {
    margin-left: -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.5rem;
}

/* 保证导航条激活时字体大小不变 */
.navbar-nav .nav-link,
.navbar-nav .nav-link.active {
    font-size: 1rem;
    /* 其它字体属性可根据实际需要补充 */
}

/* 表格中按钮链接的样式优化 */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 60px;
}

/* 股票代码按钮样式 */
.table .btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
    background-color: transparent;
}

.table .btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* 股票名称按钮样式 */
.table .btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
    background-color: transparent;
}

.table .btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

/* 表格单元格垂直居中 */
.table-middle-align td {
    vertical-align: middle;
}

/* 确保按钮在表格单元格中居中显示 */
.table td {
    text-align: center;
}

/* 涨幅颜色样式 */
.text-danger {
    color: #dc3545 !important;
    font-weight: bold;
}

.text-success {
    color: #198754 !important;
    font-weight: bold;
}

/* 市场类型样式 */
.market-type-link {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #e9ecef;
    color: #198754;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.market-type-link:hover {
    background-color: #198754;
    color: #ffffff;
    text-decoration: none;
}

.market-type-text {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
} 