/* ============================================================
   Glance — toi gian
   Khong the, khong vien, khong nen widget, khong gach tieu de
   Chi giu nhung tinh chinh co cong dung thuc te
   ============================================================ */

/* ---------- 1. Widget trong suot hoan toan ---------- */
.widget {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* ---------- 2. Tieu de tron, chi gian chu cho de doc ---------- */
.widget-header {
  letter-spacing: .06em;
}

/* ---------- 3. Weather gon: an dai du bao theo gio ---------- */

/* ---------- 4. Monitor: hang sat hon ---------- */
.widget-type-monitor .monitor-site { padding-block: 3px; }

/* ---------- 5. Hover nhe tren hang dich vu / bookmark ---------- */
.monitor-site,
.bookmarks-group a {
  border-radius: 5px;
  transition: background-color .15s ease;
}
.monitor-site:hover,
.bookmarks-group a:hover {
  background: color-mix(in srgb, var(--color-primary) 9%, transparent);
}

/* ---------- 6. Thumbnail bo goc nhe ---------- */
.thumbnail-parent img,
.video-horizontal-list-thumbnail,
img[class*="thumbnail"] {
  border-radius: 6px;
}

/* ---------- 7. Thanh cuon mong ---------- */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--color-text-base) 25%, transparent) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-text-base) 22%, transparent);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--color-text-base) 38%, transparent); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Widget cap nhat: an dong "tat ca moi nhat" khi co ban can update ---------- */
.wud-list:has(.wud-row) .wud-empty { display: none; }
.wud-row a[href*="wud."]:last-child { white-space: nowrap; }

/* ---------- Clock: gio lon o giua, ngay thang phu ben duoi ---------- */
.widget-type-clock .widget-header { display: none; }
.widget-type-clock [data-local-time] {
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
/* dua khoi gio len tren khoi ngay */
.widget-type-clock [data-local-time] > div:last-child { order: -1; text-align: center; }
.widget-type-clock [data-local-time] > div:first-child { text-align: center; }

.widget-type-clock .clock-time {
  font-size: 3.1rem;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.widget-type-clock [data-weekday] {
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .5;
  margin-top: 2px;
}
.widget-type-clock [data-date] {
  font-size: 1rem;
  font-weight: 400;
  opacity: .85;
  margin-top: 8px;
}
.widget-type-clock [data-year] {
  font-size: .74rem;
  letter-spacing: .12em;
  opacity: .4;
}

/* ---------- Dong ho kim thuan CSS ---------- */
.an-clock { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 0 2px; }

.an-face {
  position: relative;
  width: 148px; height: 148px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--color-text-base) 16%, transparent);
}
/* vach gio nam o lop rieng, mask khong anh huong toi kim */
.an-face::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
      color-mix(in srgb, var(--color-text-base) 32%, transparent) 0deg 0.8deg,
      transparent 0.8deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 0 60px, #000 60px 70px, transparent 70px);
          mask: radial-gradient(circle, transparent 0 60px, #000 60px 70px, transparent 70px);
  pointer-events: none;
}

.an-hand {
  position: absolute;
  left: 50%; bottom: 50%;
  transform-origin: 50% 100%;
  border-radius: 3px;
  animation-name: an-spin;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-delay: var(--an-delay, 0s);
}
.an-hour {
  width: 4.5px; height: 29%;
  background: var(--color-text-base);
  animation-duration: 43200s;
}
.an-min {
  width: 3px; height: 40%;
  background: var(--color-text-base);
  animation-duration: 3600s;
}
.an-sec {
  width: 1.5px; height: 45%;
  background: var(--color-primary);
  animation-duration: 60s;
}
.an-pin {
  position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--color-primary);
}
@keyframes an-spin {
  from { transform: translateX(-50%) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg); }
}
.an-date {
  font-size: .78rem;
  letter-spacing: .1em;
  opacity: .55;
  font-variant-numeric: tabular-nums;
}

/* ---------- Dong ho so kieu nhay so (odometer) ---------- */
.fl-clock {
  display: flex; align-items: center; justify-content: center;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  padding: 6px 0 4px;
}
.fl-unit {
  height: 1.1em;
  line-height: 1.1em;
  overflow: hidden;
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -.01em;
}
.fl-w2 { min-width: 1.25em; text-align: center; }
.fl-sep {
  font-size: 2.1rem; font-weight: 300;
  opacity: .35;
  padding: 0 2px 6px;
  align-self: center;
}
.fl-strip {
  display: flex; flex-direction: column;
  animation-name: fl-roll;
  animation-iteration-count: infinite;
  animation-delay: var(--an-delay, 0s);
}
.fl-strip > div { height: 1.1em; line-height: 1.1em; text-align: center; }
@keyframes fl-roll { from { transform: translateY(0); } to { transform: translateY(-100%); } }

