/* 荷香净舍 - 民宿管理系统 */
:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --accent: #95d5b2;
  --accent-light: #d8f3dc;
  --gold: #b8860b;
  --gold-light: #f5deb3;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #3b82f6;
  --purple: #7c3aed;
  --bg: #f0f7f4;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #40916c 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(149,213,178,0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(184,134,11,0.08) 0%, transparent 40%);
}
.login-box {
  background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  border-radius: 20px; padding: 48px 40px; width: 400px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); box-shadow: 0 4px 16px rgba(45,106,79,0.3); }
.login-logo h1 { font-size: 24px; color: var(--primary-dark); margin-top: 12px; letter-spacing: 4px; }
.login-logo p { font-size: 12px; color: var(--text-light); margin-top: 4px; letter-spacing: 2px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 500; }
.login-form input {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 15px; transition: all 0.3s; background: #f9fafb;
}
.login-form input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(45,106,79,0.1); background: #fff; }
.btn {
  padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,106,79,0.3); }
.btn-block { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ===== 主布局 ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff; padding: 0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.sidebar-header {
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: center;
}
.sidebar-header h2 { font-size: 18px; letter-spacing: 3px; }
.sidebar-header p { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.sidebar-nav { padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.2s; font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; border-left-color: var(--accent); }
.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.8); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; opacity: 0.7; }

