/**
 * 移动端优化样式
 * 确保所有大图的响应式显示和文案的完整显示
 */

/* 响应式图片 */
.responsive-image {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

.responsive-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 固定宽度的图片容器 */
.fixed-width-image {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.fixed-width-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* 移动端字体大小适配 */
@media (max-width: 768px) {
  body {
    font-size: 14px;
    line-height: 1.5;
  }
  
  h1 {
    font-size: 24px;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 20px;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 18px;
    line-height: 1.3;
  }
  
  h4 {
    font-size: 16px;
    line-height: 1.3;
  }
  
  h5 {
    font-size: 14px;
    line-height: 1.3;
  }
  
  h6 {
    font-size: 13px;
    line-height: 1.3;
  }
  
  p {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .btn {
    font-size: 14px;
    padding: 10px 20px;
  }
  
  .form-control {
    font-size: 14px;
    padding: 12px 15px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  h2 {
    font-size: 18px;
  }
  
  h3 {
    font-size: 16px;
  }
  
  h4 {
    font-size: 15px;
  }
  
  h5 {
    font-size: 13px;
  }
  
  h6 {
    font-size: 12px;
  }
  
  p {
    font-size: 13px;
  }
  
  .btn {
    font-size: 13px;
    padding: 8px 16px;
  }
  
  .form-control {
    font-size: 13px;
    padding: 10px 12px;
  }
}

/* 文案溢出保护 */
.text-overflow-protection {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端布局优化 */
@media (max-width: 768px) {
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .row {
    margin-left: -10px;
    margin-right: -10px;
  }
  
  .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
  .col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
  .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
  .col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
  .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
  .col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
  .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .section-padding {
    padding: 40px 0;
  }
  
  .section {
    padding: 30px 0;
  }
  
  .pt-0 {
    padding-top: 0 !important;
  }
  
  .pb-0 {
    padding-bottom: 0 !important;
  }
}

@media (max-width: 480px) {
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .row {
    margin-left: -5px;
    margin-right: -5px;
  }
  
  .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
  .col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
  .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
  .col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
  .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
  .col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
  .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
    padding-left: 5px;
    padding-right: 5px;
  }
  
  .section-padding {
    padding: 30px 0;
  }
  
  .section {
    padding: 20px 0;
  }
}

/* 移动端间距优化 */
@media (max-width: 768px) {
  .mb-1, .my-1 { margin-bottom: 0.5rem !important; }
  .mb-2, .my-2 { margin-bottom: 1rem !important; }
  .mb-3, .my-3 { margin-bottom: 1.5rem !important; }
  .mb-4, .my-4 { margin-bottom: 2rem !important; }
  .mb-5, .my-5 { margin-bottom: 2.5rem !important; }
  
  .mt-1, .my-1 { margin-top: 0.5rem !important; }
  .mt-2, .my-2 { margin-top: 1rem !important; }
  .mt-3, .my-3 { margin-top: 1.5rem !important; }
  .mt-4, .my-4 { margin-top: 2rem !important; }
  .mt-5, .my-5 { margin-top: 2.5rem !important; }
  
  .p-1 { padding: 0.5rem !important; }
  .p-2 { padding: 1rem !important; }
  .p-3 { padding: 1.5rem !important; }
  .p-4 { padding: 2rem !important; }
  .p-5 { padding: 2.5rem !important; }
  
  .px-1 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
  .px-2 { padding-left: 1rem !important; padding-right: 1rem !important; }
  .px-3 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
  .px-4 { padding-left: 2rem !important; padding-right: 2rem !important; }
  .px-5 { padding-left: 2.5rem !important; padding-right: 2.5rem !important; }
  
  .py-1 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
  .py-2 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
  .py-3 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
  .py-4 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .py-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
}

/* 移动端按钮优化 */
@media (max-width: 768px) {
  .btn {
    min-height: 44px; /* 触摸友好的最小高度 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .btn-sm {
    min-height: 36px;
    font-size: 13px;
    padding: 8px 16px;
  }
  
  .btn-lg {
    min-height: 52px;
    font-size: 16px;
    padding: 14px 24px;
  }
  
  .btn-block {
    width: 100%;
    display: flex;
  }
}

/* 移动端表单优化 */
@media (max-width: 768px) {
  .form-control {
    min-height: 44px;
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  .form-control:focus {
    font-size: 16px;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
  }
}

/* 移动端卡片优化 */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 16px;
    margin-bottom: 0.75rem;
  }
  
  .card-text {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* 移动端导航优化 */
@media (max-width: 768px) {
  .navbar-nav {
    padding: 1rem 0;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
  }
  
  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }
  
  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link:focus {
    background-color: #f8f9fa;
  }
}

/* 移动端表格优化 */
@media (max-width: 768px) {
  .table-responsive {
    border: 0;
  }
  
  .table {
    font-size: 14px;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
    vertical-align: middle;
  }
  
  .table th {
    font-weight: 600;
    background-color: #f8f9fa;
  }
}

/* 移动端模态框优化 */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }
  
  .modal-content {
    border-radius: 12px;
  }
  
  .modal-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
  }
  
  .modal-title {
    font-size: 18px;
  }
}

/* 移动端工具提示优化 */
@media (max-width: 768px) {
  .tooltip {
    font-size: 12px;
  }
  
  .tooltip-inner {
    max-width: 200px;
    padding: 0.5rem 0.75rem;
  }
}

/* 移动端弹出框优化 */
@media (max-width: 768px) {
  .popover {
    max-width: 280px;
  }
  
  .popover-header {
    font-size: 14px;
    padding: 0.75rem 1rem;
  }
  
  .popover-body {
    font-size: 13px;
    padding: 0.75rem 1rem;
  }
}

/* 移动端分页优化 */
@media (max-width: 768px) {
  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .page-link {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
  }
  
  .page-item:not(:last-child) {
    margin-right: 0.25rem;
  }
}

/* 移动端面包屑优化 */
@media (max-width: 768px) {
  .breadcrumb {
    font-size: 13px;
    padding: 0.75rem 0;
  }
  
  .breadcrumb-item + .breadcrumb-item::before {
    padding: 0 0.5rem;
  }
}

/* 移动端标签页优化 */
@media (max-width: 768px) {
  .nav-tabs {
    flex-wrap: wrap;
    border-bottom: 1px solid #dee2e6;
  }
  
  .nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1rem;
    font-size: 14px;
    white-space: nowrap;
  }
  
  .nav-tabs .nav-link.active {
    border-bottom-color: #007bff;
    background-color: transparent;
  }
}

/* 移动端进度条优化 */
@media (max-width: 768px) {
  .progress {
    height: 8px;
    border-radius: 4px;
  }
  
  .progress-bar {
    font-size: 12px;
    line-height: 8px;
  }
}

/* 移动端警告框优化 */
@media (max-width: 768px) {
  .alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
  }
  
  .alert-heading {
    font-size: 16px;
    margin-bottom: 0.5rem;
  }
  
  .alert-dismissible .close {
    padding: 0.75rem 1rem;
    font-size: 18px;
  }
}

/* 移动端徽章优化 */
@media (max-width: 768px) {
  .badge {
    font-size: 11px;
    padding: 0.25rem 0.5rem;
  }
  
  .badge-pill {
    border-radius: 10px;
  }
}

/* 移动端列表组优化 */
@media (max-width: 768px) {
  .list-group-item {
    padding: 0.75rem 1rem;
    font-size: 14px;
  }
  
  .list-group-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  
  .list-group-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
  }
}

