/* ═══════════════════════════════════════════════════
   Main Page Styles — Vanilla CSS (replaces Tailwind)
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────── */
:root {
  --body-bg: #04012B;
  --owner-text-color: #ffffff;
  --card-bg: #B7B7C4;
  --card-text: #04012B;
  --card-hover-bg: #B7B7C4;
  --card-hover-bg-mobile: rgba(183, 183, 196, 0.6);
}

/* ── Reset & Base ──────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  background-color: var(--body-bg);
  color: var(--owner-text-color);
  transition: background-color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

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

img {
  display: block;
  max-width: 100%;
}

/* ── Utility: Hidden ───────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Loader ────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
  background-color: #04012B;
  color: #fff;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.spinner-track {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.spinner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

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

.loader-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 3px;
  color: #B7B7C4;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ── App Container ─────────────────────────────── */
.app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Desktop Header ────────────────────────────── */
.desktop-header {
  display: none;
}

@media (min-width: 768px) {
  .desktop-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding-top: 64px;
  }
}

.profile-avatar {
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Desktop avatar */
.desktop-header .profile-avatar {
  width: 96px;
  height: 96px;
}

.desktop-header .info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.owner-name {
  font-size: 24px;
  font-weight: 700;
  text-transform: capitalize;
  line-height: 1.5;
}

.page-title {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  line-height: normal;
  padding: 0 80px;
}

/* ── Mobile Header ─────────────────────────────── */
.mobile-header {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
}

@media (min-width: 768px) {
  .mobile-header {
    display: none;
  }
}

.mobile-header-top {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding-top: 32px;
  padding-left: 20px;
  padding-right: 20px;
}

.mobile-header .profile-avatar {
  width: 48px;
  height: 48px;
}

.mobile-header .info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(100% - 64px);
}

.mobile-header .owner-name {
  font-size: 20px;
}

@media (min-width: 350px) {
  .mobile-header .owner-name {
    font-size: 20px;
  }
}

.mobile-header .page-title-wrap {
  margin-top: 12px;
  width: 100%;
}

.mobile-header .page-title {
  font-size: 12px;
  text-align: start;
  padding: 0 20px;
}

/* ── Cards Grid ────────────────────────────────── */
.cards-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 20px 0;
  gap: 16px;
  width: 100%;
  justify-content: center;
  align-items: start;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .cards-grid {
    margin: 32px 0;
    gap: 20px;
  }
}

/* ── Card Item ─────────────────────────────────── */
.card-item {
  background-color: var(--card-bg);
  color: var(--card-text);
  box-shadow: 0px 2px 4px 0px rgba(10, 11, 13, 0.08);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  width: 100%;
  height: 80px;
  cursor: pointer;
  transition: all 150ms ease-in-out;
}

@media (min-width: 768px) {
  .card-item {
    width: calc(50% - 10px);
    height: 100px;
  }

  .card-item:hover {
    background-color: var(--card-hover-bg) !important;
    transform: scale(1.03);
  }
}

@media (min-width: 1024px) {
  .card-item {
    width: calc(33.33% - 15px);
  }
}

@media (min-width: 1200px) {
  .card-item {
    width: calc(25% - 15px);
  }
}

/* Mobile hover */
@media (max-width: 767px) {
  .card-item:hover {
    background-color: var(--card-hover-bg-mobile) !important;
  }
}

