:root {
  --main: #003c47;
  --bg: #fdfdfd;
}

.container-fengshui-calendar {
  display: flex;
  max-width: 1200px;
  margin: auto;
  width: 100%;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.side-info {
  flex: 0 0 280px;
  background: var(--main);
  color: white;
  padding: 40px 20px;
  text-align: center;
  border-right: 4px solid #00252c;
}

.side-info h1 {
  font-size: 100px;
  margin: 0;
  font-weight: 900;
}

.lunar-box {
  background: rgba(0, 0, 0, 0.1);
  padding: 20px;
  border-radius: 12px;
  margin-top: 20px;
  font-size: 24px;
  font-weight: 700;
}

.main-content {
  flex: 1;
  padding: 25px;
  background: var(--bg);
}

.header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8d7da;
  padding: 10px 20px;
  border-radius: 8px 8px 0 0;
  border: 1px solid #f5c6cb;
}

.header-action span {
  font-weight: bold;
  color: #721c24;
}

.header-action .header-picker {
  position: relative;
}

.picker-btn {
  background: #fff;
  border: 1px solid #ced4da;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
}

.picker-dropdown {
  display: none;
  background: white;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: absolute;
  z-index: 100;
  margin-top: 5px;
  right: 25px;
}

.picker-dropdown-box {
  display: flex;
  gap: 0.5rem;
}

.btn-view {
  background: var(--main);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
}

