/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: calc(100vw / 7.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 工具类 ==================== */
.container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 0.3rem;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* ==================== 头部样式 ==================== */
.header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #ff6b35, #f7c948);
  color: white;
  padding: 0.3rem 0.3rem;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}

.header h1 {
  font-size: 0.42rem;
  font-weight: 600;
  text-align: center;
}

/* 餐次切换器 */
.meal-type-selector {
  display: flex;
  justify-content: center;
  gap: 0.15rem;
  margin: 0.2rem 0;
}

.meal-type-btn {
  padding: 0.1rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.5rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.24rem;
  cursor: pointer;
  transition: all 0.2s;
}

.meal-type-btn.active {
  background: white;
  color: #ff6b35;
  border-color: white;
}

.meal-type-btn:active {
  transform: scale(0.95);
}

/* ==================== 搜索框 ==================== */
.search-box {
  position: relative;
  margin: 0.25rem 0;
}

.search-box input {
  width: 100%;
  padding: 0.2rem 0.9rem 0.2rem 0.7rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.28rem;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  transition: box-shadow 0.3s;
}

.search-box input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* ==================== 分类标签 ==================== */
.category-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex-shrink: 0;
  padding: 0.12rem 0.35rem;
  border-radius: 0.5rem;
  font-size: 0.26rem;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.category-tab.active {
  background: white;
  color: #ff6b35;
}

/* ==================== 菜品列表 ==================== */
.menu-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  padding: 0.25rem 0;
}

