/****************/
/* MAIN SECTION */
/****************/
main {
  display: grid;
  grid-template-columns: 20.8rem 1fr;
}

/***************/
/* MAIN SCREEN */
/***************/
.main {
  padding: 3.2rem;
  width: 100%;
  min-width: 0;
}

.page-content {
  width: 100%;
  min-width: 0;
  grid-column: 2;
}

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotate-border {
  to {
    --angle: 360deg;
  }
}

.box {
  position: relative;
  height: fit-content;
  padding: 2.4rem;
  /* border: 2px solid white; */

  /* Chamfered corners shape */
  /* --corner-size: 20px;
  clip-path: polygon(
    var(--corner-size) 0%,
    calc(100% - var(--corner-size)) 0%,
    100% var(--corner-size),
    100% calc(100% - var(--corner-size)),
    calc(100% - var(--corner-size)) 100%,
    var(--corner-size) 100%,
    0% calc(100% - var(--corner-size)),
    0% var(--corner-size)
  ); */

  background-color: rgba(134, 142, 150, 0.1);
  box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, 0.5);
  /* filter: drop-shadow(0 1.2rem 2.4rem rgba(0, 0, 0, 0.5)); */
  /* backdrop-filter: blur(2px); Warning: Expensive performance cost */
}

/* Remove generic .box::before */

/* Common neon border base styles - Applied to both ::before (sharp) and ::after (subtle glow) */
.my-devices-box::before,
.my-devices-box::after,
.my-nfts-box::before,
.my-nfts-box::after,
.my-finances-box::before,
.my-finances-box::after,
.popular-nft-box::before,
.popular-nft-box::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 3px;

  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;

  /* Optimization */
  will-change: transform; /* Using @property technically animates paint, but transform helps layer promotion */
  transform: translateZ(0);
}

.my-devices-box::before,
.my-nfts-box::before,
.my-finances-box::before,
.popular-nft-box::before {
  z-index: 2; /* Sharp line on top */
}

/* Glow Layer */
.my-devices-box::after,
.my-nfts-box::after,
.my-finances-box::after,
.popular-nft-box::after {
  z-index: 1; /* Glow behind */
  filter: blur(5px); /* The glow effect */
  opacity: 1;
  /* Optimization */
  transform: translateZ(0);
}

/* Specific Neon: My Devices (Cyan, 4s) */
.my-devices-box::before,
.my-devices-box::after {
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 20%,
    rgba(0, 242, 255, 0.5) 40%,
    #00f2ff 50%,
    transparent 50%,
    transparent 70%,
    rgba(0, 242, 255, 0.5) 90%,
    #00f2ff 100%
  );
  /* animation: rotate-border 15s linear infinite; */
  animation: rotate-border 60s linear infinite;
}

/* Specific Neon: My NFTs (Purple/Pink, 6s) */
.my-nfts-box::before,
.my-nfts-box::after {
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 20%,
    rgba(255, 0, 204, 0.5) 40%,
    #ec26c5 50%,
    transparent 50%,
    transparent 70%,
    rgba(255, 0, 204, 0.5) 90%,
    #ec26c5 100%
  );
  /* animation: rotate-border 20s linear infinite; */
  /* animation: rotate-border 65s linear infinite; */
  animation: rotate-border 60s linear infinite;
}

/* Specific Neon: My Finances (Yellow, 18s) */
.my-finances-box::before,
.my-finances-box::after {
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 20%,
    rgba(255, 217, 0, 0.5) 40%,
    #ffd900 50%,
    transparent 50%,
    transparent 70%,
    rgba(255, 217, 0, 0.5) 90%,
    #ffd900 100%
  );
  /* animation: rotate-border 18s linear infinite; */
  /* animation: rotate-border 70s linear infinite; */
  animation: rotate-border 60s linear infinite;
}

.main .nft-name {
  color: inherit;
}

/***************/
/* MY DEVICES */
/***************/
.my-devices-box {
  grid-column: 1 / 3;
}

.main-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 3.2rem;
  /* backdrop-filter: blur(12px); */
}

.btn {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.1s;
  /* Optimization */
  transform: translateZ(0);
  will-change: color;
}

.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  transition: all 0.1s;
}

.btn p {
  font-size: 1.8rem;
}

.btn:link,
.btn:visited {
  text-decoration: none;
  color: inherit;
}

.btn:hover {
  color: #b71597;
}
.btn:hover .icon-btn {
  background-color: #b71597;
  border-radius: 50px;
  color: #fff;
}

/*************************************************************/
/* Definiujemy kształt naszego ścięcia jako zmienną CSS, aby łatwo go użyć w obu elementach */
:root {
  --clip-path: polygon(
    0% 25px,
    /* Górny lewy róg - początek */ 25px 0%,
    /* Górny lewy róg - koniec */ calc(100% - 25px) 0%,
    /* Górny prawy róg - początek */ 100% 25px,
    /* Górny prawy róg - koniec */ 100% calc(100% - 25px),
    /* Dolny prawy róg - początek */ calc(100% - 25px) 100%,
    /* Dolny prawy róg - koniec */ 25px 100%,
    /* Dolny lewy róg - początek */ 0% calc(100% - 25px)
      /* Dolny lewy róg - koniec */
  );
}

/* Zewnętrzny element - nasze "obramowanie" */
/* .clipped-border {
  background-color: #000000;
  clip-path: var(--clip-path);
  padding: 3px;
} */

/* Wewnętrzny element - tło i treść */
/* .content {
  background-color: #ffffff;
  padding: 30px;
  clip-path: var(--clip-path);
} */
/*************************************************************/