.main-content { margin-left: 220px; flex: 1; padding: 24px; min-height: 100vh; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--primary-dark); }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 16px; border: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--primary-dark); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ===== 房态看板 ===== */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.room-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  border: 2px solid var(--border); cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.room-card.vacant { border-color: #22c55e; background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%); }
.room-card.booked { border-color: #f59e0b; background: linear-gradient(135deg, #fffbeb 0%, #fff 100%); }
.room-card.occupied { border-color: #ef4444; background: linear-gradient(135deg, #fef2f2 0%, #fff 100%); }
.room-card.cleaning { border-color: #f97316; background: linear-gradient(135deg, #fff7ed 0%, #fff 100%); }
.room-card.long_stay { border-color: #8b5cf6; background: linear-gradient(135deg, #f5f3ff 0%, #fff 100%); }
.room-no { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.room-type { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.room-badge {
  position: absolute; top: 10px; right: 10px; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.room-badge.vacant { background: #dcfce7; color: #16a34a; }
.room-badge.booked { background: #fef3c7; color: #d97706; }
.room-badge.occupied { background: #fee2e2; color: #dc2626; }
.room-badge.cleaning { background: #ffedd5; color: #ea580c; }
.room-badge.long_stay { background: #ede9fe; color: #7c3aed; }
.room-price { font-size: 12px; color: var(--gold); margin-top: 8px; font-weight: 600; }
.room-customer { font-size: 12px; color: var(--text-light); margin-top: 6px; }
.room-mahjong { font-size: 11px; color: #8b5cf6; }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary);
}
.stat-card.income { border-left-color: #22c55e; }
.stat-card.expense { border-left-color: #ef4444; }
.stat-card.profit { border-left-color: var(--gold); }
.stat-card.rooms { border-left-color: var(--info); }
.stat-label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-card.income .stat-value { color: #16a34a; }
.stat-card.expense .stat-value { color: #dc2626; }
.stat-card.profit .stat-value { color: var(--gold); }
.stat-card.rooms .stat-value { color: var(--info); }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--accent-light); padding: 12px 16px; text-align: left; font-size: 13px; color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:hover td { background: #f9fafb; }

/* ===== 表单 ===== */
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; transition: all 0.2s; background: #fff;
}
.form-control:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(45,106,79,0.1); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ===== 弹窗 ===== */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
  background: #fff; border-radius: 16px; padding: 28px; max-width: 600px; width: 90vw;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.modal-close { width: 32px; height: 32px; border: none; background: #f3f4f6; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #e5e7eb; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== 确认弹窗 ===== */
.modal-confirm { text-align: center; padding: 32px 24px !important; }
.confirm-icon {
  width: 64px; height: 64px; background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 32px; color: white; box-shadow: 0 4px 16px rgba(34,197,94,0.4);
}
.confirm-title { font-size: 20px; font-weight: 700; color: #1f2937; margin-bottom: 12px; }
.confirm-message { font-size: 14px; color: #6b7280; line-height: 1.6; white-space: pre-line; margin-bottom: 24px; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 20px; right: 20px; padding: 12px 24px; background: var(--primary);
  color: #fff; border-radius: 8px; font-size: 14px; z-index: 2000;
  transform: translateX(calc(100% + 40px)); transition: transform 0.3s; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(0); }
.toast.error { background: var(--danger); }
.toast.success { background: #16a34a; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-vacant { background: #dcfce7; color: #16a34a; }
.tag-booked { background: #fef3c7; color: #d97706; }
.tag-occupied { background: #fee2e2; color: #dc2626; }
.tag-cleaning { background: #ffedd5; color: #ea580c; }
.tag-long_stay { background: #ede9fe; color: #7c3aed; }
.tag-daily { background: #dbeafe; color: #2563eb; }
.tag-hourly { background: #fef3c7; color: #d97706; }
.tag-long_stay_type { background: #ede9fe; color: #7c3aed; }
.tag-cash { background: #dcfce7; color: #16a34a; }
.tag-wechat { background: #dcfce7; color: #07c160; }
.tag-alipay { background: #dbeafe; color: #1677ff; }
.tag-meituan { background: #fef3c7; color: #d97706; }
.tag-douyin { background: #f3f4f6; color: #1f2937; }
.tag-kuaishou { background: #ffedd5; color: #ea580c; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ===== 响应式 ===== */
/* 手机端顶部工具栏 - 默认显示，电脑端隐藏 */
.mobile-topbar {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: #1b4332;
  color: white;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
}
.menu-btn:active { background: #eee; }
.menu-icon { font-size: 18px; line-height: 1; }
.menu-label { font-size: 18px; color: #1b4332; font-weight: 800; letter-spacing: 3px; }

.mobile-topbar .title { font-size: 16px; font-weight: 600; }
.title-spacer { width: 70px; }

/* 电脑端隐藏手机顶栏，恢复侧边栏 */
body.is-desktop .mobile-topbar { display: none; }
body.is-desktop .sidebar { position: relative; transform: none; }
body.is-desktop .main-content { margin-left: 220px; padding-top: 0; }

/* 手机端侧边栏 */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0; width: 220px;
  transform: translateX(-100%);
  transition: transform 0.3s;
  z-index: 1001;
}
.sidebar.mobile-open { transform: translateX(0); }
.sidebar-header { padding: 60px 16px 16px; }

/* 手机端主内容 */
.main-content { margin-left: 0 !important; padding: 12px; padding-top: 60px; }

/* 侧边栏遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}
.sidebar-overlay.show {
  display: block;
}

/* 悬浮新增按钮（手机端+电脑端通用） */
.fab {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 20px;
  padding: 14px 24px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 999;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:active { transform: scale(0.95); }
.fab-income { background: #2d6a4f; }
.fab-income:hover { background: #1b4332; box-shadow: 0 6px 20px rgba(45,106,79,0.5); }
.fab-expense { background: #e74c3c; }
.fab-expense:hover { background: #c0392b; box-shadow: 0 6px 20px rgba(231,76,60,0.5); }

/* 手机端和电脑端都显示悬浮按钮 */
@media (max-width: 900px) {
  .header-btn { display: none; }
  .fab { display: block; }
}
@media (min-width: 901px) {
  .fab { display: block; }
}

/* ===== 手机端全局适配 ===== */
body:not(.is-desktop) .page-title { font-size: 18px; }
body:not(.is-desktop) .page-header { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
body:not(.is-desktop) .page-header .btn { font-size: 13px; padding: 6px 12px; }

body:not(.is-desktop) .card { padding: 12px; margin-bottom: 12px; }
body:not(.is-desktop) .card-title { font-size: 14px; margin-bottom: 10px; }

body:not(.is-desktop) .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
body:not(.is-desktop) .stat-card { padding: 12px; }
body:not(.is-desktop) .stat-value { font-size: 20px; }

body:not(.is-desktop) .room-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
body:not(.is-desktop) .room-no { font-size: 20px; }
body:not(.is-desktop) .room-card { padding: 10px; }

body:not(.is-desktop) .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
body:not(.is-desktop) th, body:not(.is-desktop) td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

body:not(.is-desktop) .form-row { grid-template-columns: 1fr; gap: 0; }
body:not(.is-desktop) .form-group label { font-size: 12px; }
body:not(.is-desktop) .form-control { font-size: 16px; padding: 10px 12px; }

body:not(.is-desktop) .modal-content { width: 95vw; padding: 16px; max-height: 85vh; border-radius: 12px; }
body:not(.is-desktop) .modal-title { font-size: 16px; }
body:not(.is-desktop) .modal-footer { flex-wrap: wrap; }

body:not(.is-desktop) .btn { font-size: 13px; padding: 8px 14px; }
body:not(.is-desktop) .btn-sm { font-size: 12px; padding: 4px 10px; }

body:not(.is-desktop) .confirm-icon { width: 48px; height: 48px; font-size: 24px; }
body:not(.is-desktop) .confirm-title { font-size: 16px; }
body:not(.is-desktop) .confirm-message { font-size: 13px; }

/* 房间管理 - 手机端卡片 */
.room-manage-cards { display: none; }
body:not(.is-desktop) .room-table-desktop { display: none; }
body:not(.is-desktop) .room-manage-cards { display: block; }

.room-manage-card {
  background: #f9fafb; border-radius: 10px; padding: 12px 14px;
  margin-bottom: 10px; border: 1px solid #e5e7eb;
}
.room-manage-card-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.room-manage-card-no { font-size: 20px; font-weight: 800; color: #1b4332; }
.room-manage-card-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
  font-size: 13px; color: #6b7280;
}
.room-manage-card-info span { display: flex; justify-content: space-between; }
.room-manage-card-info .val { color: #1f2937; font-weight: 500; }
.room-manage-card-actions {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}
.room-manage-card-actions .btn { flex: 1; text-align: center; font-size: 12px; }

/* ===== 打印 ===== */
@media print {
  .sidebar, .btn, .page-header { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
}
