/**
 * Responsive Styles
 * 众筹平台响应式样式
 * Requirements: 10.1, 10.2, 10.3, 10.4, 10.5
 */

/* ========================================
 * 大屏幕 (>= 1200px)
 * ======================================== */

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* ========================================
 * 中等屏幕 (< 992px)
 * ======================================== */

@media (max-width: 991.98px) {
  /* Hero区域调整 */
  .hero-title {
    font-size: var(--font-size-4xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-lg);
  }
  
  .hero-stats {
    gap: var(--space-8);
  }
  
  /* 项目网格调整 */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
 * 平板设备 (< 768px)
 * ======================================== */

@media (max-width: 767.98px) {
  /* 导航栏移动端样式 */
  .navbar-custom {
    padding: var(--space-2) 0;
  }
  
  .navbar-custom .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  }
  
  .nav-links-custom {
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .nav-link-custom {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
  }
  
  .navbar-nav .btn-custom {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-2);
  }
  
  /* Hero区域移动端 */
  .hero-section {
    padding: var(--space-16) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-3xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-base);
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }
  
  .hero-stats {
    flex-direction: column;
    gap: var(--space-6);
  }
  
  /* 项目网格单列 */
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  /* 区块标题调整 */
  .section-title {
    font-size: var(--font-size-2xl);
  }
  
  .section-subtitle {
    font-size: var(--font-size-base);
  }
  
  /* 页面标题调整 */
  .page-title {
    font-size: var(--font-size-2xl);
  }
  
  /* 筛选器调整 */
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
  }
  
  .filter-btn {
    flex-shrink: 0;
  }
  
  /* 页脚移动端 */
  .footer-content .row > div {
    margin-bottom: var(--space-8);
  }
  
  .footer-description {
    max-width: 100%;
  }
  
  /* 特色区域调整 */
  .feature-card {
    padding: var(--space-6);
  }
  
  .feature-icon {
    width: 64px;
    height: 64px;
    font-size: var(--font-size-2xl);
  }
}


/* ========================================
 * 小屏幕手机 (< 576px)
 * ======================================== */

@media (max-width: 575.98px) {
  /* 更小的间距 */
  .main-content {
    padding-top: 70px;
  }
  
  .page-container {
    padding: var(--space-6) 0;
  }
  
  /* Hero区域 */
  .hero-section {
    padding: var(--space-12) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-2xl);
  }
  
  .hero-stat-value {
    font-size: var(--font-size-2xl);
  }
  
  /* 卡片调整 */
  .card-custom .card-body {
    padding: var(--space-4);
  }
  
  .stat-card {
    padding: var(--space-4);
  }
  
  .stat-card .stat-value {
    font-size: var(--font-size-2xl);
  }
  
  /* 按钮调整 */
  .btn-lg-custom {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-sm);
  }
  
  /* 表单全宽 */
  .form-control-custom,
  .form-select-custom {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* 页脚调整 */
  .footer-custom {
    padding-top: var(--space-10);
  }
  
  .footer-social {
    justify-content: center;
  }
}

/* ========================================
 * 后台响应式样式
 * ======================================== */

/* 后台侧边栏折叠 */
@media (max-width: 991.98px) {
  .admin-layout {
    flex-direction: column;
  }
  
  .admin-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: var(--z-fixed);
    transition: left var(--transition-normal);
  }
  
  .admin-sidebar.show {
    left: 0;
  }
  
  .admin-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-fixed) - 1);
  }
  
  .admin-sidebar.show + .admin-sidebar-overlay {
    display: block;
  }
  
  .admin-content {
    margin-left: 0;
    width: 100%;
  }
  
  .admin-topbar {
    padding-left: var(--space-4);
  }
  
  .sidebar-toggle {
    display: flex;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: none;
  }
  
  .admin-sidebar-overlay {
    display: none !important;
  }
}

