/**
 * 响应式样式表
 * 基于移动优先设计
 */

/* ==================== 超小屏幕（手机，<576px）==================== */
@media (max-width: 575.98px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .page-header {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    /* 按钮全宽 */
    .btn {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .btn-group-xs .btn {
        width: auto;
        display: inline-block;
        margin-bottom: 0;
        margin-right: var(--spacing-xs);
    }
    
    /* 卡片内容调整 */
    .card-body {
        padding: var(--spacing-md);
    }
    
    /* 网格变为单列 */
    .quick-links,
    .cities-grid,
    .hot-cities-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .stat-item {
        padding: var(--spacing-md);
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* 医院/医生卡片 */
    .hospital-list-item .row,
    .doctor-list-item .row {
        flex-direction: column;
    }
    
    .hospital-list-item .col-md-4,
    .doctor-list-item .col-md-4 {
        text-align: center;
    }
}

/* ==================== 小屏幕（平板，≥576px）==================== */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

/* ==================== 中等屏幕（平板竖屏，≥768px）==================== */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    /* 快捷链接变为4列 */
    .quick-links {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* 统计数据变为4列 */
    .stats-bar {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* 城市网格变多列 */
    .cities-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ==================== 大屏幕（桌面，≥992px）==================== */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* ==================== 超大屏幕（大桌面，≥1200px）==================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* ==================== 特殊场景 ==================== */

/* 表格在小屏幕上横向滚动 */
@media (max-width: 767.98px) {
    .table-responsive {
        width: 100%;
        margin-bottom: var(--spacing-md);
        overflow-y: hidden;
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }
    
    .table-responsive .table {
        margin-bottom: 0;
    }
    
    .table-responsive .table thead,
    .table-responsive .table tbody,
    .table-responsive .table th,
    .table-responsive .table td,
    .table-responsive .table tr {
        display: block;
    }
    
    .table-responsive .table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive .table tr {
        border: 1px solid var(--border-color);
        margin-bottom: var(--spacing-md);
    }
    
    .table-responsive .table td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        text-align: left;
        white-space: normal;
    }
    
    .table-responsive .table td::before {
        position: absolute;
        top: var(--spacing-sm);
        left: var(--spacing-sm);
        width: 45%;
        padding-right: var(--spacing-sm);
        white-space: nowrap;
        font-weight: 600;
        content: attr(data-label);
    }
    
    .table-responsive .table td:last-child {
        border-bottom: 0;
    }
}

/* 打印优化 */
@media print {
    body {
        background: white;
        font-size: 12pt;
    }
    
    .container {
        max-width: 100%;
    }
    
    .no-print {
        display: none !important;
    }
    
    a {
        text-decoration: none;
        color: var(--text-color);
    }
    
    .btn {
        border: 1px solid #ccc;
        background: none;
        color: #666;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* 高对比度模式（无障碍） */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000cc;
        --text-color: #000000;
        --border-color: #000000;
    }
}

/* 减少动画（辅助功能） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 暗色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --text-muted: #808080;
        --border-color: #404040;
        --white: #2d2d2d;
    }
    
    .card {
        background: var(--white);
    }
    
    .geo-answer-block {
        background: linear-gradient(135deg, #1a2f1a 0%, #0f2610 100%);
        border-color: #2d5a2d;
        color: #e0e0e0;
    }
}