/* ===== 手机端专用样式（.is-mobile） ===== */

.is-mobile {
  --header-h: 52px;
  --tabbar-h: 56px;
  --admin-bar-h: 56px;
  --admin-tt-topbar-h: 120px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.is-mobile body {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  -webkit-tap-highlight-color: transparent;
}

.is-mobile body.admin-mode {
  padding-bottom: calc(var(--tabbar-h) + var(--admin-bar-h) + var(--safe-bottom));
}

.is-mobile .nav {
  display: none;
}

.is-mobile .header-inner {
  justify-content: space-between;
}

.is-mobile .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.is-mobile .mobile-admin-btn {
  display: inline-flex;
}

.is-desktop .mobile-admin-btn {
  display: none;
}

.is-mobile .btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
}

.is-mobile #printBtn {
  display: none;
}

.is-mobile .hero {
  padding: 48px 0 32px;
  margin-top: var(--header-h);
}

.is-mobile .hero-title {
  font-size: 26px;
}

.is-mobile .hero-subtitle {
  font-size: 15px;
  margin-bottom: 20px;
}

.is-mobile .hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.is-mobile .hero-meta-item {
  padding: 8px 12px;
  font-size: 12px;
  justify-content: center;
}

.is-mobile .section {
  padding: 36px 0;
}

.is-mobile .container {
  padding: 0 16px;
}

.is-mobile .section-title {
  font-size: 22px;
  margin-bottom: 20px;
}

.is-mobile .overview-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.is-mobile .overview-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  gap: 0 12px;
  padding: 16px;
  align-items: center;
  position: relative;
}

.is-mobile .overview-card-icon {
  grid-row: 1 / 3;
  font-size: 28px;
  margin: 0;
}

.is-mobile .overview-card-label {
  margin: 0;
}

.is-mobile .overview-card-value {
  font-size: 14px;
  font-weight: 500;
}

.is-mobile .admin-mode .btn-edit {
  opacity: 1;
}

.is-mobile .card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
}

.is-mobile .tip-card,
.is-mobile .checklist-group {
  position: relative;
}

.is-mobile #tencentMapContainer {
  height: 260px;
}

.is-mobile .map-placeholder {
  min-height: 260px;
}

.is-mobile .map-desc {
  font-size: 13px;
  padding: 0 8px;
}

.is-mobile .day-nav {
  top: calc(var(--header-h) + 4px);
  margin: 0 -16px 24px;
  padding: 8px 16px;
  justify-content: flex-start;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.is-mobile .day-nav::-webkit-scrollbar {
  display: none;
}

.is-mobile .day-nav-btn {
  flex-shrink: 0;
  padding: 8px 16px;
}

.is-mobile .timeline {
  padding-left: 0;
}

.is-mobile .timeline::before {
  display: none;
}

.is-mobile .day-card {
  margin-bottom: 20px;
  padding: 20px 16px;
}

.is-mobile .day-card::before {
  display: none;
}

.is-mobile .day-label {
  display: block;
  margin: 0 0 6px;
  width: fit-content;
}

.is-mobile .day-title {
  font-size: 18px;
  display: block;
}

.is-mobile .schedule-item {
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 12px;
}

.is-mobile .schedule-time {
  font-size: 13px;
}

.is-mobile .schedule-content h4 {
  font-size: 15px;
}

.is-mobile .map-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--primary-light);
  border-radius: 12px;
  margin-top: 4px;
}

.is-mobile .btn-add-day {
  margin-left: 0;
  width: 100%;
}

.is-mobile .checklist-grid {
  grid-template-columns: 1fr;
}

.is-mobile .checklist-item {
  padding: 12px;
  min-height: 48px;
}

.is-mobile .checkmark {
  width: 22px;
  height: 22px;
}

.is-mobile .tips-grid {
  grid-template-columns: 1fr;
}

.mobile-tabbar {
  display: none;
}

.is-mobile .mobile-tabbar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 90;
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -2px 12px rgb(0 0 0 / 0.06);
}

.is-mobile .mobile-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: none;
  font-family: inherit;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.is-mobile .mobile-tab-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.is-mobile .mobile-tab-label {
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.is-mobile .mobile-tab.active {
  color: var(--primary);
}

.is-mobile .mobile-tab-more.active {
  color: var(--primary);
}

/* 更多菜单 */
.mobile-more-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
}

.mobile-more-sheet.active {
  display: block;
}

.mobile-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.mobile-more-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  animation: mobileSheetUp 0.28s ease;
  max-height: 75vh;
  overflow-y: auto;
}

body.admin-mode .mobile-more-panel {
  padding-bottom: calc(var(--tabbar-h) + var(--admin-bar-h) + 12px + var(--safe-bottom));
  max-height: 85vh;
}

body.more-sheet-open .admin-bar,
body.more-sheet-open .mobile-tabbar {
  z-index: 80;
}

.is-mobile body.more-sheet-open .admin-bar {
  visibility: hidden;
  pointer-events: none;
}

@keyframes mobileSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mobile-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.mobile-more-header h4 {
  font-size: 16px;
  font-weight: 600;
}

