/* =========================
   VARIABLES
========================= */
:root {
  /* Colors */
  --bg-main: #0f0f0f;
  --bg-card: #181818;
  --bg-input: #121212;
  --bg-border: #2a2a2a;
  
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #777777;
  --text-rank: #666666;
  
  --brand-orange: #ff7302;
  --brand-orange-alpha: rgba(255, 115, 2, 0.25);
  --shadow-standard: 0 8px 24px rgba(0, 0, 0, 0.4);
  
  /* Spacing & Radius */
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --transition-fast: 0.2s ease;
}

/* =========================
   BASE
========================= */
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  margin: 0;
}

h1, h3, h5 {
  font-weight: 700;
}

#app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* =========================
   CARDS / CONTAINERS
========================= */
.card,
.album-card,
canvas {
  background: var(--bg-card) !important;
  box-shadow: var(--shadow-standard) !important;
  border: none !important;
  border-radius: var(--radius-md);
}

/* =========================
   SUMMARY CARDS
========================= */
.card-title {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.card-text {
  color: var(--text-primary);
}

.text-gray {
  color: var(--text-secondary) !important;
}

.text-green {
  color: var(--brand-orange) !important;
}

.mdi {
  font-size: 1.1em;
  vertical-align: middle;
  opacity: 0.9;
}

.btn-sync:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================
   FILTER BAR
========================= */
.filters-bar {
  display: flex;
  justify-content: space-between; 
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.manual-filters {
  display: flex;
  gap: 16px;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.filter-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-select {
  appearance: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: 10px 36px 10px 12px;
  font-size: 0.9rem;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.filter-select:hover {
  border-color: var(--brand-orange);
}

.filter-select:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 2px var(--brand-orange-alpha);
}

/* =========================
   RANGE FILTERS
========================= */
.range-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.range-pill {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-pill:hover {
  border-color: var(--brand-orange);
  color: var(--text-primary);
}

.range-pill.active {
  background: var(--brand-orange);
  color: #000000;
  border-color: var(--brand-orange);
  font-weight: 600;
}

/* =========================
   GRÁFICOS
========================= */
canvas {
  padding: 16px;
}

/* =========================
   ÁLBUNS — SCROLL HORIZONTAL
========================= */
.albums-scroll {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  white-space: nowrap;
  scroll-snap-type: x mandatory;
}

.albums-scroll::-webkit-scrollbar {
  height: 8px;
}

.albums-scroll::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.albums-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================
   CARD DE ÁLBUM
========================= */
.album-card {
  flex: 0 0 auto;          
  width: 160px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  text-align: center;
  scroll-snap-align: start;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.album-card:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6) !important;
}

.album-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.album-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.album-card span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.album-card small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =========================
   TOP TRACKS LIST (TABELA)
========================= */
.top-songs-list {
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.9rem;
  color: #eaeaea;
}

.top-songs-header,
.top-song-row {
  display: grid;
  grid-template-columns: 32px 1fr 70px 80px;
  gap: 8px;
  align-items: center;
}

.top-songs-header {
  font-weight: 600;
  opacity: 0.7;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  margin-bottom: 6px;
}

.top-song-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.top-song-row:last-child {
  border-bottom: none;
}

.song-title {
  font-weight: 500;
}

.song-artist {
  font-size: 0.8rem;
  opacity: 0.6;
}

.song-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.song-cover {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.song-position {
  color: var(--text-rank) !important;
}

.track-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #1f1f1f; 
  transition: background-color var(--transition-fast);
}

.track-item:hover {
  background-color: var(--bg-input);
}

.track-info {
  display: flex;
  align-items: center;
  flex-grow: 1;
  color: var(--text-primary);
}

.track-image {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 12px;
}

.track-text {
  display: flex;
  flex-direction: column;
  min-width: 0; 
}

.track-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.track-album, .track-plays {
  flex-basis: 150px; 
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-left: 16px;
  flex-shrink: 0;
}

.track-plays {
  flex-basis: 120px; 
  font-weight: 600;
  color: var(--text-primary);
}

/* =========================
   TOP ARTISTS LIST
========================= */
.top-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
  color: #eaeaea !important;
}

strong {
  color: #eaeaea !important;
}

.top-row {
  display: grid;
  grid-template-columns: 24px 40px 1fr auto;
  align-items: center;
  gap: 10px;
}

.top-row .rank {
  color: var(--text-rank);
  font-size: 0.9rem;
}

.cover.artist {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.top-row .meta strong {
  display: block;
  font-size: 0.9rem;
}

.top-row .meta small {
  color: #888;
  font-size: 0.75rem;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
  margin-top: 10px;
  margin-bottom: 10px;
  margin-left: 10px;
  border-radius: 20px;
  width: 260px;
  background: #181818;
  border-right: 1px solid #222;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  flex-shrink: 0;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(255, 115, 2, 0.08);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: #121212;
  border: 1px solid #2a2a2a;
  color: rgba(255, 115, 2, 0.8);
  font-weight: 600;
}

.sidebar-bottom {
  border-top: 1px solid #222;
  padding-top: 16px;
}

.sidebar-bottom .sidebar-link {
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
}

/* =========================
   MOBILE SIDEBAR
========================= */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.6rem;
  cursor: pointer;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

@media (max-width: 768px) {

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #app-layout {
    height: auto;
  }

  .sidebar {
    position: fixed;
    top: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 999;
    transform: translateX(-110%);
    transition: transform .3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,.8);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .main-content {
    padding: 16px;
  }
}

/* =========================
   SCROBBLES
========================= */
.scrobble-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
}

.scrobble-cover {
  width: 56px;
  height: 56px;
  background: #ddd;
  flex-shrink: 0;
}

.scrobble-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scrobble-info {
  flex: 1;
}

.scrobble-track {
  font-weight: 600;
}

.scrobble-artist {
  font-size: 0.9rem;
  opacity: 0.8;
}

.scrobble-time {
  font-size: 0.8rem;
  opacity: 0.6;
}

#load-more-scrobbles {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 14px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

#load-more-scrobbles:hover {
  background: rgba(255, 115, 2, 0.25) !important;
}

