/* ========================================
   环境卫生守护者 - 全局响应式样式
   支持 PC、平板、手机等所有设备
   ======================================== */

:root {
    --primary-color: #2ecc71;
    --primary-dark: #27ae60;
    --primary-light: #a8e6cf;
    --primary-gradient: linear-gradient(135deg, #2ecc71, #27ae60);
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --text-dark: #1a2a3a;
    --text-gray: #5a6e7a;
    --text-light: #8a9aa8;
    --border-color: #e9ecef;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--bg-color);
    overflow-x: hidden;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 超大屏幕 */
@media (min-width: 1400px) {
    html { font-size: 18px; }
    .container { max-width: 1320px; padding: 0 30px; }
}

/* 大屏幕 */
@media (min-width: 1200px) and (max-width: 1399px) {
    html { font-size: 17px; }
    .container { max-width: 1140px; padding: 0 25px; }
}

/* 中等屏幕 */
@media (min-width: 992px) and (max-width: 1199px) {
    html { font-size: 16px; }
    .container { max-width: 960px; padding: 0 20px; }
}

/* 平板横屏 */
@media (min-width: 768px) and (max-width: 991px) {
    html { font-size: 15px; }
    .container { max-width: 720px; padding: 0 20px; }

    .stats-grid { gap: 15px; }
    .menu-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .time-grid { grid-template-columns: repeat(3, 1fr); }
    .guide-steps { flex-wrap: wrap; }
    .step { flex: 0 0 calc(33.33% - 20px); }
}

/* 平板竖屏 */
@media (min-width: 576px) and (max-width: 767px) {
    html { font-size: 14px; }
    .container { padding: 0 15px; }

    .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .time-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .date-item { min-width: 65px; padding: 10px; }
    .date-item .day { font-size: 18px; }
    .step { min-width: 120px; }
    .stats-summary { flex-wrap: wrap; }
    .stat-summary-card { flex: 0 0 calc(50% - 6px); }
}

/* 手机 */
@media (max-width: 575px) {
    html { font-size: 13px; }
    .container { padding: 0 12px; }

    .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .menu-item .icon { width: 48px; height: 48px; font-size: 22px; }
    .products-grid { grid-template-columns: 1fr; gap: 12px; }
    .time-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .date-item { min-width: 60px; padding: 8px 10px; }
    .date-item .day { font-size: 16px; }
    .date-item .weekday { font-size: 11px; }
    .booking-info { flex-direction: column; }
    .info-label { width: 100%; margin-bottom: 4px; }
    .booking-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .booking-actions { flex-direction: column; }
    .stats-summary { flex-wrap: wrap; gap: 10px; }
    .stat-summary-card { flex: 0 0 calc(50% - 5px); }
    .step { min-width: 100px; }
    .step-label { font-size: 10px; }
    .card-header { flex-wrap: wrap; }
    .card-header .badge { margin-left: auto; }
    .form-control, .btn { padding: 12px 14px; }
    .modal-content { width: 90%; margin: 20px; }
    .toast { max-width: 90%; font-size: 12px; padding: 10px 16px; }
}

/* 全面屏适配 */
@supports (padding: max(0px)) {
    .bottom-nav { padding-bottom: max(15px, env(safe-area-inset-bottom)); }
    .top-nav { padding-top: max(12px, env(safe-area-inset-top)); }
}

/* 折叠屏 */
@media (max-width: 280px) {
    .menu-grid { grid-template-columns: repeat(2, 1fr); }
    .date-item { min-width: 55px; padding: 6px 8px; }
    .stat-summary-card { flex: 0 0 100%; }
}

/* 高分辨率 */
@media (min-width: 1920px) {
    .container { max-width: 1600px; }
    .products-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 打印样式 */
@media print {
    .bottom-nav, .top-nav, .btn, .booking-actions { display: none; }
    body { background: white; padding: 20px; }
    .booking-item { break-inside: avoid; page-break-inside: avoid; }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .btn, .menu-item, .nav-item, .time-card, .robot-card, .date-item {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .btn:active, .menu-item:active, .nav-item:active,
    .time-card:active, .robot-card:active, .date-item:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
    .btn, .menu-item, .nav-item { min-height: 44px; }
    ::-webkit-scrollbar { width: 4px; height: 4px; }
    ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
    ::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a2e;
        --white: #16213e;
        --text-dark: #eeeeee;
        --text-gray: #cccccc;
        --text-light: #aaaaaa;
        --border-color: #2a2a3a;
    }
    body { background-color: #0f0f1a; }
    .card, .login-card, .register-card, .booking-item,
    .function-section, .record-section { background: var(--white); }
    .input-wrapper { background: #1e1e2e; }
    .input-wrapper input { color: var(--text-dark); }
}

/* 横屏模式 */
@media (orientation: landscape) and (max-height: 500px) {
    .top-nav { position: relative; }
    .bottom-nav { position: relative; margin-top: 20px; }
    body { padding-bottom: 0; }
    .booking-content { padding: 10px; }
    .card { margin-bottom: 10px; }
}

/* 动画减少 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 辅助类 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }

.hide-on-mobile { display: block; }
.hide-on-tablet { display: block; }
.show-on-mobile { display: none; }

@media (max-width: 767px) {
    .hide-on-mobile { display: none; }
    .show-on-mobile { display: block; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .hide-on-tablet { display: none; }
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }