/* ============================================================
   Profile dashboard — glass panels on dark
   ============================================================ */

c-profile-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(240px, 2fr) minmax(0, 5fr);
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding: 14px;
}

/* Shared glass panel look */
c-profile-page .header,
c-profile-page .left-aside,
c-profile-page .right-aside,
c-profile-page .footer,
c-profile-page .attributes .infos {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(var(--panel-blur));
  backdrop-filter: blur(var(--panel-blur));
}

c-profile-page {
  & .header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-color);

    a {
      text-decoration: none;
      color: inherit;
      cursor: pointer;
      font-weight: 600;
    }

    a:first-child {
      font-size: 1.15rem;
      background: linear-gradient(100deg, #7c9cff, #9d7cff, #56d6e0, #7c9cff);
      background-size: 250% auto;
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      letter-spacing: -0.01em;
      animation: logoShimmer 3.5s linear infinite;
    }

    a.logout {
      padding: 0.45rem 1rem;
      border: 1px solid var(--panel-border);
      border-radius: 999px;
      font-size: 0.9rem;
      transition: background 0.2s, border-color 0.2s;
    }

    a.logout:hover {
      background: var(--panel-bg-strong);
      border-color: var(--first-color);
    }
  }

  & .footer {
    grid-column: 1 / -1;
    grid-row: 4;
    padding: 0.9rem;
    color: var(--text-muted);
    font-size: var(--small-font-size);
  }

  /* ---------- Left column: level + technologies ---------- */
  & .left-aside {
    grid-column: 1;
    grid-row: 2 / 4;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 16px;
    padding: 1.25rem;

    & .level {
      position: relative;
      color: var(--text-color);
      padding: 0.5rem;
      display: flex;
      flex-direction: column;
      justify-content: center;

      level-chart {
        display: block;
        position: relative;
        height: 220px;
        width: 100%;
      }
    }

    & .user_infos {
      text-align: center;
      margin-top: 1rem;

      & .user-name {
        font-size: 1.15rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        color: var(--text-color);
      }

      & .user-handle {
        margin-top: 0.2rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--first-color);
      }
    }

    & .technologies {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      padding: 1rem;
      border-radius: var(--radius-sm);
      background: rgba(255, 255, 255, 0.04);

      h3 {
        margin: 0 0 0.5rem;
        font-size: 0.95rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
      }

      progress-bar {
        display: block;
        width: 100%;
      }
    }
  }

  /* ---------- Attributes: stat cards ---------- */
  & .attributes {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    align-content: start;
    gap: 14px;

    & .infos {
      color: var(--text-color);
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 0.3rem;
      padding: 1rem 0.75rem;
      transition: transform 0.2s, border-color 0.2s;

      &:hover {
        transform: translateY(-3px);
        border-color: var(--first-color);
        box-shadow: 0 14px 34px -14px rgba(124, 156, 255, 0.45);
      }

      & .name {
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted);
      }

      & .value {
        font-size: 1.75rem;
        font-weight: 700;
        background: var(--accent-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        overflow-wrap: anywhere;
      }
    }
  }

  /* ---------- Right column: nav + chart ---------- */
  & .right-aside {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    padding: 1.25rem;
    min-height: 420px;

    & .navigation {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 0.75rem;

      button {
        padding: 0.75rem 1.25rem;
        border: 1px solid var(--panel-border);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-muted);
        font-size: 0.9rem;
        font-weight: 600;
        white-space: nowrap;
        cursor: pointer;
        transition: color 0.2s, background 0.2s, border-color 0.2s,
                    transform 0.15s, box-shadow 0.2s;
      }

      button:hover {
        color: var(--text-color);
        background: rgba(124, 156, 255, 0.08);
        border-color: var(--first-color);
        transform: translateY(-1px);
      }

      button.active {
        color: #0b1020;
        background-image: var(--accent-gradient);
        border-color: transparent;
        box-shadow: 0 8px 22px -8px rgba(124, 156, 255, 0.65);
      }

      button.active:hover {
        color: #0b1020;
        filter: brightness(1.05);
      }
    }

    & .graph-container {
      flex: 1;
      min-width: 0;
      min-height: 320px;
      position: relative;
    }
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  c-profile-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  c-profile-page > * {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  c-profile-page .right-aside {
    flex-direction: column;
  }

  c-profile-page .right-aside .navigation {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  c-profile-page .right-aside .navigation button {
    flex: 1;
    min-width: 140px;
  }
}

@media (max-width: 520px) {
  c-profile-page {
    padding: 10px;
    gap: 10px;
  }

  c-profile-page .attributes {
    grid-template-columns: 1fr 1fr;
  }

  c-profile-page .attributes .infos .value {
    font-size: 1.5rem;
  }

  c-profile-page .right-aside {
    min-height: 300px;
  }
}

/* ---------- Entrance animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(42px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes logoShimmer {
  to { background-position: 250% center; }
}

c-profile-page > section {
  animation: fadeInUp 0.7s cubic-bezier(.16, 1, .3, 1) backwards;
}
c-profile-page > section:nth-child(1) { animation-delay: 0.00s; }
c-profile-page > section:nth-child(2) { animation-delay: 0.12s; }
c-profile-page > section:nth-child(3) { animation-delay: 0.24s; }
c-profile-page > section:nth-child(4) { animation-delay: 0.36s; }
c-profile-page > section:nth-child(5) { animation-delay: 0.48s; }

c-profile-page .attributes .infos {
  animation: fadeInUp 0.7s cubic-bezier(.16, 1, .3, 1) backwards;
}
c-profile-page .attributes .infos:nth-child(1) { animation-delay: 0.30s; }
c-profile-page .attributes .infos:nth-child(2) { animation-delay: 0.42s; }
c-profile-page .attributes .infos:nth-child(3) { animation-delay: 0.54s; }
c-profile-page .attributes .infos:nth-child(4) { animation-delay: 0.66s; }

@media (prefers-reduced-motion: reduce) {
  c-profile-page > section,
  c-profile-page .attributes .infos {
    animation: none;
  }
  c-profile-page .header a:first-child {
    animation: none;
  }
}