.all-devices {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.device {
  display: grid;
  grid-template-columns: 3fr 0.5fr 2fr;
  gap: 1.4rem;
  background: rgba(255, 255, 255, 0.05); /* Glassmorphism subtle background */
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  align-items: center;
}

.device:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.device-name {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: default;
  min-width: 0;
}

.nft-name {
  color: #ddd;
  font-size: 1.6rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nft-type {
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.8;
}

.device-preview {
  display: flex;
  justify-content: center;
}

.device-preview .nft-img {
  height: 6.4rem;
  width: 6.4rem;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.device-description {
  height: 6.4rem; /* Match image height for better alignment */
  overflow-y: auto;
  font-size: 1.1rem;
  cursor: default;
  color: #bbb;
  padding-right: 0.4rem;
}

.more-btn {
  margin-top: 3.2rem;
  font-size: 1.4rem;
  cursor: pointer;

  display: flex;
  justify-content: center;
}

.more-btn a:link,
.more-btn a:visited,
.more-btn a:active {
  text-decoration: none;
  color: inherit;
}

.more-btn a:hover {
  text-decoration: underline;
}

/***********/
/* MY NFTs */
/***********/
.my-nfts-box {
  cursor: default;
  grid-column: 3 / 6;
}

.all-collecion {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 1.6rem;
  column-gap: 3.2rem;
  justify-content: space-between;
}

.set {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.05); /* Glassmorphism subtle background */
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.set:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.set img {
  width: 6.4rem;
  height: 6.4rem;
  object-fit: contain;
  margin-right: 1.6rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.name-cat-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  margin-right: auto;
  min-width: 0;
}

.name-cat-box .nft-name {
  font-size: 1.6rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ddd;
}

.name-cat-box .nft-class-pai,
.name-cat-box .nft-class-fig,
.name-cat-box .nft-class-sc {
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.8;
}

.action-box {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.action-box .btn {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem 1.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.action-box .btn p {
  font-size: 1.4rem;
  font-weight: 500;
}

.action-box .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.arrow-left,
.arrow-right {
  width: 1.8rem;
  flex-shrink: 0;
}

.arrow-right {
  transform: scaleX(-1);
}

/*****************/
/* MY FINANCES */
/*****************/
.my-finances-box {
  grid-column: 1 / 4; /* Occupy cols 1, 2, 3 as requested */
  /* If the parent grid has 5 columns, 1/4 means spanning 3 columns width.
     Columns: [1] [2] [3] [4] [5]
     Occupying 1, 2, 3 leaves 4, 5 for others (or empty).
  */
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  /* min-height: 50rem; Reduced by ~40% */
  min-height: 30rem;
  height: 100%;
}

.my-finances-box .sub-header-text {
  font-size: 0.6em;
  opacity: 0.7;
  font-weight: 400;
  margin-left: 0.5rem;
}

.finances-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto; /* Top row, Bottom row */
  gap: 1.6rem;
  height: 100%;
}

.finance-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  /* Glassmorphism subtle */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

/* Card Positioning */
.finances-grid .portfolio-card {
  grid-column: span 6;
}
.finances-grid .profit-loss-card {
  grid-column: span 6;
}
.finances-grid .earnings-card {
  grid-column: span 3;
}
.finances-grid .history-card {
  grid-column: span 6;
}
.finances-grid .allocation-card {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
}

/* Typography & Headers */
.card.p-price {
  font-size: 1.4rem;
  font-weight: 600;
  color: #40c057;
  margin-bottom: 0.4rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.card-title {
  font-size: 1.6rem;
  font-weight: 500;
  color: #ddd;
  margin-bottom: 0.4rem;
}
.card-value {
  font-size: 2rem;
  color: #40c057; /* Green */
  font-weight: 600;
}
.sub-text {
  font-size: 1rem;
  color: #aaa;
}
.green-text,
.pos {
  color: #40c057;
}
.net-value {
  font-size: 1.4rem;
  color: #40c057;
}

/* Time Selector */
.time-selector {
  display: flex;
  gap: 0.8rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem;
  border-radius: 8px;
}
.time-selector span {
  font-size: 1rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
}
.time-selector span.active {
  background: #555;
  color: white;
}

/* Charts Generic */
.chart-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  min-height: 12rem;
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}
.chart-labels span {
  font-size: 1rem;
  color: inherit;
}

/* Line Chart Mock */
.line-chart-placeholder {
  /* Using SVG in HTML */
  position: relative;
}
.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Bar Chart Mock */
.bar-group {
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* Align bars to bottom -> Wait, negative values? */
  align-items: center; /* Center to allow up/down */
  height: 100%;
  gap: 0.8rem;
  position: relative;
}
/* We need a zero line */
.bar-group::before {
  content: "";
  position: absolute;
  top: 60%; /* Approximate zero line */
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 0;
}
.bar {
  flex: 1;
  background: #40c057;
  border-radius: 2px;
  z-index: 1;
  position: relative;
}
.bar.positive {
  background: linear-gradient(to top, #40c057, #69db7c);
  margin-bottom: 2rem; /* Lift up to sit on zero line if we assume flex-end? No, easier to fake it */
  transform: translateY(-20%); /* Shift up */
}
.bar.negative {
  background: linear-gradient(to bottom, #fa5252, #ff8787);
  transform: translateY(30%); /* Shift down */
}

/* Donut Chart */
.pie-layout {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  height: 100%;
}

.earnings-card .pie-layout {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 1.2rem;
}
.donut-chart {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: conic-gradient(#4dabf7 0% 40%, #b197fc 40% 75%, #e599f7 75% 100%);
  position: relative;
  /* Make it a donut */
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-chart::after {
  content: "";
  position: absolute;
  width: 60%;
  height: 60%;
  background: #2a2c33; /* Match card bg roughly or transparent? */
  background: radial-gradient(
    circle,
    rgba(40, 40, 50, 1) 0%,
    rgba(30, 30, 40, 1) 100%
  );
  border-radius: 50%;
}

.legend {
  list-style: none;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  display: block;
}
.c1 {
  background: #4dabf7;
}
.c2 {
  background: #b197fc;
}
.c3 {
  background: #e599f7;
}

.perc {
  margin-left: 0.8rem;
}

/* History Table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.2rem;
}
.history-table th {
  text-align: left;
  color: #888;
  font-weight: 400;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.history-table td {
  padding: 0.6rem 0.8rem 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.history-table .pos {
  color: #40c057;
}
.history-table .neg {
  color: #fa5252;
}

/* Pie Chart (Asset Allocation) */
.pie-chart {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: conic-gradient(#4dabf7 0% 30%, #b197fc 30% 100%);
}
.pie-layout.simple {
  justify-content: center;
  position: relative;
}
.pie-labels {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.p-label {
  position: absolute;
  font-size: 1.2rem;
  color: white;
  text-shadow: 0 1px 2px black;
}
.l1 {
  top: 48%;
  left: 10%;
}
.l2 {
  top: 32%;
  right: -12%;
}

/*******************/
/* POPULAR NFTs */
/*******************/
.popular-nft-box {
  grid-column: 4 / 5;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.popular-nft-box .sub-header-text {
  font-size: 1rem;
  opacity: 0.7;
  font-weight: 400;
  margin-left: 0.5rem;
  /* display: block; */
  /* text-align: right; */
}

.popular-list {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  margin-top: 1.6rem;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popular-item:last-child {
  border-bottom: none;
}

.rank {
  font-size: 1.6rem;
  font-weight: 600;
  color: #888;
  width: 2.4rem;
  text-align: center;
  flex-shrink: 0;
}

.item-icon {
  width: 3.2rem;
  height: 3.2rem;
  color: #ddd;
  flex-shrink: 0;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-right: auto; /* Push price to right */
  min-width: 0; /* Crucial for text-overflow to work in flex child */
}

.p-name {
  font-size: 1.4rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-type {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-price {
  font-size: 1.6rem;
  color: #40c057;
  font-weight: 600;
  flex-shrink: 0;
}

/* Specific Neon: Popular NFTs (Cyan/Teal, 25s) */
.popular-nft-box::before,
.popular-nft-box::after {
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 20%,
    rgba(0, 255, 213, 0.5) 40%,
    #00ffd5 50%,
    transparent 50%,
    transparent 70%,
    rgba(0, 255, 213, 0.5) 90%,
    #00ffd5 100%
  );
  animation: rotate-border 25s linear infinite;
}

/*******************/
/* SOCIALS SPACE */
/*******************/
.socials-box {
  grid-column: 5 / 6;
  display: flex;
  flex-direction: column;
  height: 100%;
  /* No neon effect, but keeping the box style */
  background: rgba(134, 142, 150, 0.1); /* Same as others */
  border: 1px solid rgba(255, 255, 255, 0.1);
  /* border-radius: 20px; Removed as requested */
}

.socials-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1.6rem;
  flex: 1; /* Take available space */
}

.social-card {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.social-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.user-profile {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.avatar {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.av-1 {
  background-image: radial-gradient(circle, #ff00cc, #333);
} /* Mock avatar */
.av-2 {
  background-image: url("https://i.pravatar.cc/150?u=a042581f4e29026704d");
}
.av-3 {
  background-image: url("https://i.pravatar.cc/150?u=a042581f4e29026704e");
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.verified {
  color: #1da1f2;
  font-size: 1.2rem;
}

.user-handle {
  font-size: 1rem;
  color: #aaa;
}

.menu-icon {
  font-size: 1.4rem;
  color: #aaa;
  cursor: pointer;
}

.social-text {
  font-size: 1rem;
  line-height: 1.4;
  color: #ddd;
}

.social-actions {
  display: flex;
  gap: 1.6rem;
  margin-top: 0.4rem;
}

.action-icon {
  font-size: 1.4rem;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
}

.action-icon:hover {
  color: white;
}

.liked {
  color: #e0245e;
}

.social-dots {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: auto; /* Push to bottom */
  padding-top: 1rem;
}

.s-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.s-dot.active {
  background-color: white;
}

/* 1. Smaller Desktops */
@media (max-width: 84em) {
  .my-finances-box {
    grid-column: 1 / -1;
  }

  .popular-nft-box {
    grid-column: 1 / 4;
  }

  .socials-box {
    grid-column: 4 / 6;
  }

  .finances-grid .earnings-card,
  .finances-grid .allocation-card {
    grid-column: span 6;
  }

  .finances-grid .history-card {
    grid-column: span 12;
    order: 10;
  }

  /* My Devices vs My NFTs equal height -> use height 100% and grow child */
  .my-devices-box {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .all-devices {
    flex: 1; /* allow growing */
    /* justify-content: space-between; REMOVED: do not add extra space between items */
  }

  /* Make device items taller instead of spacing them out */
  .device {
    flex: 1; /* allow each item to expand */
    grid-template-columns: auto 1fr; /* Image left, text right */
    align-items: flex-start; /* Start from top */
  }

  .device-name {
    grid-column: 1 / -1; /* Title takes full width */
    margin-bottom: 0.8rem;
  }

  .device-description {
    display: block;
    height: auto;
  }

  /* My NFTs adjustments */
  .set {
    flex-wrap: wrap;
  }

  .action-box {
    width: 100%;
    margin-top: 0.8rem;
    justify-content: flex-start;
  }
}

/* 2. Landscape Tablets */
@media (max-width: 75em) {
  .my-devices-box,
  .my-nfts-box {
    grid-column: 1 / -1;
    height: auto;
  }

  .all-collecion {
    column-gap: 1.6rem;
  }

  .main {
    padding: 2.4rem;
  }

  .device-description {
    font-size: 1.2rem;
  }

  /* Buttons in My NFTs */
  .set {
    flex-wrap: nowrap;
    align-items: flex-start; /* move buttons back to flex-row alongside */
  }

  .action-box {
    flex-direction: column; /* but stack them vertically */
    width: auto;
    margin-top: 0;
    margin-left: auto; /* push to the right */
  }
}

/* 3. Tablets */
@media (max-width: 59em) {
  main {
    grid-template-columns: 1fr;
  }

  .popular-nft-box,
  .socials-box {
    grid-column: 1 / -1;
  }

  .finances-grid .portfolio-card,
  .finances-grid .profit-loss-card {
    grid-column: span 12;
  }

  .chart-container {
    min-height: 20rem;
  }
}

/* 4. Smaller Tablets */
@media (max-width: 44em) {
  .all-collecion {
    grid-template-columns: 1fr;
  }

  .device {
    /* grid-template-columns: auto 1fr; CHANGED BACK TO 3 COLS */
    grid-template-columns: 3fr 1fr 2fr; /* Give space for description */
    gap: 1rem; /* 1rem gap */
    align-items: center; /* Center items on this step */
  }

  .device-name {
    margin-bottom: 0; /* Clear previous margin */
    grid-column: auto; /* Revert grid span */
  }

  .device-preview {
    justify-content: flex-start; /* Removed center justification */
  }

  .device-description {
    display: block; /* Keep descriptions visible */
  }

  .box {
    padding: 1.6rem;
  }

  .main {
    padding: 1.6rem;
  }

  .set {
    flex-wrap: nowrap; /* keep them in row */
    align-items: center; /* center vertically again */
  }

  .action-box {
    flex-direction: row; /* stack back to horizontal row */
    width: auto;
    margin-top: 0;
  }
  .chart-container {
    min-height: 16rem;
  }
}

/* 5. Phones */
@media (max-width: 34em) {
  .main {
    padding: 1.2rem;
  }

  .page-content,
  .all-devices,
  .device,
  .all-collecion,
  .my-finances-box,
  .finances-grid,
  .popular-list,
  .socials-list,
  .social-actions {
    gap: 1.2rem;
  }

  .device {
    grid-template-columns: auto 1fr; /* Fallback to 2 cols for phones */
    align-items: flex-start; /* Items to top again */
  }

  .finances-grid .earnings-card,
  .finances-grid .allocation-card {
    grid-column: span 12;
  }

  .social-card {
    padding: 1.2rem;
  }

  .card-value {
    font-size: 1.8rem;
  }

  .chart-container {
    min-height: 16rem;
  }

  .device-name {
    grid-column: 1 / -1;
    margin-bottom: 0.4rem;
  }

  .device-name .nft-name {
    font-size: 1.6rem;
  }

  .device-name .nft-type {
    font-size: 1.4rem;
  }

  .device-description {
    display: block;
    height: auto;
  }

  .set {
    flex-wrap: wrap; /* move actions below title block */
  }

  .action-box {
    flex-direction: column; /* change buttons stack direction vertically */
    width: 100%;
    margin-top: 0.8rem;
    align-items: stretch;
  }

  .action-box .btn {
    justify-content: center;
  }

  .allocation-card .pie-layout.simple {
    flex-direction: row; /* Flex row structure */
    display: flex; /* Ensure it is a flex container */
    align-items: center;
    justify-content: space-around; /* Distribute items */
  }

  .allocation-card .pie-labels {
    position: static;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center labels vertically */
    gap: 0.8rem;
    width: auto; /* Revert width 100% to let flex align them beside chart */
    text-align: left; /* Text alignment cleanup */
  }

  .allocation-card .p-label {
    position: static;
    color: #ddd;
    text-shadow: none;
  }
}

/* =========================================================
   DASHBOARD BOXES - LIVE DATA (JS/home.js, JS/finance.js)
   ========================================================= */
a.device {
  color: inherit;
  text-decoration: none;
}
.device.is-empty .device-description {
  color: #777;
}
.device-preview-empty {
  width: 6.4rem;
  height: 6.4rem;
  border: 2px dashed #444;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 2.8rem;
}
.nft-type-empty {
  color: #777;
}
.set.is-new {
  border-color: rgba(255, 217, 0, 0.5);
}
.home-nfts-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 2.4rem;
  color: #888;
  font-size: 1.4rem;
}
.home-nfts-empty ion-icon {
  font-size: 3.6rem;
}
.home-nfts-empty a {
  color: #ffd900;
}
.profit-loss-card .bar {
  transition: height 0.8s ease;
}
