/**
 * Jun Homestay Admin - Native iOS & Mobile App Stylesheet
 * Optimized for iPhone (Dynamic Island, Notch, Safe Areas, WebClip Standalone)
 */

:root {
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-safe-left: env(safe-area-inset-left, 0px);
  --app-safe-right: env(safe-area-inset-right, 0px);
  --app-brand-red: #c82333;
  --app-brand-gold: #ffc107;
  --app-tab-height: 60px;
}

/* Tối ưu cảm ứng toàn hệ thống chuẩn Native App */
html, body {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* Đảm bảo nội dung không bị notch / Dynamic Island che khuất */
body {
  padding-top: var(--app-safe-top);
  padding-left: var(--app-safe-left);
  padding-right: var(--app-safe-right);
  transition: padding-bottom 0.2s ease;
}

/* Bỏ viền chọn văn bản khi chạm nhanh trên nút */
.btn, .nav-link, .ios-tab-item, .card-header, .badge, .dropdown-item {
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================
   THANH ĐIỀU HƯỚNG ĐÁY CHUẨN IOS (BOTTOM TAB BAR)
   ========================================================== */
.ios-bottom-nav {
  display: none; /* Mặc định ẩn trên màn hình lớn */
}

@media (max-width: 768px) {
  /* Thêm khoảng trống đệm dưới cùng cho body để tránh bị Bottom Bar che */
  body {
    padding-bottom: calc(var(--app-tab-height) + var(--app-safe-bottom) + 12px) !important;
  }

  /* Thanh tab bar dưới đáy chuẩn Apple */
  .ios-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--app-tab-height) + var(--app-safe-bottom));
    padding-bottom: var(--app-safe-bottom);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 0.5px solid rgba(0, 0, 0, 0.12);
    z-index: 1040;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  }

  .ios-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #8e8e93;
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: -0.2px;
    position: relative;
    transition: color 0.15s ease, transform 0.1s ease;
    padding-top: 4px;
  }

  .ios-tab-item:active {
    transform: scale(0.92);
  }

  .ios-tab-item i {
    font-size: 22px;
    margin-bottom: 2px;
    line-height: 1;
    display: block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .ios-tab-item.active {
    color: var(--app-brand-red);
    font-weight: 600;
  }

  .ios-tab-item.active i {
    transform: translateY(-2px);
    color: var(--app-brand-red);
  }

  .ios-tab-badge {
    position: absolute;
    top: 3px;
    right: calc(50% - 18px);
    background: #ff3b30;
    color: #fff;
    border-radius: 10px;
    font-size: 9.5px;
    font-weight: bold;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    border: 1.5px solid #fff;
  }
}

/* ==========================================================
   NATIVE BOTTOM SHEET / DRAWER (BẢNG MENU THÊM)
   ========================================================== */
.ios-offcanvas-sheet {
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
  max-height: 85vh !important;
  background: #ffffff !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18) !important;
  padding-bottom: calc(var(--app-safe-bottom) + 16px) !important;
}

.sheet-grab-bar {
  width: 42px;
  height: 5px;
  background: #d1d1d6;
  border-radius: 3px;
  margin: 10px auto 16px auto;
}

.ios-grid-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 10px;
  padding: 4px 10px 16px 10px;
}

@media (max-width: 400px) {
  .ios-grid-menu {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ios-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #1c1c1e;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  transition: transform 0.12s ease;
}

.ios-grid-item:active {
  transform: scale(0.92);
}

.ios-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 6px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Màu biểu tượng theo phong cách iOS Squircle */
.bg-ios-red { background: linear-gradient(135deg, #ff453a, #d32f2f); }
.bg-ios-orange { background: linear-gradient(135deg, #ff9f0a, #f57c00); }
.bg-ios-yellow { background: linear-gradient(135deg, #ffd60a, #fbc02d); color: #212529 !important; }
.bg-ios-green { background: linear-gradient(135deg, #32d74b, #2e7d32); }
.bg-ios-teal { background: linear-gradient(135deg, #64d2ff, #0288d1); }
.bg-ios-blue { background: linear-gradient(135deg, #0a84ff, #1565c0); }
.bg-ios-purple { background: linear-gradient(135deg, #bf5af2, #7b1fa2); }
.bg-ios-pink { background: linear-gradient(135deg, #ff375f, #c2185b); }
.bg-ios-gray { background: linear-gradient(135deg, #8e8e93, #455a64); }
.bg-ios-black { background: linear-gradient(135deg, #1c1c1e, #000000); }

/* ==========================================================
   NATIVE CARD & BUTTON REFINEMENTS
   ========================================================== */
.card {
  border-radius: 18px !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04) !important;
}

.card-header {
  border-top-left-radius: 18px !important;
  border-top-right-radius: 18px !important;
}

.btn {
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active {
  transform: scale(0.96);
}

/* Thanh huy hiệu cài app nổi bật trên Header */
.app-install-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.app-install-badge-btn:hover, .app-install-badge-btn:active {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
  color: #fff !important;
}

.app-install-badge-btn i {
  font-size: 15px;
}