.mobile-more-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.mobile-more-links {
  padding: 8px 12px 16px;
}

.mobile-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.mobile-more-item:active {
  background: var(--bg);
}

.mobile-more-icon {
  font-size: 22px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

body.more-sheet-open {
  overflow: hidden;
}

.is-desktop .view-toggle-desktop {
  display: inline-flex;
}

.is-mobile .day-actions {
  position: static;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.is-mobile .day-header {
  flex-direction: column;
  align-items: stretch;
}

.is-mobile .btn-edit,
.is-mobile .btn-delete {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

.is-mobile .tiantian-badge,
.is-mobile .admin-change-badge {
  font-size: 10px;
  padding: 2px 6px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
}

.is-mobile .tiantian-changes-section {
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.is-mobile .tiantian-changes-header {
  flex-direction: column;
  align-items: flex-start;
}

.is-mobile .tiantian-changelog-list {
  max-height: 280px;
}

.is-mobile .modal-content-wide {
  max-width: 94%;
}

.is-mobile .account-row {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.is-mobile .account-row-actions {
  width: 100%;
  justify-content: flex-end;
}

.is-mobile .account-create-form .form-row {
  grid-template-columns: 1fr;
}

.mobile-more-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.mobile-more-subtitle {
  margin: 4px 16px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.mobile-more-item.mobile-more-danger {
  color: #b91c1c;
}

.mobile-more-sheet.admin-sheet-focus .mobile-more-subtitle.mobile-admin-only,
.mobile-more-sheet.admin-sheet-focus .mobile-admin-only {
  animation: mobileAdminPulse 0.6s ease;
}

@keyframes mobileAdminPulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(37, 99, 235, 0.08); }
}

.is-mobile .admin-bar .tiantian-online-status,
.is-mobile .admin-bar .admin-sync-status {
  display: none !important;
}

.is-mobile .admin-bar {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  height: auto;
  min-height: 48px;
  flex-wrap: nowrap;
  padding: 6px 12px;
  gap: 8px;
  justify-content: space-between;
  align-content: center;
}

.is-mobile .admin-bar-text {
  width: auto;
  flex: 1;
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-mobile .admin-tiantian-topbar {
  top: var(--header-h);
}

.is-mobile .admin-tiantian-loc-list {
  max-height: 100px;
}

.is-mobile body.admin-tt-topbar-active .hero {
  margin-top: calc(var(--header-h) + var(--admin-tt-topbar-offset, 130px));
}

.is-mobile body.admin-tt-topbar-active .admin-tiantian-topbar.is-idle {
  --admin-tt-topbar-offset: 88px;
}

.is-mobile body.admin-tt-topbar-active .admin-tiantian-topbar:not(.is-idle) {
  --admin-tt-topbar-offset: 150px;
}

.is-mobile .admin-bar .btn-outline:not(.mobile-admin-menu-btn) {
  display: none;
}

.is-mobile .admin-bar .btn-danger,
.is-mobile .admin-bar #logoutBtn {
  display: none !important;
}

.is-mobile .mobile-admin-menu-btn {
  display: inline-flex;
  flex-shrink: 0;
}

.is-desktop .mobile-admin-menu-btn {
  display: none !important;
}

.is-mobile body.admin-mode.view-user-active {
  padding-top: calc(var(--header-h) + 44px);
}

.is-mobile .view-user-banner.active {
  display: flex;
  top: var(--header-h);
  z-index: 198;
}

.is-mobile .server-offline-banner.active {
  top: var(--header-h);
}

.is-mobile .admin-bar .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.is-mobile .modal-content {
  width: 94%;
  max-height: 90vh;
  padding: 24px 20px;
  margin-bottom: var(--safe-bottom);
}

.is-mobile .modal-lg {
  max-width: 94%;
}

.is-mobile .modal-actions {
  flex-direction: column-reverse;
}

.is-mobile .modal-actions .btn {
  width: 100%;
}

.view-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.view-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.is-mobile .view-toggle-mobile {
  display: inline-flex;
}

.is-desktop .view-toggle-mobile {
  display: none;
}

.is-mobile .travel-map-figure {
  max-width: min(100%, 420px);
  width: 100%;
}

.is-mobile .travel-map-media,
.is-mobile .travel-map-img {
  width: 100%;
}

.is-mobile .travel-map-section {
  padding-top: 28px;
  padding-bottom: 16px;
}

.is-mobile .travel-map-desc {
  font-size: 13px;
  padding: 0 4px;
}

.is-mobile .travel-map-figure {
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

.is-mobile .travel-map-media {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.is-mobile .travel-map-lightbox {
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
}

.is-mobile .travel-map-lightbox-close {
  top: max(8px, env(safe-area-inset-top));
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 28px;
  z-index: 2;
}

.is-mobile .travel-map-lightbox-inner {
  max-width: 100%;
  max-height: calc(100vh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.is-mobile .footer {
  padding-bottom: 16px;
  font-size: 12px;
}

.is-desktop .mobile-tabbar,
.is-desktop .mobile-more-sheet {
  display: none !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