.menu-item {
  background: white;
  border-radius: 0.2rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.menu-item:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.menu-item-image {
  width: 100%;
  height: 2.8rem;
  object-fit: cover;
  background: #eee;
  display: block;
}

.menu-item-content {
  padding: 0.2rem;
}

.menu-item-name {
  font-size: 0.28rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.08rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-item-category {
  font-size: 0.22rem;
  color: #999;
}

.menu-item-fav {
  width: 0.45rem;
  height: 0.45rem;
  border: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ddd'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s;
}

.menu-item-fav.active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b35'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
  transform: scale(1.1);
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 1rem 0;
  color: #999;
  font-size: 0.28rem;
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0.3rem;
}

.modal {
  background: white;
  border-radius: 0.3rem;
  width: 100%;
  max-width: 6rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 0.32rem;
}

.modal-close {
  width: 0.5rem;
  height: 0.5rem;
  border: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  cursor: pointer;
}

.modal-body {
  padding: 0.3rem;
}

.detail-image {
  width: 100%;
  height: 4rem;
  object-fit: cover;
  border-radius: 0.15rem;
}

.detail-name {
  font-size: 0.36rem;
  font-weight: 600;
  margin: 0.2rem 0;
}

.detail-category {
  display: inline-block;
  padding: 0.05rem 0.15rem;
  background: #fff3e0;
  color: #ff6b35;
  border-radius: 0.08rem;
  font-size: 0.22rem;
}

.detail-desc {
  font-size: 0.26rem;
  color: #666;
  line-height: 1.6;
  margin-top: 0.2rem;
}

.detail-time {
  font-size: 0.22rem;
  color: #999;
  margin-top: 0.15rem;
}

/* 点餐按钮 */
.order-btn {
  width: 100%;
  padding: 0.25rem;
  margin-top: 0.3rem;
  background: linear-gradient(135deg, #ff6b35, #ff8f5a);
  color: white;
  border: none;
  border-radius: 0.15rem;
  font-size: 0.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.order-btn:active {
  transform: scale(0.98);
  background: linear-gradient(135deg, #e55a28, #ff6b35);
}

.order-btn.ordered {
  background: #ccc;
  color: #999;
}

/* ==================== 管理端样式 ==================== */
.admin-container {
  padding: 0.3rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 0.3rem;
}

.admin-title {
  font-size: 0.36rem;
  font-weight: 600;
}

.admin-btn {
  padding: 0.15rem 0.3rem;
  border: none;
  border-radius: 0.1rem;
  font-size: 0.26rem;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-btn-primary {
  background: #ff6b35;
  color: white;
}

.admin-btn-primary:active {
  background: #e55a28;
}

.admin-btn-danger {
  background: #ff4444;
  color: white;
}

.admin-btn-secondary {
  background: #666;
  color: white;
}

.admin-btn-small {
  padding: 0.08rem 0.2rem;
  font-size: 0.22rem;
  border-radius: 0.08rem;
  border: none;
  cursor: pointer;
  margin-left: 0.15rem;
}

.admin-btn-edit {
  background: #4a90d9;
  color: white;
}

.admin-btn-del {
  background: #ff4444;
  color: white;
}

/* ==================== 表单样式 ==================== */
.form-group {
  margin-bottom: 0.3rem;
}

.form-label {
  display: block;
  font-size: 0.26rem;
  color: #666;
  margin-bottom: 0.1rem;
}

.form-input {
  width: 100%;
  padding: 0.2rem;
  border: 1px solid #ddd;
  border-radius: 0.1rem;
  font-size: 0.28rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: #ff6b35;
}

.form-select {
  width: 100%;
  padding: 0.2rem;
  border: 1px solid #ddd;
  border-radius: 0.1rem;
  font-size: 0.28rem;
  background: white;
  outline: none;
}

textarea.form-input {
  min-height: 1.5rem;
  resize: vertical;
}

/* ==================== 管理列表 ==================== */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-item {
  display: flex;
  align-items: center;
  padding: 0.2rem;
  background: white;
  border-radius: 0.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-item-image {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 0.1rem;
  object-fit: cover;
  flex-shrink: 0;
}

.admin-item-info {
  flex: 1;
  margin-left: 0.2rem;
  overflow: hidden;
}

.admin-item-name {
  font-size: 0.28rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item-meta {
  font-size: 0.22rem;
  color: #999;
  display: flex;
  gap: 0.2rem;
  margin-top: 0.05rem;
}

.admin-item-actions {
  display: flex;
  gap: 0.1rem;
  flex-shrink: 0;
}

/* ==================== 图片预览和图库链接 ==================== */
.image-preview-box {
  margin-top: 0.15rem;
}

.image-preview {
  width: 100%;
  height: 2rem;
  background: #f5f5f5;
  border-radius: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview span {
  color: #999;
  font-size: 0.24rem;
}

.image-sites {
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem;
}

.image-sites-label {
  font-size: 0.22rem;
  color: #666;
}

.image-site-link {
  font-size: 0.22rem;
  color: #ff6b35;
  text-decoration: none;
  padding: 0.05rem 0.15rem;
  background: #fff3e0;
  border-radius: 0.08rem;
  transition: all 0.2s;
}

.image-site-link:hover {
  background: #ffe0cc;
}

/* ==================== 点菜记录（按餐次） ==================== */
.order-sessions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.order-session {
  background: white;
  border-radius: 0.2rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.order-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.2rem;
  background: linear-gradient(135deg, #ff6b35, #ff8f5a);
  color: white;
}

.order-session-info {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.order-session-date {
  font-size: 0.28rem;
  font-weight: 600;
}

.order-session-type {
  font-size: 0.24rem;
  background: rgba(255, 255, 255, 0.3);
  padding: 0.03rem 0.15rem;
  border-radius: 0.08rem;
}

.order-session-count {
  font-size: 0.22rem;
  opacity: 0.9;
}

.order-session-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.08rem 0.2rem;
  border-radius: 0.08rem;
  font-size: 0.22rem;
  cursor: pointer;
}

.order-session-items {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem;
}

.order-item {
  display: flex;
  align-items: center;
  padding: 0.15rem;
  background: #fafafa;
  border-radius: 0.1rem;
}

.order-item-image {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.08rem;
  object-fit: cover;
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
  margin-left: 0.15rem;
  overflow: hidden;
}

.order-item-name {
  font-size: 0.26rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item-category {
  font-size: 0.2rem;
  color: #ff6b35;
  background: #fff3e0;
  padding: 0.02rem 0.1rem;
  border-radius: 0.05rem;
  margin-left: 0.15rem;
  flex-shrink: 0;
}

/* ==================== 登录页 ==================== */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: linear-gradient(135deg, #ff6b35, #f7c948);
}

.login-box {
  background: white;
  padding: 0.6rem;
  border-radius: 0.3rem;
  width: 100%;
  max-width: 5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-title {
  text-align: center;
  font-size: 0.4rem;
  font-weight: 600;
  color: #ff6b35;
  margin-bottom: 0.4rem;
}

.login-error {
  color: #ff4444;
  font-size: 0.24rem;
  text-align: center;
  margin-bottom: 0.2rem;
  min-height: 0.3rem;
}

/* ==================== 按钮组 ==================== */
.btn-group {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.btn-group .admin-btn {
  flex: 1;
  padding: 0.25rem;
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 99;
  max-width: 750px;
  margin: 0 auto;
}

.bottom-nav-item {
  flex: 1;
  padding: 0.15rem;
  text-align: center;
  font-size: 0.22rem;
  color: #999;
  text-decoration: none;
  display: block;
}

.bottom-nav-item.active {
  color: #ff6b35;
}

.bottom-nav-icon {
  width: 0.45rem;
  height: 0.45rem;
  margin: 0 auto 0.05rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.nav-home .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E");
}

.nav-home.active .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b35'%3E%3Cpath d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E");
}

.nav-fav .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
}

.nav-fav.active .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b35'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
}

.nav-order .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z'/%3E%3C/svg%3E");
}

.nav-order.active .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b35'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z'/%3E%3C/svg%3E");
}

.nav-admin .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

.nav-admin.active .bottom-nav-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b35'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

/* 底部导航占位 */
.nav-placeholder {
  height: 1rem;
}

/* ==================== 提示信息 ==================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.3rem 0.5rem;
  border-radius: 0.15rem;
  font-size: 0.28rem;
  z-index: 2000;
  animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==================== 响应式调整 ==================== */
@media (min-width: 768px) {
  html {
    font-size: 50px;
  }

  .menu-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
  }
}
