/* ================================
   响应式设计样式
   ================================ */

/* CSS变量定义 */
:root {
    --header-height: 70px;
    --sidebar-width: 280px;
    --content-padding: 20px;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* 基础响应式容器 */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--content-padding);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--content-padding);
}

/* 网格系统 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
    min-width: 0;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* 响应式工具类 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }

.align-start { align-items: flex-start !important; }
.align-center { align-items: center !important; }
.align-end { align-items: flex-end !important; }

.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }

/* 间距工具类 */
.m-0 { margin: 0 !important; }
.m-1 { margin: 8px !important; }
.m-2 { margin: 16px !important; }
.m-3 { margin: 24px !important; }
.m-4 { margin: 32px !important; }
.m-5 { margin: 40px !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 8px !important; }
.p-2 { padding: 16px !important; }
.p-3 { padding: 24px !important; }
.p-4 { padding: 32px !important; }
.p-5 { padding: 40px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mt-4 { margin-top: 32px !important; }
.mt-5 { margin-top: 40px !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mb-4 { margin-bottom: 32px !important; }
.mb-5 { margin-bottom: 40px !important; }

/* 大屏幕（桌面） - 1200px+ */
@media (min-width: 1200px) {
    :root {
        --content-padding: 30px;
    }
    
    .container {
        max-width: 1200px;
    }
    
    /* 大屏专用网格 */
    .col-xl-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-xl-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
    .col-xl-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-xl-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
    .col-xl-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-xl-9 { flex: 0 0 75%; max-width: 75%; }
    .col-xl-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-xl-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* 大屏显示工具 */
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
}

/* 中等屏幕（平板横屏） - 992px - 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
    :root {
        --content-padding: 25px;
        --sidebar-width: 250px;
    }
    
    .container {
        max-width: 960px;
    }
    
    /* 中屏专用网格 */
    .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* 中屏显示工具 */
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

/* 小屏幕（平板竖屏） - 768px - 991px */
@media (min-width: 768px) and (max-width: 991px) {
    :root {
        --content-padding: 20px;
        --sidebar-width: 220px;
    }
    
    .container {
        max-width: 720px;
    }
    
    /* 小屏专用网格 */
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* 小屏显示工具 */
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    
    /* 平板优化 */
    .main-content {
        padding: 15px;
    }
    
    .header-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .chart-container {
        padding: 15px;
    }
}

/* 移动设备 - 最大767px */
@media (max-width: 767px) {
    :root {
        --content-padding: 15px;
        --header-height: 60px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    /* 移动端专用网格 */
    .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
    .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* 移动端显示工具 */
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
    
    /* 移动端布局优化 */
    .main-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .header-title {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .header-controls select,
    .header-controls button {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .main-content {
        padding: 10px;
    }
    
    .chart-container {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .chart-title {
        font-size: 1.2rem;
        text-align: center;
    }
    
    .analysis-section {
        padding: 15px 10px;
    }
    
    .analysis-section h3 {
        font-size: 1.1rem;
    }
    
    .trading-panel {
        padding: 15px 10px;
    }
    
    /* 按钮优化 */
    .btn {
        min-height: 44px; /* iOS推荐触摸目标大小 */
        font-size: 16px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* 表单优化 */
    input, select, textarea {
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 44px;
    }
    
    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }
    
    /* 移动端专用元素 */
    .mobile-only {
        display: block !important;
    }
}

/* 超小屏幕 - 最大480px */
@media (max-width: 480px) {
    :root {
        --content-padding: 10px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .chart-container,
    .analysis-section,
    .trading-panel {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .header-title {
        font-size: 1.1rem;
    }
    
    .chart-title {
        font-size: 1rem;
    }
    
    .row {
        margin: 0 -5px;
    }
    
    .col {
        padding: 0 5px;
    }
    
    /* 字体缩放 */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.9rem; }
    h6 { font-size: 0.8rem; }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .chart-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .analysis-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 20px;
    }
    
    a {
        text-decoration: none;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 12px;
        color: #666;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .chart-container,
    .analysis-section,
    .trading-panel {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid #000;
    }
    
    .btn:hover {
        border: 2px solid #fff;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
} 