#load-more-scrobbles:active {
  transform: scale(0.98);
}

#load-more-scrobbles:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#load-more-scrobbles:hover {
  background: linear-gradient(
    90deg,
    rgba(29, 185, 84, 0.06),
    rgba(29, 185, 84, 0.12)
  );
}

#global-loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#global-loading-friends {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}


/* =========================
   RESPONSIVE FILTER BAR
========================= */
@media (max-width: 768px) {

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .range-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .range-filters::-webkit-scrollbar {
    display: none;
  }

  .range-pill {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 8px 14px;
  }

  .manual-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .filter-group {
    min-width: unset;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}


.cover-wrapper {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
}

.cover-wrapper.large {
  width: 140px;
  height: 140px;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
}

.cover-wrapper:hover .cover-overlay {
  opacity: 1;
}

.cover-overlay input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.cover-wrapper.uploading::after {
  content: "Uploading...";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.form-check-input:checked {
  background-color: var(--brand-orange) !important;
  border-color: var(--brand-orange) !important;
}

.bg-black {
  background-color: #121212 !important;
  color: #b3b3b3 !important;
}

.btn-success {
  background-color: rgba(255, 115, 2, 0.25) !important;
  border-color: var(--brand-orange) !important;
}

.btn-success:hover {
  background-color: var(--brand-orange) !important;
  border-color: var(--brand-orange) !important;
}

.profile-card {
    background-color: #121212;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 25px;
    max-width: 600px;
    margin: 20px auto;
    color: #fff;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.profile-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid #333;
}

.profile-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.profile-main-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.scrobble-count-area {
    display: flex;
    flex-direction: column;
}

.big-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.joined-date {
    color: #888;
    font-size: 0.9rem;
    padding-bottom: 5px;
}

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

.profile-divider {
    border: 0;
    border-top: 1px solid #333;
    margin: 20px 0;
}

.profile-grid-stats {
    display: flex;
    justify-content: space-between;
}

.stat-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.stat-icon {
    color: #dcb158;
    font-size: 1.2rem;
    margin-right: 10px;
}

.stat-item:nth-child(2) .stat-icon { color: #58dcb1; } 
.stat-item:nth-child(3) .stat-icon { color: #588ddc; }

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-label {
    color: #888;
    font-size: 0.85rem;
}

.data-management {
    max-width: 600px;
    margin: 30px auto;
}

.data-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.data-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.2s;
}

.data-btn:hover { opacity: 0.9; }

.data-btn.export { background-color: #333; color: white; }
.data-btn.import { background-color: var(--brand-orange); color: black; } 

.data-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

/* =========================
   FRIENDS PAGE
========================= */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding-bottom: 20px;
}

.friend-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    border: 1px solid transparent;
}

.friend-card:hover {
    transform: translateY(-4px);
    background: #222;
    border-color: var(--brand-orange);
}

.friend-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    border: 2px solid var(--bg-border);
}

.friend-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
}

