/* ==========================================================================
   Lịch Pháp Lý — lich-phap-ly.css
   All selectors are prefixed with .lpl- to avoid conflicts with any theme.
   ========================================================================== */

/* ---------- Legal Tool Tab Icons (.lt-tab-icon) ---------- */
.lt-tab-icon {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 6px;
  animation: ltIconFadeIn 0.3s ease forwards;
}

@keyframes ltIconFadeIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Trigger Button ---------- */
.lpl-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: linear-gradient(135deg, #1d6fa4 0%, #0e4d77 100%);
  color: #fff;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  box-shadow: 0 4px 14px rgba(14, 77, 119, 0.3);
}

.lpl-trigger-btn:hover {
  background: linear-gradient(135deg, #2380b8 0%, #1a6099 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 77, 119, 0.38);
}

.lpl-trigger-btn:active {
  transform: translateY(0);
}

.lpl-btn-icon {
  flex-shrink: 0;
}

/* ---------- Overlay ---------- */
.lpl-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(10, 20, 40, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: lplFadeIn 0.22s ease forwards;
}

.lpl-overlay[hidden] {
  display: none !important;
}

@keyframes lplFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Main Modal ---------- */
.lpl-modal {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 660px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 36px 32px 28px;
  animation: lplSlideUp 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  scrollbar-width: thin;
  scrollbar-color: #c5d8e8 transparent;
}

.lpl-modal::-webkit-scrollbar {
  width: 5px;
}

.lpl-modal::-webkit-scrollbar-thumb {
  background: #c5d8e8;
  border-radius: 3px;
}

@keyframes lplSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Close Button ---------- */
.lpl-close-btn {
  margin: 0;
  padding: 0;
  position: absolute;
  top: 10px;
  right: 6px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.15s;
  z-index: 1;
  min-height: auto;
}

.lpl-close-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: rotate(90deg);
}

.lpl-close-btn svg {
  overflow: visible;
}

/* ---------- Loader ---------- */
.lpl-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  z-index: 5;
}

.lpl-loader[hidden] {
  display: none !important;
}

.lpl-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #1d6fa4;
  border-radius: 50%;
  animation: lplSpin 0.7s linear infinite;
}

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

/* ---------- Calendar Header ---------- */
.lpl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.lpl-title-block {
  text-align: center;
  line-height: 1.2;
}

.lpl-month-label {
  display: block;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 1.5px;
}

.lpl-year-label {
  display: block;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: #1d6fa4;
  letter-spacing: 1px;
}

/* Nav buttons */
.lpl-nav-btn {
  margin: 0;
  min-height: auto;
  padding: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #1d6fa4;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.16s,
    transform 0.16s,
    box-shadow 0.16s;
  box-shadow: 0 2px 8px rgba(29, 111, 164, 0.3);
}

.lpl-nav-btn:hover:not(:disabled) {
  background: #0e4d77;
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(29, 111, 164, 0.38);
}

.lpl-nav-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Calendar Grid ---------- */
.lpl-grid-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.lpl-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: "Inter", "Segoe UI", sans-serif;
}

.lpl-grid thead th {
  padding: 10px 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #475569;
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
}

.lpl-grid thead th.lpl-col-sat {
  background: #f0f6fc;
  color: #475569;
}

.lpl-grid thead th.lpl-col-sun {
  color: #e53e3e;
  background: #fff5f5;
}

/* Day cells */
.lpl-day-cell {
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.14s;
  border: 1px solid #f1f5f9;
  position: relative;
}

.lpl-day-cell:hover:not(.lpl-empty) {
  background: #f0f6fc;
}

.lpl-day-cell.lpl-empty {
  cursor: default;
  background: transparent;
}

.lpl-day-cell.lpl-col-sat {
  background: #f7fbff;
}

.lpl-day-cell.lpl-col-sun .lpl-day-num {
  color: #e53e3e;
}

.lpl-day-cell.lpl-col-sat:hover,
.lpl-day-cell.lpl-col-sun:hover {
  background: #edf4fb;
}

/* Day numbers */
.lpl-day-num {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #334155;
  border-radius: 50%;
  transition:
    background 0.14s,
    color 0.14s;
}

.lpl-day-cell:hover:not(.lpl-empty) .lpl-day-num {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Event circles */
.lpl-day-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.lpl-day-circle:hover,
.lpl-day-cell:hover .lpl-day-circle {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lpl-circle-red {
  background: #e53e3e;
}

.lpl-circle-blue {
  background: #2b7de9;
}

/* Sun column + event circle */
.lpl-col-sun .lpl-day-num {
  color: #e53e3e;
}

/* ---------- Legend ---------- */
.lpl-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.lpl-legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.875rem;
  color: #334155;
}

.lpl-legend-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ---------- Download Button ---------- */
.lpl-download-wrap {
  text-align: center;
  margin-bottom: 14px;
}

.lpl-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 28px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition:
    transform 0.16s,
    box-shadow 0.16s,
    background 0.16s;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.32);
}

.lpl-download-btn:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
  color: #fff;
  text-decoration: none;
}

/* ---------- Footer Note ---------- */
.lpl-footer-note {
  font-size: 0.77rem;
  color: #94a3b8;
  text-align: center;
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
}

/* ---------- No-data message ---------- */
.lpl-no-data {
  text-align: center;
  color: #64748b;
  font-style: italic;
  padding: 24px 0;
  font-family: "Inter", "Segoe UI", sans-serif;
}

/* ==========================================================================
   Day-detail Sub-popup
   ========================================================================== */
.lpl-day-overlay {
  position: fixed;
  inset: 0;
  z-index: 99995;
  background: rgba(10, 20, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
  animation: lplFadeIn 0.18s ease forwards;
}

.lpl-day-overlay[hidden] {
  display: none !important;
}

.lpl-day-modal {
  position: relative;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px 26px 22px;
  animation: lplSlideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lpl-day-close {
  margin: 0;
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition:
    background 0.14s,
    color 0.14s,
    transform 0.14s;
}

.lpl-day-close:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: rotate(90deg);
}

.lpl-day-close svg {
  overflow: visible;
}

/* Day detail content */
.lpl-day-content {
  font-family: "Inter", "Segoe UI", sans-serif;
}

.lpl-day-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.lpl-day-circle-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.lpl-day-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}

.lpl-day-body {
  font-size: 0.875rem;
  color: #334155;
  white-space: pre-line;
  line-height: 1.7;
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  word-break: break-word;
}

.lpl-day-empty {
  text-align: center;
  color: #64748b;
  font-style: italic;
  padding: 16px 0 8px;
  font-size: 0.9rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 520px) {
  .lpl-close-btn {
    top: 6px;
    width: 26px;
    height: 26px;
  }
  .lpl-close-btn svg {
    width: 18px;
    height: 18px;
  }
  .lpl-modal {
    padding: 28px 16px 22px;
    border-radius: 12px;
  }

  .lpl-month-label,
  .lpl-year-label {
    font-size: 1.2rem;
  }

  .lpl-nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }

  .lpl-day-num,
  .lpl-day-circle {
    width: 26px;
    height: 26px;
    line-height: 26px;
    font-size: 0.78rem;
  }

  .lpl-grid thead th {
    font-size: 0.68rem;
    padding: 7px 0;
  }

  .lpl-day-cell {
    padding: 5px 2px;
  }

  .lpl-day-modal {
    padding: 22px 16px 18px;
  }
}