/* 移动端输入组优化 */
@media (max-width: 768px) {
  .input-group {
    flex-wrap: wrap;
  }
  
  .input-group > .form-control,
  .input-group > .custom-select,
  .input-group > .custom-file {
    min-height: 44px;
  }
  
  .input-group-text {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 14px;
  }
}

/* 移动端自定义控件优化 */
@media (max-width: 768px) {
  .custom-control {
    min-height: 44px;
    padding-left: 2rem;
  }
  
  .custom-control-label {
    font-size: 14px;
    line-height: 1.5;
    padding-top: 0.25rem;
  }
  
  .custom-control-input:checked ~ .custom-control-label::before {
    border-color: #007bff;
    background-color: #007bff;
  }
}

/* 移动端下拉菜单优化 */
@media (max-width: 768px) {
  .dropdown-menu {
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    margin-top: 0.5rem;
  }
  
  .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .dropdown-item:hover,
  .dropdown-item:focus {
    background-color: #f8f9fa;
  }
  
  .dropdown-divider {
    margin: 0.5rem 0;
  }
}

/* 移动端轮播图优化 */
@media (max-width: 768px) {
  .carousel {
    border-radius: 8px;
    overflow: hidden;
  }
  
  .carousel-item {
    height: 200px;
  }
  
  .carousel-caption {
    padding: 1rem;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  }
  
  .carousel-caption h5 {
    font-size: 18px;
    margin-bottom: 0.5rem;
  }
  
  .carousel-caption p {
    font-size: 14px;
    margin-bottom: 0;
  }
  
  .carousel-control-prev,
  .carousel-control-next {
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .carousel-indicators {
    bottom: 10px;
  }
  
  .carousel-indicators li {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 4px;
  }
}

/* 移动端手风琴优化 */
@media (max-width: 768px) {
  .accordion .card {
    border: none;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .accordion .card-header {
    background-color: #f8f9fa;
    border: none;
    padding: 1rem;
    border-radius: 8px 8px 0 0;
  }
  
  .accordion .card-header button {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0;
  }
  
  .accordion .card-body {
    padding: 1rem;
    font-size: 14px;
    line-height: 1.6;
  }
}

/* 移动端标签优化 */
@media (max-width: 768px) {
  .nav-pills .nav-link {
    padding: 0.75rem 1rem;
    margin: 0.25rem;
    border-radius: 20px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .nav-pills .nav-link.active {
    background-color: #007bff;
    color: white;
  }
}

/* 移动端分页导航优化 */
@media (max-width: 768px) {
  .pagination-lg .page-link {
    min-width: 52px;
    height: 52px;
    font-size: 16px;
  }
  
  .pagination-sm .page-link {
    min-width: 36px;
    height: 36px;
    font-size: 12px;
  }
}

/* 移动端工具提示优化 */
@media (max-width: 768px) {
  .tooltip.show {
    opacity: 1;
  }
  
  .tooltip.bs-tooltip-top .arrow::before {
    border-top-color: #000;
  }
  
  .tooltip.bs-tooltip-bottom .arrow::before {
    border-bottom-color: #000;
  }
  
  .tooltip.bs-tooltip-left .arrow::before {
    border-left-color: #000;
  }
  
  .tooltip.bs-tooltip-right .arrow::before {
    border-right-color: #000;
  }
}

/* 移动端弹出框优化 */
@media (max-width: 768px) {
  .popover.bs-popover-top .arrow::before {
    border-top-color: #f8f9fa;
  }
  
  .popover.bs-popover-bottom .arrow::before {
    border-bottom-color: #f8f9fa;
  }
  
  .popover.bs-popover-left .arrow::before {
    border-left-color: #f8f9fa;
  }
  
  .popover.bs-popover-right .arrow::before {
    border-right-color: #f8f9fa;
  }
}

/* 移动端滚动条优化 */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
}

/* 移动端选择器优化 */
@media (max-width: 768px) {
  select.form-control {
    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 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  select.form-control:focus {
    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='%23007bff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  }
}

/* 移动端焦点状态优化 */
@media (max-width: 768px) {
  .form-control:focus,
  .btn:focus,
  .custom-control-input:focus ~ .custom-control-label::before {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  }
  
  .btn:focus:not(:focus-visible) {
    box-shadow: none;
  }
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
  .btn,
  .form-control,
  .custom-control,
  .nav-link,
  .page-link,
  .dropdown-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .btn:active,
  .form-control:active,
  .custom-control:active,
  .nav-link:active,
  .page-link:active,
  .dropdown-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* 移动端动画优化 */
@media (max-width: 768px) {
  .fade {
    transition: opacity 0.15s linear;
  }
  
  .fade.show {
    opacity: 1;
  }
  
  .collapse {
    transition: height 0.35s ease;
  }
  
  .collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
  }
  
  .show {
    display: block !important;
  }
}

/* 移动端打印优化 */
@media print {
  .header,
  .footer,
  .mobile-menu,
  .back-to-top {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  .page-break {
    page-break-before: always;
  }
}