/* 后台表格响应式 */
@media (max-width: 767.98px) {
  .table-responsive-custom {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-responsive-custom table {
    min-width: 600px;
  }
  
  /* 后台统计卡片 */
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575.98px) {
  .admin-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
 * 打印样式
 * ======================================== */

@media print {
  .navbar-custom,
  .footer-custom,
  .admin-sidebar,
  .admin-topbar {
    display: none !important;
  }
  
  .main-content {
    padding-top: 0;
  }
  
  .admin-content {
    margin-left: 0;
  }
  
  .card-custom {
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
}

/* ========================================
 * 高对比度模式
 * ======================================== */

@media (prefers-contrast: high) {
  :root {
    --shadow-sm: 0 0 0 1px var(--gray-400);
    --shadow-md: 0 0 0 2px var(--gray-500);
    --shadow-lg: 0 0 0 3px var(--gray-600);
  }
  
  .btn-custom,
  .card-custom,
  .form-control-custom {
    border: 2px solid currentColor;
  }
}

/* ========================================
 * 减少动画模式
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .progress-custom .progress-bar::after {
    animation: none;
  }
}


/* ========================================
 * 移动端导航栏汉堡菜单动画
 * ======================================== */

@media (max-width: 991.98px) {
  .navbar-toggler-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
  }
  
  .navbar-toggler-custom:hover {
    background: var(--gray-100);
  }
  
  .navbar-toggler-custom[aria-expanded="true"] .toggler-icon {
    background: transparent;
  }
  
  .navbar-toggler-custom[aria-expanded="true"] .toggler-icon::before {
    transform: rotate(45deg);
    top: 0;
  }
  
  .navbar-toggler-custom[aria-expanded="true"] .toggler-icon::after {
    transform: rotate(-45deg);
    top: 0;
  }
  
  /* 移动端下拉菜单 */
  .navbar-custom .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: var(--gray-50);
    margin-top: var(--space-2);
    border-radius: var(--radius-lg);
  }
  
  /* 后台移动端页面头部 */
  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .admin-page-actions {
    width: 100%;
  }
  
  .admin-page-actions form {
    flex-direction: column;
    width: 100%;
  }
  
  .admin-page-actions .input-group-custom {
    width: 100%;
  }
  
  .admin-page-actions .form-control-custom {
    min-width: auto !important;
  }
  
  /* 后台筛选标签滚动 */
  .admin-filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-filter-tab {
    flex-shrink: 0;
  }
  
  /* 后台表格操作按钮 */
  .table-actions {
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .table-action-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* 后台详情页 */
  .admin-detail-row {
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .admin-detail-label {
    width: auto;
  }
  
  /* 后台主内容区域 */
  .admin-main {
    margin-left: 0;
  }
  
  .admin-content {
    padding: var(--space-4);
  }
  
  /* 后台面包屑 */
  .admin-breadcrumb {
    display: none;
  }
}

/* ========================================
 * 认证页面响应式
 * ======================================== */

@media (max-width: 575.98px) {
  .auth-page {
    padding: var(--space-4);
  }
  
  .auth-card {
    padding: var(--space-5);
  }
  
  .auth-title {
    font-size: var(--font-size-xl);
  }
  
  .auth-logo {
    margin-bottom: var(--space-4);
  }
  
  .auth-header {
    margin-bottom: var(--space-6);
  }
}

/* ========================================
 * 项目详情页响应式
 * ======================================== */

@media (max-width: 991.98px) {
  .project-title {
    font-size: var(--font-size-2xl);
  }
  
  .sticky-sidebar {
    position: static;
  }
  
  .rewards-section {
    margin-top: var(--space-6);
  }
}

@media (max-width: 575.98px) {
  .project-info-card .funding-amount {
    font-size: var(--font-size-3xl);
  }
  
  .project-info-card .funding-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .reward-card {
    padding: var(--space-4);
  }
  
  .reward-card .reward-price {
    font-size: var(--font-size-xl);
  }
}

/* ========================================
 * 用户仪表板响应式
 * ======================================== */

@media (max-width: 575.98px) {
  .dashboard-header .d-flex {
    flex-direction: column;
    text-align: center;
  }
  
  .dashboard-header .btn-custom {
    width: 100%;
  }
  
  .project-list-item,
  .pledge-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  
  .project-list-item .status-tag,
  .pledge-list-item .status-tag {
    align-self: flex-start;
  }
}
