/* components.css */

/* 1. Sidebar Nổi Trên Bản Đồ (Floating Overlay) */
.sidebar {
  width: 320px;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: #ffffff;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform var(--transition-normal);
}

.sidebar.collapsed {
  transform: translateX(-100%);
  box-shadow: none;
}

.sidebar-header {
  padding: 14px 18px;
  background: #d8232a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background var(--transition-fast);
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Nút mở lại sidebar khi đã thu gọn */
.sidebar-expand-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 9;
  background: #d8232a;
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  cursor: pointer;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-fast);
}

.sidebar-expand-btn:hover {
  background: #ef4444;
}

.sidebar-expand-btn.visible {
  display: flex;
}

/* Thông tin cơ bản tỉnh Bắc Ninh */
.province-info-box {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  font-size: 0.9rem;
  line-height: 1.4;
}

.info-row .label {
  width: 90px;
  font-weight: 600;
  color: #334155;
  border-left: 3px solid #0284c7;
  padding-left: 8px;
}

.info-row .val {
  flex: 1;
  color: #0f172a;
}

/* Khu vực Tìm kiếm */
.search-section {
  padding: 14px 18px 8px 18px;
}

.search-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
  background: #f8fafc;
  transition: all var(--transition-fast);
}

.search-input:focus {
  background: #ffffff;
  border-color: #d8232a;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: none;
}

/* Danh sách xã phường */
.commune-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 14px 12px;
  list-style: none;
  margin: 0;
}

.commune-item {
  padding: 9px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition-fast);
  font-size: 0.92rem;
  color: #334155;
}

.commune-item:hover {
  background: #f1f5f9;
  color: #d8232a;
}

.commune-item.active {
  background: #fef2f2;
  color: #d8232a;
  font-weight: 700;
}