.card-link {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.card-thumb {
  width: 50px;
  height: 50px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 16px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.1);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-title-text {
  font-size: var(--card-title-font-size);
  font-weight: var(--card-title-font-weight);
  font-family: var(--card-title-font-family);
  padding: 0 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.card-title-full {
  width: 100%;
}

/* ── Description Overlay ───────────────────────── */
.description-toggle {
  position: absolute;
  bottom: 8px;
  right: 4px;
  cursor: pointer;
  z-index: 20;
  display: block;
}

@media (min-width: 768px) {
  .description-toggle {
    display: none;
  }

  .card-item:hover .description-toggle {
    display: block;
  }
}

.description-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  z-index: 10;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.5s ease-in-out;
}

.description-overlay.show {
  transform: translateY(0);
}

@media (min-width: 768px) {

  .description-toggle:hover+.description-overlay,
  .description-overlay:hover {
    transform: translateY(0);
  }
}

.description-content {
  padding: 8px 0 8px 20px;
  font-size: 14px;
  color: var(--card-text);
}

.description-content .desc-label {
  font-size: 18px;
  font-weight: 500;
}

.description-content .desc-text {
  font-size: var(--card-desc-font-size);
  font-weight: var(--card-desc-font-weight);
  font-family: var(--card-desc-font-family);
}

/* ── Scrollbar ─────────────────────────────────── */
.description-overlay::-webkit-scrollbar {
  width: 3px;
}

.description-overlay::-webkit-scrollbar-track {
  background: transparent;
}

.description-overlay::-webkit-scrollbar-thumb {
  background: var(--card-text);
  border-radius: 10px;
}

/* ── Error State ───────────────────────────────── */
.error-state {
  text-align: center;
  color: #fc8181;
  padding: 20px;
  background: #04012B;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.error-state .error-title {
  font-size: 20px;
  font-weight: 700;
}

.error-state .error-message {
  font-size: 14px;
  margin-top: 8px;
  color: #d1d5db;
  max-width: 400px;
}

.error-state .retry-btn {
  margin-top: 24px;
  padding: 8px 16px;
  background: #fff;
  color: #04012B;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  transition: background 0.2s;
}

.error-state .retry-btn:hover {
  background: #e5e7eb;
}

/* ── Container Card wrapping & Sub-cards styles ── */
.container-card-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

@media (min-width: 768px) {
  .container-card-wrap {
    width: calc(50% - 10px);
  }
}

@media (min-width: 1024px) {
  .container-card-wrap {
    width: calc(33.33% - 15px);
  }
}

@media (min-width: 1200px) {
  .container-card-wrap {
    width: calc(25% - 15px);
  }
}

.container-card-wrap .card-item {
  width: 100% !important;
}

.container-children-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  max-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  background-color: var(--body-bg);
  border-radius: 8px;
  box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid transparent;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease;
  padding: 0;
}

.container-children-list::-webkit-scrollbar {
  width: 4px;
}

.container-children-list::-webkit-scrollbar-track {
  background: transparent;
}

.container-children-list::-webkit-scrollbar-thumb {
  background: var(--card-text);
  border-radius: 99px;
}

.container-card-wrap.open .container-children-list {
  padding: 10px;
  border-color: rgba(255, 255, 255, 0.15);
  padding-bottom: 30px;
}

.sub-card-item {
  width: 90% !important;
  height: 60px !important;
  flex-shrink: 0 !important;
  border-left: 4px solid var(--card-text) !important;
  opacity: 0.95;
  box-shadow: 0px 1px 3px 0px rgba(10, 11, 13, 0.08);
}

.container-card .card-title-text {
  font-size: var(--container-title-font-size) !important;
  font-weight: var(--container-title-font-weight) !important;
  font-family: var(--container-title-font-family) !important;
}

.sub-card-item .card-title-text {
  font-size: calc(var(--container-title-font-size) - 2px) !important;
  font-weight: var(--container-title-font-weight) !important;
  font-family: var(--container-title-font-family) !important;
}

@media (max-width: 767px) {
  .container-children-list {
    position: relative;
    top: 0;
    box-shadow: none;
  }
  .container-card-wrap.open {
    margin-bottom: 15px;
  }
}

/* ── Download Card Button ───────────────────────── */
.download-btn-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: var(--card-text);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  z-index: 20;
  margin-right: 8px;
  flex-shrink: 0;
}

.download-btn-card:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.12);
}