.friend-info small {
    color: var(--text-muted);
}

/* =========================
   COMPARISON VIEW
========================= */
.comparison-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.avatars-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--brand-orange);
}

.vs-avatar-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--brand-orange);
    background: #222;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.vs-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vs-avatar-initial {
    font-size: 3rem;
    color: #555;
}


.compatibility-result {
    text-align: center;
    margin-bottom: 40px;
}

.compatibility-label {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.compatibility-status {
    font-size: 2.2rem;
    font-weight: 800;
}

.comp-soulmates { color: #ff0055; text-shadow: 0 0 15px rgba(255, 0, 85, 0.4); }
.comp-high { color: var(--brand-orange); text-shadow: 0 0 15px rgba(255, 115, 2, 0.4); }
.comp-medium { color: #ffcc00; }
.comp-low { color: var(--text-muted); }


.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.comp-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-standard);
}

.comp-card-icon {
    font-size: 2rem;
    color: var(--brand-orange);
    margin-bottom: 10px;
    opacity: 0.8;
}

.comp-card-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.comp-card-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 700;
    font-size: 1.3rem;
    width: 100%;
}

.val-you { color: var(--text-primary); }
.val-vs { color: var(--text-muted); font-size: 0.9rem; font-weight: 400;}
.val-friend { color: var(--text-secondary); }


.common-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--bg-border);
}

.common-img-container {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #222;
    overflow: hidden;
    flex-shrink: 0;
}

.common-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.text-orange { color: var(--brand-orange); font-weight: 600; }

.btn-back {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-back:hover {
    background: #333;
    color: var(--text-primary);
    border-color: var(--text-primary);
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    .avatars-vs {
        gap: 15px;
    }
    .vs-avatar-container {
        width: 90px;
        height: 90px;
    }
}

.row {
    display: flex;
    flex-wrap: wrap;
}

.col-md-4 {
    display: flex; 
    flex-direction: column;
}

.common-list-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px;
    flex-grow: 1; 
    height: 100%; 
}

.common-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.common-img-container {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    background: #111;
    overflow: hidden;
    flex-shrink: 0;
}

.common-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.common-info {
    flex-grow: 1;
    overflow: hidden;
}

.common-info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.common-info small {
    display: block;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.common-counts {
    font-size: 0.75rem;
    margin-top: 2px;
}

.super {
  color: #f90053;
}

.high {
  color: #ff8c1a;
}

.medium {
  color: #ffc266;
}

.low {
  color: #c07a2d;
}

.very-low {
  color: #6b4a2b;
} 