.full-detail-section {
  background: white;
  border: 1px solid #eee;
  border-radius: 0 0 10px 10px;
  padding: 20px;
  margin-bottom: 25px;
  border-top: none;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.detail-list li {
  margin-bottom: 10px;
  border-bottom: 1px dashed #eee;
  padding-bottom: 8px;
  font-size: 15px;
}

.detail-list b {
  color: #333;
  width: 140px;
  display: inline-block;
}

.detail-list .gio-hoang-dao {
  color: #2e7d32;
  font-weight: 600;
}

.time-item {
  display: inline-block;
  margin-right: 4px;
}

.highlight {
  color: #d32f2f;
  font-weight: bold;
}

.nav-calendar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.nav-calendar-btn {
  text-decoration: none;
  color: var(--main);
  font-weight: bold;
  border: none;
  background: transparent;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid #eee;
  border-left: 1px solid #eee;
}

.head {
  text-align: center;
  padding: 12px;
  font-weight: 700;
  background: #f8f9fa;
  font-size: 12px;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.cell {
  min-height: 95px;
  padding: 10px;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: #333;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: 0.2s;
}

.cell:hover {
  background: #fffde7;
}

.cell.today {
  background: #ffbebe;
}

.cell.today::after {
  content: "Hôm nay";
  position: absolute;
  top: 21px;
  right: 5px;
  font-size: 12px;
  color: var(--main);
  font-weight: bold;
  opacity: 0.7;
}

.cell.active {
  background: #fff5f5 !important;
  outline: 3px solid var(--main);
  outline-offset: -3px;
  z-index: 5;
  box-shadow: 0 0 10px rgba(198, 40, 40, 0.2);
}

.cell.active .solar {
  color: var(--main);
  font-size: 24px;
}

.solar {
  font-size: 20px;
  font-weight: 700;
}

.lunar-container {
  margin-top: auto;
  text-align: right;
}

.lunar-num {
  font-size: 12px;
  font-weight: bold;
}

.canchi-cell {
  font-size: 10px;
  color: #999;
  display: block;
}

.side-info {
  flex: 0 0 300px;
  /* Tăng nhẹ độ rộng */
  background: linear-gradient(180deg, #003c47 0%, #002b33 100%);
  color: white;
  padding: 30px 15px !important;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Khối Dương lịch tập trung */
.side-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 20px;
}

.year-month {
  font-size: 14px;
  letter-spacing: 2px;
  opacity: 0.8;
  font-weight: 600;
}

.solar-day {
  font-size: 90px;
  font-weight: 900;
  line-height: 1;
  margin: 5px 0;
  color: #fff;
}

.lunar-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lunar-card .lunar-title {
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 15px;
}

.lunar-main {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 5px;
}

.lunar-canchi {
  font-size: 14px;
  color: #ffeb3b;
  font-weight: 600;
  text-transform: uppercase;
}

.info-grid {
  text-align: left;
  background: rgba(0, 0, 0, 0.1);
  padding: 15px;
  border-radius: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.info-item:last-child {
  border: none;
}

.info-item .label {
  opacity: 0.7;
  font-weight: 300;
}

.info-item .val {
  font-weight: 600;
  text-align: right;
  color: #fff;
}

.action-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-item {
  padding: 10px;
  border-radius: 8px;
  font-size: 11px;
  text-align: left;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.05);
}

.action-item.positive strong {
  color: #2ecc71;
}

.action-item.negative strong {
  color: #ef9a9a;
}

.side-footer {
  margin-top: auto;
  text-align: left;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.num-circle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.num-circle .num-title {
  font-size: 12px;
  font-weight: 600;
}

.num-val {
  background: #ffeb3b;
  color: #003c47;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 900;
}

.event-desc {
  font-size: 12px;
  line-height: 1.5;
  font-style: italic;
  opacity: 0.9;
}
.quote-desc {
  margin-top: 15px;
  font-size: 12px;
}
.quote-desc strong {
  color: #ffeb3b;
}
.quote-desc .footer-content {
  line-height: 1.4;
  margin-top: 5px;
  font-style: italic;
  font-weight: 600;
}
.lucky-hours {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  text-align: left;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.lucky-hours .hours-title {
  font-size: 12px;
  text-transform: uppercase;
  color: #ffeb3b;
  margin-bottom: 8px;
  font-weight: bold;
  letter-spacing: 1px;
}

.hours-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hour-tag {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.star-info {
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 10px;
}

.star-info .star-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #ffeb3b;
  margin-bottom: 8px;
  font-weight: bold;
}

.star-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
}

.star-desc {
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.8;
}

.travel-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.travel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 8px;
  text-align: left;
}

.travel-icon {
  font-size: 20px;
}

.travel-txt strong {
  display: block;
  font-size: 13px;
  color: #ffeb3b;
}

.travel-txt small {
  font-size: 11px;
  opacity: 0.7;
}

.numerology-extended {
  margin-top: auto;
  padding-top: 15px;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.num-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.num-circle-v2 {
  background: #ffeb3b;
  color: #003c47;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.num-header span {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
}

.num-detail {
  font-size: 12px;
  line-height: 1.6;
  font-style: italic;
  opacity: 0.9;
  margin: 0;
}
@media (max-width: 1024px) {
  .container-fengshui-calendar {
    flex-direction: column; /* Xếp chồng side-info và main-content */
  }

  .side-info {
    flex: 0 0 auto;
    width: 100%;
    padding: 20px 15px !important;
    border-right: none;
    border-bottom: 4px solid #00252c;
  }

  .main-content {
    padding: 15px;
  }

  .solar-day {
    font-size: 70px; /* Giảm kích thước ngày dương lịch */
  }

  .lunar-main {
    font-size: 24px;
  }

  .grid {
    grid-template-columns: repeat(7, 1fr); /* Giữ grid nhưng cell nhỏ hơn */
  }

  .cell {
    min-height: 70px;
    padding: 5px;
  }

  .solar {
    font-size: 16px;
  }

  .lunar-num {
    font-size: 10px;
  }

  .canchi-cell {
    font-size: 8px;
  }

  .detail-list li {
    font-size: 13px;
  }

  .detail-list b {
    width: 120px;
  }

  .picker-dropdown {
    right: 0;
    left: 0;
    margin: 5px auto;
    width: fit-content;
  }

  .picker-dropdown-box {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .side-info {
    padding: 15px 10px !important;
  }

  .solar-day {
    font-size: 50px;
  }

  .lunar-main {
    font-size: 20px;
  }

  .lunar-canchi {
    font-size: 12px;
  }

  .info-item {
    font-size: 12px;
  }

  .action-item {
    font-size: 10px;
  }

  .hour-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  .star-name {
    font-size: 14px;
  }

  .star-desc {
    font-size: 11px;
  }

  .num-val {
    width: 25px;
    height: 25px;
    font-size: 14px;
  }

  .event-desc {
    font-size: 11px;
  }

  .header-action {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .picker-btn {
    font-size: 12px;
  }

  .btn-view {
    padding: 6px 12px;
  }

  .nav-calendar h2 {
    font-size: 14px;
  }

  .head {
    font-size: 10px;
    padding: 8px;
  }

  .cell {
    min-height: 50px;
    padding: 5px;
  }
  .cell.active .solar {
    font-size: 14px !important;
  }
  .cell.today::after {
    top: 2.5rem;
    right: 1.5rem;
  }

  .lunar-num {
    font-size: 9px;
  }

  .canchi-cell {
    font-size: 7px;
  }

  .full-detail-section {
    padding: 15px;
  }

  .detail-list li {
    font-size: 12px;
  }

  .detail-list b {
    width: auto;
    display: block;
    margin-bottom: 5px;
  }
  .nav-calendar-btn {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(7, minmax(30px, 1fr)); /* Tối ưu cho màn nhỏ */
  }

  .cell {
    min-height: 40px;
    padding: 3px;
  }

  .solar {
    font-size: 12px;
  }

  .lunar-num {
    font-size: 8px;
  }

  .canchi-cell {
    display: none; /* Ẩn can chi nếu màn quá nhỏ */
  }

  .side-info {
    gap: 15px;
  }

  .action-box {
    grid-template-columns: 1fr;
  }

  .hours-list {
    gap: 4px;
  }

  .picker-dropdown-box {
    flex-direction: column;
    gap: 10px;
  }

  .picker-dropdown {
    padding: 10px;
  }
}

/* Polished layout overrides */
.container-fengshui-calendar {
  --lunar-primary: #b91c1c;
  --lunar-primary-dark: #7f1d1d;
  --lunar-gold: #facc15;
  --lunar-ink: #172033;
  --lunar-muted: #64748b;
  --lunar-border: #e5e7eb;
  --lunar-soft: #fff7f7;
  --lunar-radius-xl: 24px;
  --lunar-radius-lg: 16px;
  --lunar-shadow: 0 18px 48px rgba(17, 24, 39, 0.1);

  max-width: 1320px;
  margin: 10rem auto 4rem;
  border: 1px solid rgba(185, 28, 28, 0.12);
  border-radius: var(--lunar-radius-xl);
  box-shadow: var(--lunar-shadow);

  * {
    box-sizing: border-box;
  }

  .side-info {
    flex: 0 0 330px;
    gap: 16px;
    padding: 26px 18px !important;
    border-right: 0;
    background: radial-gradient(circle at top left, rgba(250, 204, 21, 0.18), transparent 26%), linear-gradient(180deg, var(--lunar-primary), var(--lunar-primary-dark));
  }

  .side-header {
    padding-bottom: 16px;
  }

  .solar-day {
    font-size: clamp(6rem, 7vw, 9rem);
  }

  .lunar-card,
  .info-grid,
  .lucky-hours,
  .star-info,
  .action-item {
    border-radius: var(--lunar-radius-lg);
  }

  .lunar-card {
    padding: 18px 14px;
  }

  .lunar-main {
    font-size: clamp(2.4rem, 3vw, 3.4rem);
  }

  .info-grid {
    padding: 12px 14px;
  }

  .info-item {
    gap: 12px;
  }

  .action-box {
    gap: 8px;
  }

  .action-item {
    min-height: 94px;
    padding: 12px;
  }

  .main-content {
    min-width: 0;
    padding: clamp(18px, 3vw, 30px);
    background: #f8fafc;
  }

  .header-action {
    gap: 14px;
    padding: 14px 16px;
    border-color: rgba(185, 28, 28, 0.14);
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, #fff, var(--lunar-soft));
  }

  .header-lunar {
    color: var(--lunar-primary-dark);
    font-size: 1.45rem;
    letter-spacing: 0.02em;
  }

  .picker-btn,
  .nav-calendar-btn,
  .btn-view {
    min-height: 38px;
    border-radius: 999px;
    font-weight: 800;

    svg {
      flex-shrink: 0;
    }
  }

  .picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-color: rgba(185, 28, 28, 0.18);
    color: var(--lunar-primary-dark);
  }

  .picker-dropdown {
    right: 0;
    min-width: 330px;
    padding: 12px;
    border: 1px solid var(--lunar-border);
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(17, 24, 39, 0.14);
  }

  .picker-dropdown-box {
    align-items: center;

    select {
      min-height: 38px;
      padding: 0 10px;
      border: 1px solid var(--lunar-border);
      border-radius: 10px;
      color: var(--lunar-ink);
      outline: 0;
    }
  }

  .btn-view {
    padding: 8px 16px;
    background: var(--lunar-primary);
  }

  .full-detail-section {
    border-color: rgba(185, 28, 28, 0.12);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.04);
  }

  .detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;

    li {
      display: grid;
      grid-template-columns: 112px minmax(0, 1fr);
      gap: 8px;
      align-items: start;
      min-height: 42px;
      margin: 0;
      padding: 9px 0;
    }

    b {
      width: auto;
      color: var(--lunar-ink);
    }
  }

  .nav-calendar {
    gap: 14px;
    margin: 22px 0 14px;

    .month-title {
      color: var(--lunar-ink);
      font-size: clamp(1.8rem, 2.4vw, 2.6rem);
      font-weight: 900;
      text-align: center;
      margin: 0;
    }
  }

  .nav-calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--lunar-primary);
    background: #fff;
    border: 1px solid rgba(185, 28, 28, 0.14);
    cursor: pointer;
  }

  .grid {
    overflow: hidden;
    border: 1px solid var(--lunar-border);
    border-radius: 18px;
    background: #fff;
  }

  .head {
    padding: 11px 8px;
    color: var(--lunar-muted);
    background: #f8fafc;
  }

  .cell {
    min-height: 104px;
    padding: 10px;
    background: #fff;
  }

  .cell.today {
    background: #fff1f2;
  }

  .cell.today::after {
    top: 10px;
    right: 8px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff;
    font-size: 1rem;
  }

  .cell.active {
    outline: 0;
    background: #fff7ed !important;
    box-shadow: inset 0 0 0 3px var(--lunar-primary);
  }
}

@media (max-width: 1180px) {
  .container-fengshui-calendar {
    margin: 4rem 12px 3rem;
    flex-direction: column;

    .side-info {
      width: 100%;
      flex-basis: auto;
      border-bottom: 0;
    }

    .side-info {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      align-items: stretch;
    }

    .side-header,
    .lunar-card {
      min-height: 178px;
    }

    .side-footer {
      margin-top: 0;
      grid-column: 1 / -1;
    }
  }
}

@media (max-width: 820px) {
  .container-fengshui-calendar {
    margin: 6rem 0 3rem;
    border-radius: 20px;

    .side-info {
      grid-template-columns: 1fr;
    }

    .side-header,
    .lunar-card {
      min-height: auto;
    }

    .header-action {
      align-items: stretch;
    }

    .header-lunar {
      text-align: center;
    }

    .picker-btn {
      justify-content: center;
    }

    .picker-dropdown {
      left: 50%;
      right: auto;
      width: min(92vw, 340px);
      min-width: 0;
      transform: translateX(-50%);
    }

    .detail-list {
      grid-template-columns: 1fr;
    }

    .nav-calendar {
      display: grid;
      grid-template-columns: 1fr;

      .month-title {
        order: -1;
      }
    }

    .nav-calendar-btn {
      justify-content: center;
    }

    .grid {
      min-width: 640px;
    }

    .main-content {
      overflow-x: auto;
    }
  }
}

@media (max-width: 520px) {
  .container-fengshui-calendar {
    .main-content {
      padding: 14px;
    }

    .action-box {
      grid-template-columns: 1fr;
    }

    .picker-dropdown-box {
      flex-direction: column;

      select,
      .btn-view {
        width: 100%;
      }
    }

    .grid {
      min-width: 560px;
    }

    .cell {
      min-height: 76px;
    }
  }
}

/* Calendar correction: keep the original spacious month-table feel */
.container-fengshui-calendar {
  .main-content {
    overflow-x: visible;
  }

  .nav-calendar {
    display: flex;
    grid-template-columns: unset;
    align-items: center;
    justify-content: space-between;
  }

  .grid {
    min-width: 0;
    width: 100%;
  }

  .cell {
    min-height: 118px;
    padding: 14px 10px;
  }

  .solar {
    font-size: 2.1rem;
    line-height: 1;
  }

  .lunar-container {
    margin-top: auto;
  }

  .lunar-num {
    font-size: 1.25rem;
  }

  .canchi-cell {
    margin-top: 4px;
    font-size: 1rem;
  }

  .cell.active .solar {
    font-size: 2.4rem;
  }

  .cell.today::after {
    top: 25%;
    right: 8px;
    transform: translateY(-50%);
  }
}

@media (max-width: 820px) {
  .container-fengshui-calendar {
    .nav-calendar {
      display: flex;
      gap: 10px;

      .month-title {
        order: 0;
      }
    }

    .grid {
      min-width: 0;
    }

    .cell {
      min-height: 92px;
      padding: 10px 7px;
    }

    .solar {
      font-size: 1.7rem;
    }

    .cell.active .solar {
      font-size: 1.9rem !important;
    }

    .lunar-num {
      font-size: 1.05rem;
    }

    .canchi-cell {
      font-size: 0.9rem;
    }
  }
}

@media (max-width: 560px) {
  .container-fengshui-calendar {
    .nav-calendar {
      display: grid;
      grid-template-columns: 1fr 1fr;

      .month-title {
        grid-column: 1 / -1;
        order: -1;
      }
    }

    .head {
      padding: 9px 4px;
      font-size: 1rem;
    }

    .cell {
      min-height: 74px;
      padding: 7px 4px;
    }

    .solar {
      font-size: 1.35rem;
    }

    .cell.active .solar {
      font-size: 1.5rem !important;
    }

    .lunar-num {
      font-size: 0.9rem;
    }

    .canchi-cell {
      display: none;
    }

    .cell.today::after {
      top: 30%;
      right: 4px;
      transform: none;
      padding: 1px 4px;
      font-size: 0.8rem;
    }
  }
}
