/* 移动端专用样式优化 */

/* 基础响应式断点 */
@media (max-width: 768px) {
    /* 全局字体调整 */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* 主标题适配 */
    .display-4 {
        font-size: 2rem !important;
    }
    
    .display-3 {
        font-size: 2.2rem !important;
    }
    
    /* 按钮适配 */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-block + .btn-block {
        margin-top: 0.5rem;
    }
    
    /* 卡片间距优化 */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    /* 导航栏优化 */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
    
    /* 表格响应式 */
    .table-responsive {
        border: none;
        font-size: 0.85rem;
    }
    
    .table td, .table th {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }
    
    /* 表格头部固定 */
    .table thead th {
        position: sticky;
        top: 0;
        background-color: #ffffff;
        z-index: 10;
        box-shadow: 0 2px 2px rgba(0,0,0,0.1);
    }
    
    /* 数据表格特殊优化 */
    .financial-table {
        font-size: 0.8rem;
    }
    
    .financial-table .table td:first-child,
    .financial-table .table th:first-child {
        position: sticky;
        left: 0;
        background-color: #ffffff;
        z-index: 5;
        min-width: 80px;
        box-shadow: 2px 0 2px rgba(0,0,0,0.1);
    }
    
    /* 表单优化 */
    .form-control-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    /* 搜索建议下拉框 */
    .search-suggestions {
        max-height: 200px;
        overflow-y: auto;
        font-size: 0.9rem;
    }
    
    .search-suggestions .dropdown-item {
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #eee;
    }
    
    /* 图片适配 */
    .img-fluid {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 0 auto;
    }
    
    /* 财务分析图片特殊处理 - 优化移动端显示 */
    .chart-container,
    .analysis-chart {
        text-align: center;
        margin: 1rem 0;
        padding: 0.5rem;
        max-width: 100%;
        overflow: visible; /* 改为visible，避免内容被隐藏 */
    }

    .chart-container img,
    .analysis-chart img {
        max-width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        display: block;
        margin: 0 auto;
        /* 移除最小宽度限制，让图片自适应 */
        width: 100%;
    }
    
    /* 确保图片在小屏幕上完整显示 */
    @media (max-width: 480px) {
        .chart-container,
        .analysis-chart {
            padding: 0.25rem;
            margin: 0.5rem 0;
        }
        
        .chart-container img,
        .analysis-chart img {
            width: 100%;
            max-width: 100%;
            height: auto;
            /* 确保在小屏幕上图片完全可见 */
        }
        
        .img-fluid {
            max-width: 100%;
            width: auto;
        }
        
        /* 优化卡片间距 */
        .card-body {
            padding: 0.75rem !important;
        }
    }
    
    /* 警告提示适配 */
    .alert {
        padding: 0.75rem;
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    
    /* 面包屑导航 */
    .breadcrumb {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
        font-size: 0.85rem;
    }
    
    /* 加载状态 */
    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,0.9);
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .loading-spinner {
        border: 3px solid #f3f3f3;
        border-top: 3px solid #007bff;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    /* 功能特色区域 */
    .data-highlight {
        text-align: center;
        padding: 1rem 0.5rem;
    }
    
    .data-highlight .value {
        font-size: 1.5rem;
        font-weight: bold;
        color: #007bff;  /* 改为蓝色，避免绿色 */
        display: block;
    }
    
    .data-highlight .label {
        font-size: 0.8rem;
        color: #6c757d;
        margin-top: 0.25rem;
    }
    
    /* 图标适配 */
    .feature-icon {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
        font-size: 1.5rem;
        color: white;
    }
    
    .feature-icon.analysis {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .feature-icon.valuation {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }
    
    .feature-icon.accessible {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    }
    
    /* 文本截断 */
    .text-truncate-mobile {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    /* 行业查询优化 */
    .industry-selector {
        margin-bottom: 1rem;
    }
    
    .industry-level {
        margin-bottom: 0.5rem;
    }
    
    /* 结果展示优化 */
    .result-section {
        margin-bottom: 2rem;
    }
    
    .result-title {
        font-size: 1.1rem;
        font-weight: bold;
        color: #495057;
        margin-bottom: 0.5rem;
        padding-bottom: 0.25rem;
        border-bottom: 2px solid #e9ecef;
    }
}

/* 超小屏幕设备优化 */
@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .jumbotron {
        padding: 2rem 1rem;
    }
    
    .display-4 {
        font-size: 1.8rem !important;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }
    
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-text {
        font-size: 0.85rem;
    }
    
    /* 表格进一步压缩 */
    .table td, .table th {
        padding: 0.25rem 0.125rem;
    }
    
    /* 数值单元格特殊处理 */
    .table .numeric-cell {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    /* 图表容器优化 */
    .chart-container {
        height: 250px;
        overflow: hidden;
    }
    
    /* 图表容器已在上面的图片适配部分优化 */
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .jumbotron {
        padding: 1.5rem 1rem;
    }
    
    .display-4 {
        font-size: 1.6rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* 打印样式优化 */
@media print {
    .navbar, .btn, .alert, .jumbotron {
        display: none !important;
    }
    
    .table {
        font-size: 10px;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* 无障碍访问优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .table {
        border: 2px solid #000;
    }
    
    .table td, .table th {
        border: 1px solid #000;
    }
    
    .btn {
        border: 2px solid #000;
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .table thead th {
        background-color: #343a40;
        color: #ffffff;
    }
    
    .financial-table .table td:first-child,
    .financial-table .table th:first-child {
        background-color: #343a40;
    }
}