.fl-h   { animation-duration: 86400s; animation-timing-function: steps(24); }
.fl-m10 { animation-duration: 3600s;  animation-timing-function: steps(6);  }
.fl-m1  { animation-duration: 600s;   animation-timing-function: steps(10); }
.fl-s10 { animation-duration: 60s;    animation-timing-function: steps(6);  }
.fl-s1  { animation-duration: 10s;    animation-timing-function: steps(10); color: var(--color-primary); }

/* ---------- Thoi tiet: icon dong theo tinh trang ---------- */
.wx { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.wx-icon { position: relative; width: 62px; height: 62px; flex-shrink: 0; }
.wx-icon > * { position: absolute; display: none; }

.wx-info { min-width: 0; }
.wx-temp { font-size: 2.1rem; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-label { font-size: .95rem; color: var(--color-text-highlight); margin-top: 2px; }
.wx-sub { font-size: .72rem; opacity: .5; margin-top: 3px; }

/* --- mat troi --- */
.wx-sun {
  width: 26px; height: 26px; left: 18px; top: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe08a, #f6b73c 70%);
  box-shadow: 0 0 14px rgba(246,183,60,.55);
  animation: wx-pulse 3.5s ease-in-out infinite;
}
.wx-sun::before {
  content: ""; position: absolute; inset: -11px;
  background:
    repeating-conic-gradient(from 0deg,
      rgba(246,183,60,.85) 0deg 2.2deg, transparent 2.2deg 45deg);
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 0 17px, #000 17px 24px, transparent 24px);
          mask: radial-gradient(circle, transparent 0 17px, #000 17px 24px, transparent 24px);
  animation: wx-rotate 22s linear infinite;
}
@keyframes wx-rotate { to { transform: rotate(360deg); } }
@keyframes wx-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* --- mat trang --- */
.wx-moon {
  width: 24px; height: 24px; left: 20px; top: 16px;
  border-radius: 50%;
  background: #dfe6f5;
  box-shadow: inset -7px 2px 0 0 var(--color-background), 0 0 12px rgba(200,215,255,.4);
  animation: wx-pulse 5s ease-in-out infinite;
}

/* --- may --- */
.wx-cloud {
  width: 40px; height: 15px; left: 11px; top: 28px;
  background: #b9c3d4; border-radius: 12px;
  animation: wx-drift 6s ease-in-out infinite;
}
.wx-cloud::before, .wx-cloud::after {
  content: ""; position: absolute; background: #b9c3d4; border-radius: 50%;
}
.wx-cloud::before { width: 17px; height: 17px; left: 6px; top: -9px; }
.wx-cloud::after  { width: 13px; height: 13px; right: 6px; top: -7px; }
@keyframes wx-drift { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(3px); } }

/* --- mua --- */
.wx-rain { left: 16px; top: 44px; width: 32px; height: 16px; }
.wx-rain i {
  position: absolute; top: 0; width: 2px; height: 8px;
  background: #6fb3e0; border-radius: 2px;
  animation: wx-fall 1.05s linear infinite;
}
.wx-rain i:nth-child(1) { left: 3px;  animation-delay: 0s; }
.wx-rain i:nth-child(2) { left: 14px; animation-delay: .35s; }
.wx-rain i:nth-child(3) { left: 25px; animation-delay: .7s; }
@keyframes wx-fall { 0% { transform: translateY(-3px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(13px); opacity: 0; } }

/* --- tuyet --- */
.wx-snow { left: 16px; top: 44px; width: 32px; height: 16px; }
.wx-snow i {
  position: absolute; top: 0; width: 5px; height: 5px;
  background: #e8f1ff; border-radius: 50%;
  animation: wx-flake 2.4s linear infinite;
}
.wx-snow i:nth-child(1) { left: 3px;  animation-delay: 0s; }
.wx-snow i:nth-child(2) { left: 14px; animation-delay: .8s; }
.wx-snow i:nth-child(3) { left: 25px; animation-delay: 1.6s; }
@keyframes wx-flake { 0% { transform: translate(0,-3px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(3px,14px); opacity: 0; } }

/* --- set --- */
.wx-bolt {
  left: 27px; top: 43px; width: 11px; height: 18px;
  background: #ffd257;
  clip-path: polygon(58% 0, 12% 58%, 45% 58%, 32% 100%, 88% 40%, 52% 40%);
  animation: wx-flash 2.6s steps(1) infinite;
}
@keyframes wx-flash { 0%,72%,100% { opacity: .25; } 76%,84% { opacity: 1; } 80% { opacity: .3; } }

/* --- suong mu --- */
.wx-fog { left: 11px; top: 34px; width: 42px; height: 18px; }
.wx-fog i {
  position: absolute; height: 4px; border-radius: 3px;
  background: #aab6c8; opacity: .8;
}
.wx-fog i:nth-child(1) { top: 0;  left: 0;  width: 40px; animation: wx-slide 4.5s ease-in-out infinite; }
.wx-fog i:nth-child(2) { top: 10px; left: 6px; width: 30px; animation: wx-slide 4.5s ease-in-out infinite reverse; }
@keyframes wx-slide { 0%,100% { transform: translateX(-4px); } 50% { transform: translateX(5px); } }

/* --- hien phan tu theo tinh trang --- */
.wx-clear   .wx-sun,
.wx-partly  .wx-sun,
.wx-partly  .wx-cloud,
.wx-cloudy  .wx-cloud,
.wx-fog     .wx-fog,
.wx-rain    .wx-cloud, .wx-rain .wx-rain,
.wx-snow    .wx-cloud, .wx-snow .wx-snow,
.wx-thunder .wx-cloud, .wx-thunder .wx-bolt { display: block; }

/* ban dem: thay mat troi bang mat trang */
.wx-night.wx-clear  .wx-sun,
.wx-night.wx-partly .wx-sun { display: none; }
.wx-night.wx-clear  .wx-moon,
.wx-night.wx-partly .wx-moon { display: block; }

/* may cua trang thai partly lech sang de lo mat troi */
.wx-partly .wx-cloud { left: 16px; top: 34px; width: 36px; }

/* ---------- An widget helper cua anh nen Bing ---------- */
.widget:has(.bing-bg) { display: none; }

  94% { background-color: color-mix(in srgb, #e3ecff 13%, var(--color-background)); }
  95% { background-color: var(--color-background); }
  96% { background-color: color-mix(in srgb, #e3ecff 8%, var(--color-background)); }
}

/* ---------- Tai nguyen NUC: vong tron thay thanh ngang ---------- */
.widget-type-server-stats .progress-bar {
  background: none !important;
  height: auto !important;
  display: flex; justify-content: center;
  margin-top: 9px;
}
/* CPU co 2 lop, chi lay lop dau lam vong tron */
.widget-type-server-stats .progress-bar-combined .progress-value:nth-child(2) { display: none; }

.widget-type-server-stats .progress-value {
  position: relative !important;
  width: 54px !important; height: 54px !important;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary) calc(var(--percent) * 1%),
    color-mix(in srgb, var(--color-text-base) 13%, transparent) 0) !important;
  -webkit-mask: radial-gradient(circle, transparent 0 19px, #000 19px);
          mask: radial-gradient(circle, transparent 0 19px, #000 19px);
  animation: gauge-in .85s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes gauge-in {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: none;      opacity: 1; }
}

/* ---------- iframe radar: bo goc ---------- */
.widget-type-iframe iframe {
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--color-text-base) 10%, transparent);
}

/* ---------- GitHub noi bat ---------- */
.gh-avatar { width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0; }
.gh-row { border-radius: 6px; transition: background-color .15s ease; }
.gh-row:hover { background: color-mix(in srgb, var(--color-primary) 9%, transparent); }
.gh-stars { color: #f0b429; white-space: nowrap; }

/* ---------- Sparkline gia ---------- */
.spark-wrap { margin: 2px 0 4px; }
.spark { width: 100%; height: 34px; display: block; }
.spark polyline { animation: spark-draw 1.4s ease-out both; stroke-dasharray: 400; }
@keyframes spark-draw { from { stroke-dashoffset: 400; } to { stroke-dashoffset: 0; } }
.spark-cap { opacity: .45; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Icon thi truong ---------- */
.mk-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%;
  object-fit: contain;
}
.mk-flag {
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
  background: color-mix(in srgb, var(--color-text-base) 8%, transparent);
}

/* ---------- Ca the dich vu deu bam duoc ---------- */
.widget-type-monitor .monitor-site { position: relative; }
.widget-type-monitor .monitor-site > div > a::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 6px;
}
.widget-type-monitor .monitor-site:hover { cursor: pointer; }

/* ---------- Bookmarks tu Linkding ---------- */
.bm-row { border-radius: 6px; padding: 2px 4px; transition: background-color .15s ease; text-decoration: none; }
.bm-row:hover { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.bm-icon { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }

/* ---------- Bookmarks nhom theo tag (gap/mo thuan CSS) ---------- */
.bmt-toggle { position: absolute; opacity: 0; pointer-events: none; }
.bmt-group { border-radius: 6px; }
.bmt-head {
  cursor: pointer;
  padding: 6px 6px;
  border-radius: 6px;
  transition: background-color .15s ease;
  user-select: none;
}
.bmt-head:hover { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.bmt-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  background-color: var(--color-text-base);
  -webkit-mask: var(--ic) center / contain no-repeat;
          mask: var(--ic) center / contain no-repeat;
  opacity: .8;
}
.bmt-count {
  opacity: .45;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.bmt-arrow {
  display: inline-block;
  opacity: .4;
  transform: rotate(90deg);
  transition: transform .25s;
  flex-shrink: 0;
}
.bmt-toggle:checked + .bmt-group .bmt-arrow { transform: rotate(-90deg); }

.bmt-items { display: none; padding: 2px 0 6px 26px; }
.bmt-toggle:checked + .bmt-group .bmt-items { display: block; }
.bmt-toggle:checked + .bmt-group .bmt-items .bm-row {
  animation: collapsibleItemReveal .25s backwards;
}
.bmt-items .bm-row { padding: 3px 4px; font-size: .84rem; }

/* ---------- Luoi truy cap nhanh ---------- */
.applist {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.app {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 11px 3px;
  border-radius: 10px;
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}
.app:hover { background: color-mix(in srgb, var(--color-primary) 11%, transparent); transform: translateY(-1px); }
.app img { width: 36px; height: 36px; object-fit: contain; }
.app span {
  font-size: .74rem;
  opacity: .7;
  text-align: center;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app:hover span { opacity: .95; }
/* ---------- Nut xem them: khop 100% voi nut goc cua Glance ---------- */
.more-toggle { position: absolute; opacity: 0; pointer-events: none; }

.gh-list .gh-row:nth-child(n+4) { display: none; }
.more-toggle:checked ~ .gh-list .gh-row:nth-child(n+4) {
  display: flex;
  animation: collapsibleItemReveal .25s backwards;
}

.more-btn {
  font: inherit;
  border: 0;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
  color: var(--color-text-base);
  text-transform: uppercase;
  font-size: var(--font-size-h4);
  padding: var(--widget-content-vertical-padding) 0;
  background-color: var(--color-background);
  margin-top: .5rem;
  text-decoration: none;
}

/* chu truoc */
.more-btn::before { content: "Show more"; }
.more-toggle:checked ~ .more-btn::before { content: "Show less"; }

/* icon sau: dung dung ky tu \e0b1 va thong so cua Glance */
.more-btn::after {
  content: "\e0b1";
  display: inline-block;
  margin-left: 1rem;
  position: relative;
  top: -.2rem;
  font-size: .8rem;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform .3s;
}
.more-toggle:checked ~ .more-btn::after { transform: rotate(-90deg); }

/* nut Bookmarks la link mo Linkding, giu kieu nhung doi nhan va icon */
a.more-btn::before { content: "Mở Linkding"; }
a.more-btn::after { content: "97"; transform: none; font-size: .9rem; top: 0; }

/* ---------- Video: tai dan 5 cai moi lan ---------- */
/* chan nut goc cua Glance de khong bi hai nut */
.widget-type-videos .expand-toggle-button { display: none !important; }
.vmore input { position: absolute; opacity: 0; pointer-events: none; }
.vmore .vb { display: none; }
.vmore .vb1 { display: block; }

/* mac dinh chi 5 video */
.widget-type-videos .cards-grid > .card:nth-child(n+6) { display: none; }

/* moi lan bam mo them 5 */
.page-column:has(#vm1:checked) .widget-type-videos .cards-grid > .card:nth-child(-n+10),
.page-column:has(#vm2:checked) .widget-type-videos .cards-grid > .card:nth-child(-n+15),
.page-column:has(#vm3:checked) .widget-type-videos .cards-grid > .card:nth-child(-n+20),
.page-column:has(#vm4:checked) .widget-type-videos .cards-grid > .card:nth-child(-n+25),
.page-column:has(#vm5:checked) .widget-type-videos .cards-grid > .card {
  display: flex;
  animation: collapsibleItemReveal .25s backwards;
}

/* nut ke tiep hien ra, nut cu an di */
#vm1:checked ~ .vb1 { display: none; }
#vm1:checked ~ .vb2 { display: block; }
#vm2:checked ~ .vb2 { display: none; }
#vm2:checked ~ .vb3 { display: block; }
#vm3:checked ~ .vb3 { display: none; }
#vm3:checked ~ .vb4 { display: block; }
#vm4:checked ~ .vb4 { display: none; }
#vm4:checked ~ .vb5 { display: block; }
#vm5:checked ~ .vb5 { display: none; }

/* widget nut khong can khung/tieu de rieng */
.widget:has(.vmore) .widget-header { display: none; }
.widget:has(.vmore) { margin-top: -6px; }