.commune-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.commune-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.commune-matched-sub {
  font-size: 0.76rem;
  color: #64748b;
  font-style: italic;
  font-weight: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.commune-item:hover .commune-matched-sub {
  color: #d8232a;
}

.commune-item.active .commune-matched-sub {
  color: #dc2626;
  font-weight: 500;
}

.commune-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.commune-item:nth-child(4n+1) .commune-dot { background: #84cc16; }
.commune-item:nth-child(4n+2) .commune-dot { background: #f97316; }
.commune-item:nth-child(4n+3) .commune-dot { background: #8b5cf6; }
.commune-item:nth-child(4n+4) .commune-dot { background: #06b6d4; }

.commune-item.active .commune-dot {
  background: #d8232a;
  box-shadow: 0 0 6px rgba(216, 35, 42, 0.6);
}

/* 2. Map Floating Toolbar */
.map-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.tool-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: all var(--transition-fast);
  color: #475569;
}

.tool-btn:hover {
  background: #f8fafc;
  color: #d8232a;
}

.tool-btn.active {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}

/* 3. Modal / Panel Chi Tiết Xã Phường */
.commune-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: calc(100% - 32px);
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateX(120%);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.commune-modal.open {
  transform: translateX(0);
}

.modal-header {
  flex-shrink: 0;
  padding: 12px 18px;
  background: #d8232a;
  color: white;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-body > * {
  flex-shrink: 0;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* 2 thẻ Dân số & Diện tích */
.stat-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: white;
  display: flex;
  flex-direction: column;
}

.stat-card.blue {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

.stat-card.green {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.stat-card-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  opacity: 0.9;
}

.stat-card-val {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 1px;
}

/* Khối Trung tâm hành chính */
.info-section {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
}

.section-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.section-content {
  font-size: 0.88rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.35;
}

/* Lãnh đạo */
.leader-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.leader-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px dashed #e2e8f0;
}

.leader-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.leader-role {
  font-size: 0.74rem;
  color: #64748b;
}

.leader-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
}

.phone-link {
  color: #0284c7;
  text-decoration: none;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.phone-link:hover {
  text-decoration: underline;
}

/* Nút tin tức */
.news-btn-wrapper {
  margin-top: 2px;
}

.btn-news {
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(135deg, #d8232a, #b91c1c);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(216, 35, 42, 0.25);
  transition: all var(--transition-fast);
}

.btn-news:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Loading & Error */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 12px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Nhãn bản đồ custom-map-label giống 100% OneCMS gốc */
.custom-map-label {
  font-family: var(--font-family);
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  text-align: center;
  line-height: 1.1;
  text-shadow: 1px 1px 2px #ffffff, -1px -1px 2px #ffffff, 1px -1px 2px #ffffff, -1px 1px 2px #ffffff, 0 0 4px #ffffff;
  transition: transform var(--transition-fast);
}

.custom-map-label:hover {
  color: #d8232a;
  transform: scale(1.15);
  z-index: 100;
}

/* Tin tức liên quan trong modal */
.news-preview-section {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.news-preview-header {
  padding: 7px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.news-badge-source {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
}

.news-preview-list {
  display: flex;
  flex-direction: column;
}

.news-preview-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--transition-fast);
}

.news-preview-item:last-child {
  border-bottom: none;
}

.news-preview-item:hover {
  background: #fef9f9;
}

.news-preview-thumb {
  flex-shrink: 0;
  width: 88px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
  background: #f1f5f9;
}

.news-preview-thumb-placeholder {
  flex-shrink: 0;
  width: 88px;
  height: 58px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.news-preview-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.news-preview-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-preview-item:hover .news-preview-title {
  color: #d8232a;
}

.news-preview-time {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: auto;
}

.news-preview-loading {
  padding: 14px 12px;
  font-size: 0.82rem;
  color: #94a3b8;
  text-align: center;
}

.news-preview-empty {
  padding: 14px 12px;
  font-size: 0.82rem;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
}

/* ==========================================================================
   THỜI TIẾT TP. BẮC NINH TRÊN MAP TOOLBAR (TÍNH NĂNG B)
   ========================================================================== */
.weather-tool-btn {
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  height: 42px;
  min-width: 52px;
  padding: 0 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.22);
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.weather-tool-btn:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.weather-tool-btn.open {
  background: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.4);
}

.btn-w-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.btn-w-temp {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0369a1;
  letter-spacing: -0.02em;
}

.weather-tool-btn.open .btn-w-temp {
  color: #ffffff;
}

.live-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  border: 2px solid #ffffff;
  animation: livepulse 2.2s ease infinite;
}

@keyframes livepulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.7; }
}

/* Popover Panel từ Toolbar */
.weather-toolbar-panel {
  position: absolute;
  top: 52px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 28px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
  border: 1.5px solid #bae6fd;
  z-index: 1020;
  overflow: hidden;
  display: none;
  animation: weatherPanelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.weather-toolbar-panel.open {
  display: block;
}

@keyframes weatherPanelIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wp-header {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  padding: 12px 16px 11px;
}

.wp-h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.wp-title {
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 7px;
}

.wp-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wp-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.wp-subtitle {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.68rem;
  line-height: 1.35;
}

.wp-loading {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.84rem;
  color: #64748b;
}

.wp-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #e2e8f0;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: wSpin 0.7s linear infinite;
}

.wp-current-strip {
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border-bottom: 1px solid #bae6fd;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wcs-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.wcs-right {
  display: flex;
  flex-direction: column;
}

.wcs-temp {
  font-size: 1.65rem;
  font-weight: 900;
  color: #0c4a6e;
  line-height: 1;
  letter-spacing: -0.02em;
}

.wcs-desc {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0369a1;
  margin-top: 2px;
}

.wcs-details {
  display: flex;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.wcs-badge {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #0369a1;
}

.wp-sec {
  padding: 10px 14px 6px;
  font-size: 0.67rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-sec-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.src-tag {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.wp-sec-link {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
}

.wp-sec-link:hover {
  text-decoration: underline;
}

.wp-today {
  margin: 0 12px 10px;
  border: 1.5px solid #bae6fd;
  border-radius: 10px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wp-today:hover {
  border-color: #0284c7;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.18);
}

.wp-today-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: #e0f2fe;
}

.wp-today-body {
  padding: 8px 12px 10px;
  background: linear-gradient(to bottom, #f8fcff, #ffffff);
}

.wp-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #0284c7;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  margin-bottom: 5px;
}

.wp-today-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wp-today:hover .wp-today-title {
  color: #0284c7;
}

.wp-today-time {
  font-size: 0.67rem;
  color: #94a3b8;
  margin-top: 4px;
}

.wp-notice-muted {
  margin: 0 12px 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 0.74rem;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wp-notice-muted a {
  color: #0284c7;
  text-decoration: none;
  font-weight: 700;
}

.wp-forecast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px 12px;
}

.wp-fcard {
  background: linear-gradient(145deg, #ddf4ff, #f0fafe 60%, #e4f5fd);
  border: 1.5px solid #bae6fd;
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
}

.wp-fcard-badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(2, 132, 199, 0.12);
  border-radius: 8px;
  padding: 2px 7px;
}

.wp-fcard-date {
  font-size: 0.66rem;
  color: #64748b;
  text-align: center;
  margin-top: 2px;
}

.wp-fcard-icon {
  font-size: 1.9rem;
  line-height: 1;
  margin: 3px 0 1px;
}

.wp-fcard-desc {
  font-size: 0.68rem;
  font-weight: 700;
  color: #0369a1;
  text-align: center;
}

.wp-fcard-temps {
  display: flex;
  gap: 5px;
  align-items: baseline;
  margin-top: 2px;
}

.wp-fmax {
  font-size: 0.88rem;
  font-weight: 900;
  color: #dc2626;
}

.wp-sep {
  font-size: 0.7rem;
  color: #94a3b8;
}

.wp-fmin {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0369a1;
}

.wp-frain {
  font-size: 0.65rem;
  color: #3b82f6;
  font-weight: 600;
  margin-top: 1px;
}

.wp-meteo-src {
  font-size: 0.54rem;
  color: #93c5fd;
  position: absolute;
  bottom: 3px;
  right: 6px;
}

.wp-footer {
  padding: 8px 14px 9px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-fsource {
  font-size: 0.63rem;
  color: #94a3b8;
}

.wp-fsource a {
  color: #0284c7;
  text-decoration: none;
}

.wp-fall {
  font-size: 0.68rem;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
}

.wp-fall:hover {
  text-decoration: underline;
}

.wp-error-box {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

.btn-retry-weather {
  margin-top: 10px;
  padding: 6px 14px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   THỜI TIẾT TỪNG XÃ/PHƯỜNG TRONG MODAL (PHƯƠNG ÁN A - ON-DEMAND)
   ========================================================================== */
.weather-trigger-section {
  flex-shrink: 0 !important;
  min-height: 42px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.weather-trigger-section:hover {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.weather-teaser {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-teaser-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.weather-teaser-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.weather-teaser-hint {
  font-size: 0.7rem;
  color: #0284c7;
  margin-top: 1px;
}

.btn-weather-load {
  flex-shrink: 0;
  padding: 5px 12px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.25);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-weather-load:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.btn-weather-load:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.btn-weather-load.active {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   BẢNG THỜI TIẾT NỔI BÊN CẠNH MODAL (FLYOUT PANEL PHƯƠNG ÁN 1)
   ========================================================================== */
.commune-weather-flyout {
  position: absolute;
  top: 16px;
  right: 472px; /* 16px lề phải + 440px modal + 16px khoảng cách */
  width: 330px;
  max-width: calc(100vw - 490px);
  max-height: calc(100% - 32px);
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22), 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #bae6fd;
  z-index: 22;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: flyoutSlideLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes flyoutSlideLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.weather-flyout-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.weather-flyout-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.w-fly-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.w-fly-title-text {
  min-width: 0;
}

.w-fly-name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.w-fly-updated {
  font-size: 0.7rem;
  opacity: 0.85;
}

.weather-flyout-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.weather-flyout-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.weather-flyout-body {
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  scrollbar-width: thin;
  scrollbar-color: #93c5fd transparent;
}

.weather-flyout-body::-webkit-scrollbar {
  width: 6px;
}

.weather-flyout-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
}

.weather-flyout-body::-webkit-scrollbar-thumb {
  background-color: #93c5fd;
  border-radius: 4px;
}

.weather-flyout-body::-webkit-scrollbar-thumb:hover {
  background-color: #3b82f6;
}


.weather-main-row {
  padding: 6px 14px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.w-icon {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.w-temp {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0c4a6e;
  line-height: 1;
}

.w-desc {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0369a1;
  margin-top: 2px;
}

.w-feel {
  font-size: 0.7rem;
  color: #0284c7;
  margin-top: 1px;
}

.w-badges {
  margin: 0 14px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.w-badge {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #bae6fd;
  border-radius: 20px;
  padding: 4px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 3px;
}

.w-forecast {
  margin: 0 14px 10px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(186, 230, 253, 0.7);
}

.w-forecast-title {
  font-size: 0.66rem;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

.w-forecast-days {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.w-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.w-day-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0369a1;
}

.w-day-icon {
  font-size: 1.25rem;
}

.w-day-temp {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0c4a6e;
}

.w-day-temp span {
  color: #64748b;
  font-weight: 600;
}

.w-day-rain {
  font-size: 0.65rem;
  color: #3b82f6;
  font-weight: 600;
}

.w-footer {
  padding: 4px 14px 8px;
  display: flex;
  justify-content: flex-end;
}

.w-source {
  font-size: 0.62rem;
  color: #64748b;
}

.w-source a {
  color: #0284c7;
  text-decoration: none;
}

.weather-error {
  flex-shrink: 0 !important;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  font-size: 0.8rem;
  color: #9a3412;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.weather-error-msg {
  line-height: 1.4;
}

.btn-weather-retry {
  padding: 5px 14px;
  background: #ea580c;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease;
}

.btn-weather-retry:hover {
  background: #c2410c;
}

/* Toast thông báo lỗi thời tiết cho Flyout */
.weather-error-toast {
  position: absolute;
  top: 76px;
  right: 472px;
  width: 330px;
  max-width: calc(100vw - 490px);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 25;
  color: #9a3412;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: flyoutSlideLeft 0.2s ease;
}

.weather-error-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-weather-error-close {
  background: transparent;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-weather-error-close:hover {
  background: #ffedd5;
}

