@layer reset, base, theme, components;

@layer reset {
  html,
  body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }

  h1,
  h2,
  h3,
  h4,
  p,
  ul {
    margin: 0;
    padding: 0;
  }

  ul {
    list-style: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  button {
    font: inherit;
  }
}

@layer theme {
  :root {
    --bg-deep: #050a18;
    --primary: #3a5aff;
    --accent-cyan: #05fddd;
    --green-online: #22c55e;
    --text-white: #ffffff;
    --shadow-pin: 0 4px 12px rgb(0 0 0 / 0.35);
  }
}

@layer base {
  html {
    background-color: #ffffff;
    color-scheme: light;
  }

  html,
  body {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #0f172a;
    background-color: #ffffff;
    -webkit-font-smoothing: antialiased;
  }

  body {
    display: flow-root;
  }

  button,
  input,
  select,
  textarea {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }
}

@layer components {
  /* Sticky Top Header */
  header.default.heade-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 600;
    min-height: 56px;
    padding: env(safe-area-inset-top) 20px 0;
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 15px;
    background: rgb(4 4 71);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  header.default .un-item-logo .logo-img {
    width: 85px;
    height: auto;
    object-fit: contain;
    display: block;
  }

  .header-back-btn {
    display: inline-flex;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    color: #ffffff;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
  }

  header.default .un-block-right {
    display: flex;
    align-items: center;
    flex-direction: row;
    column-gap: 10px;
    position: absolute;
    right: 0;
    padding-right: 20px;
  }

  header.default .un-block-right .un-notification {
    position: relative;
  }

  header.default .un-block-right .un-notification a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 20px;
    color: #ffffff;
  }

  header.default .un-block-right .un-notification .bull-activity {
    display: block;
    width: 5px;
    height: 5px;
    background-color: #05fddd;
    border-radius: 30px;
    position: absolute;
    top: 0;
    right: 0;
  }

  header.default .un-block-right .un-user-profile a {
    display: block;
  }

  header.default .un-block-right .un-user-profile .img-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  /* Shared Section Title Row */
  .section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-block-end: 12px;
  }

  .section-row h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
  }

  /* Shared 2-Tier Activity / List Cards */
  .activity-list {
    display: grid;
    gap: 10px;
  }

  .activity-row {
    position: relative;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 11px 12px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  }

  .activity-left {
    display: contents;
  }

  .activity-left .act-ico {
    inline-size: 40px;
    block-size: 40px;
    border-radius: 12px;
    background: #eef2ff;
    overflow: clip;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 19px;
    color: #0c4cd5;
  }

  .activity-left .act-ico img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    display: block;
  }

  .activity-left .act-text {
    min-inline-size: 0;
  }

  .activity-left .act-text strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 88px;
  }

  .activity-left .act-text small {
    display: block;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.5;
  }

  .activity-val {
    position: absolute;
    top: 11px;
    right: 12px;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: end;
    color: #0c4cd5;
  }

  .perf-meta-line {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #e7ebef;
    font-size: 13px;
    color: #64748b;
  }

  .perf-meta-line span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* Bottom Navigation */
  .un-bottom-navigation {
    position: fixed;
    inset: auto 0 0 0;
    padding: 8px 18px 10px;
    z-index: 600;
    pointer-events: none;
    background-color: transparent;
  }

  html.is-safari .un-bottom-navigation {
    padding-bottom: 4px;
    background-color: #ffffff;
  }

  .un-bottom-navigation::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 112px;
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.72) 48%,
      rgba(255, 255, 255, 0.96) 82%,
      #ffffff 100%
    );
    pointer-events: none;
    z-index: 0;
  }

  .un-bottom-navigation::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100px;
    height: 100px;
    background-color: #ffffff;
    pointer-events: none;
  }

  .un-bottom-navigation .em_body_navigation {
    pointer-events: auto;
    position: relative;
    z-index: 1;
    inline-size: 100%;
    max-inline-size: 444px;
    margin-inline: auto;
    min-height: 60px;
    padding: 6px 15px;
    border-radius: 999px;
    background: #040447;
    border: 1px solid #040447;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .un-bottom-navigation .item_link {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .un-bottom-navigation .btn_navLink {
    position: relative;
    width: auto;
    min-width: 52px;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #0c4cd5;
    font-size: 21px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.78;
    transition: opacity 0.2s ease;
  }

  .un-bottom-navigation .btn_navLink .nav-label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.15;
    color: #a5a5a5;
    white-space: nowrap;
  }

  .un-bottom-navigation .btn_navLink.active .nav-label {
    font-weight: 600;
    color: #02fddd;
  }

  .un-bottom-navigation .btn_navLink i {
    background: linear-gradient(135deg, #ffffff 42%, #05fddd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .un-bottom-navigation .btn_navLink.active i {
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: #02fddd;
    color: #02fddd;
  }

  .un-bottom-navigation .btn_navLink .icon_active {
    display: none;
  }

  .un-bottom-navigation .btn_navLink.active {
    color: #02fddd;
    opacity: 1;
  }

  .un-bottom-navigation .btn_navLink.active .icon_current {
    display: none;
  }

  .un-bottom-navigation .btn_navLink.active .icon_active {
    display: block;
  }

  /* Footer Location Submenu */
  .footer-location-submenu {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 590;
    display: flex;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .footer-location-submenu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .footer-location-submenu-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 20px;
    background: rgba(13, 22, 48, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  }

  .footer-location-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
  }

  /* Custom Calendar Popover (border-radius: 20px) */
  .catch-date-wrap {
    cursor: pointer;
  }

  .catch-date-wrap input[type="date"] {
    pointer-events: none !important;
  }

  .prahu-cal-popover {
    position: fixed;
    z-index: 900;
    width: 282px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    display: none;
    flex-direction: column;
    gap: 10px;
  }

  .prahu-cal-popover.is-open {
    display: flex;
  }

  .prahu-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .prahu-cal-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
  }

  .prahu-cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .prahu-cal-nav button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .prahu-cal-nav button:hover {
    background: #e2e8f0;
  }

  .prahu-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
  }

  .prahu-cal-dow {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    padding-bottom: 4px;
  }

  .prahu-cal-day {
    height: 32px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font-size: 12.5px;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .prahu-cal-day:hover {
    background: #eff6ff;
    color: #0c4cd5;
  }

  .prahu-cal-day.is-muted {
    color: #cbd5e1;
  }

  .prahu-cal-day.is-today {
    border-color: #93c5fd;
    color: #0c4cd5;
  }

  .prahu-cal-day.is-selected {
    background: #0c4cd5;
    border-color: #0c4cd5;
    color: #ffffff;
    font-weight: 600;
  }

  .prahu-cal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
  }

  .prahu-cal-foot button {
    border: 0;
    background: transparent;
    font-size: 12.5px;
    font-weight: 600;
    color: #0c4cd5;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
  }

  .prahu-cal-foot button:hover {
    background: #eff6ff;
  }

  /* Animated SVG Line Drawing Logo */
  .prahu-logo-anim {
    overflow: visible;
  }

  .prahu-logo-anim .ta-draw-shape {
    fill-opacity: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: var(--len, 300);
    stroke-dashoffset: var(--len, 300);
  }

  .prahu-logo-anim .ta-draw-icon {
    fill: #05fddd;
    stroke: #05fddd;
    stroke-width: 1.05;
  }

  .prahu-logo-anim .ta-draw-word {
    fill: #f9f9f9;
    stroke: #f9f9f9;
    stroke-width: 0.72;
  }

  .prahu-logo-anim.is-drawing .ta-draw-icon {
    animation:
      prahu-line-draw 1.4s cubic-bezier(0.35, 0, 0.2, 1) var(--draw-delay, 0s) forwards,
      prahu-fill-in 0.55s ease calc(var(--draw-delay, 0s) + 1.05s) forwards;
  }

  .prahu-logo-anim.is-drawing .ta-draw-word {
    animation:
      prahu-line-draw 1.9s cubic-bezier(0.35, 0, 0.2, 1) var(--draw-delay, 0.35s) forwards,
      prahu-fill-in 0.6s ease calc(var(--draw-delay, 0.35s) + 1.45s) forwards;
  }

  @keyframes prahu-line-draw {
    to {
      stroke-dashoffset: 0;
    }
  }

  @keyframes prahu-fill-in {
    from {
      fill-opacity: 0;
    }
    to {
      fill-opacity: 1;
    }
  }

  /* Global Modal Scroll Lock */
  html:has([role="dialog"][aria-modal="true"]:not([hidden]):not(.sos-modal-backdrop)),
  html:has(.sos-modal-backdrop.is-open),
  body:has([role="dialog"][aria-modal="true"]:not([hidden]):not(.sos-modal-backdrop)),
  body:has(.sos-modal-backdrop.is-open) {
    overflow: hidden;
    overscroll-behavior: none;
  }

  [role="dialog"][aria-modal="true"] {
    overscroll-behavior: contain;
    touch-action: none;
  }

  [role="dialog"][aria-modal="true"] > :not([class*="backdrop"]) {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  /* PWA Offline / Online Status Pill */
  .prahu-net-pill {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 50%;
    transform: translate(-50%, -140%);
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(4, 4, 71, 0.94);
    color: #ffffff;
    border: 1px solid rgba(5, 253, 221, 0.35);
    box-shadow: 0 10px 26px rgba(4, 4, 71, 0.32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
  }

  .prahu-net-pill.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
  }

  .prahu-net-pill__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
  }

  .prahu-net-pill.is-online .prahu-net-pill__dot {
    background: #05fddd;
    box-shadow: 0 0 0 3px rgba(5, 253, 221, 0.25);
  }
}
