@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

ul { list-style-type: none; }
a { text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; }

body {
  background: #121212;
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2 { text-align: center; margin: 40px 0; }
h1 { font-size: 6rem; }
h2 { font-size: 3rem; color: #1b99e7; }
.italic { margin-top: 15px; font-style: italic; }

#navbar {
  position: sticky;
  top: 0;
  width: 100%;
  padding: 10px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(10px);
  z-index: 100;
  box-shadow: 0 10px 10px rgba(0,0,0,0.3);
  transition: background 1.5s ease;
}

#navText { font-size: 1.8em; font-weight: bold; color: #fff; text-transform: uppercase; }

#navbar .navLinks { display: flex; gap: 25px; }
#navbar .navLinks li a {
  display: inline-block;
  color: #e0e0e0;
  font-weight: 600;
  padding: 10px 15px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

#navbar .navLinks li a:not(.spotifyBtn):hover {
  color: #ffffff;
  background-color: #1b99e7;
  transform: translateY(-3px);
}

.burger { display: none; flex-direction: column; cursor: pointer; gap: 5px; }
.burger span { width: 25px; height: 3px; background: #e0e0e0; transition: all 0.3s; }

.container {
  background: #1b1b1b;
  margin: 20px auto;
  max-width: 95%;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  transition: transform 0.3s;
}

.container:hover { transform: translateY(-3px); }
.altBg { background: #222; }

.flexSections { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.flexSections .card {
  flex: 1 1 calc(33.333% - 20px);
  max-width: 400px;
  background: #2a2a2a;
  padding: 20px;
  border-radius: 12px;
  transition: all 0.3s;
}
.flexSections .card:hover { transform: translateY(-5px); background: #333; }
.tittleName { font-size: 1.25rem; font-weight: 600; }
.text { margin-top: 8px; line-height: 1.6; font-size: 1rem; }

.flexSections a { color: #1b99e7; position: relative; transition: color 0.3s; }
.flexSections a::after {
  content: ''; position: absolute; width: 0; height: 2px;
  bottom: -2px; left: 0; background-color: #1b99e7; transition: width 0.3s;
}
.flexSections a:hover::after { width: 100%; }

footer { width: 100%; margin-top: auto; }
.footerLinks { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.footerLinks a {
  padding: 8px 15px; background: #222; border-radius: 25px;
  color: #e0e0e0; font-weight: 500; transition: all 0.3s;
}
.footerLinks a:hover { background: #444; color: #1b99e7; }
.footerText { text-align: center; font-size: 0.9rem; color: #aaa; }

.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 2000;
}
.modalContent {
  background: #1e1e1e; padding: 25px; border-radius: 12px;
  max-width: 600px; width: 90%; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}
.modalContent h3 { color: #1b99e7; margin-top: 0; margin-bottom: 15px; }
.publicKey {
  background: #2a2a2a; padding: 15px; border-radius: 8px; text-align: left;
  font-family: monospace; font-size: 0.9rem; color: #1b99e7; word-break: break-all;
  white-space: pre-wrap; margin-bottom: 20px;
}
.modalContent button {
  padding: 8px 18px; border: none; border-radius: 25px; background: #1b99e7;
  color: #121212; font-weight: 600; cursor: pointer;
}
.hidden { display: none !important; }

.animatedElements { opacity: 0; transform: translateY(30px); transition: all 0.6s ease-out; }
.animatedElements.visible { opacity: 1; transform: translateY(0); }
.animatedText span { display: inline-block; opacity: 0; animation: fadeInUp 0.3s forwards; animation-delay: calc(0.2s * var(--index)); }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }

.spotifyOfficialIcon { width: 22px; height: 22px; object-fit: contain; margin-right: 8px; }
.spotifyOfficialIconNav { width: 20px; height: 20px; object-fit: contain; margin-right: 6px; }
.spotifyIconLarge { font-size: 3rem; margin-bottom: 15px; }

.spotifyBtn, .spotifyLoginBtn, .spotifyListenBtn {
  display: inline-flex !important; align-items: center; justify-content: center;
  background: #1DB954 !important; color: #ffffff !important; font-weight: 600;
  border: none; transition: all 0.3s ease !important; cursor: pointer; border-radius: 25px;
}
.spotifyBtn { padding: 10px 15px !important; }
.spotifyLoginBtn { padding: 12px 30px; font-size: 1rem; box-shadow: 0 4px 15px rgba(29, 185, 84, 0.3); }
.spotifyListenBtn { padding: 10px 20px; font-size: 0.9rem; }

.spotifyBtn:hover, .spotifyLoginBtn:hover, .spotifyListenBtn:hover {
  background: #1ed760 !important; transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(29, 185, 84, 0.4);
}

.spotifyRetryBtn {
  background: #1b99e7; color: #ffffff; border: none; padding: 10px 25px;
  border-radius: 25px; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}
.spotifyRetryBtn:hover { background: #2ca8f5; transform: translateY(-2px); }

.spotifyLayoutWrapper {
  flex: 1;
  max-width: 95%; 
  width: 100%;
  margin: -80px auto 60px auto;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.spotifyState {
  display: none; flex-direction: column; align-items: center; width: 100%; gap: 40px;
}
.spotifyState:not(.hidden) { display: flex; }

.spotifyContentBlock {
  background: linear-gradient(135deg, rgba(27, 27, 27, 0.85) 0%, rgba(27, 45, 65, 0.85) 100%);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.05); border-radius: 20px;
  padding: 40px; width: 100%; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column; align-items: center;
}

.spotifyPageHero { text-align: center; padding: 10px 0 30px 0; width: 100%; animation: fadeIn 0.8s ease-out; }
.heroIconWrapper { margin-bottom: 20px; }
.heroSpotifyLogo { width: 60px; height: 60px; filter: drop-shadow(0 0 15px rgba(29, 185, 84, 0.3)); transition: transform 0.5s ease; }
.heroSpotifyLogo:hover { transform: rotate(360deg) scale(1.1); }
.heroTitle { font-size: 2.5rem !important; margin: 10px 0 !important; background: linear-gradient(90deg, #fff, #1DB954); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }
.heroDescription { max-width: 600px; margin: 0 auto; color: #aaa; font-size: 1.1rem; line-height: 1.6; }
.heroSeparator { width: 50px; height: 4px; background: #1DB954; margin: 30px auto 0; border-radius: 2px; }

.loginIntro { color: #1DB954; font-weight: 500; font-style: italic; opacity: 0.8; margin-bottom: 20px; text-align: center; }

.loginCard {
  background: rgba(20, 20, 20, 0.6); border: 1px solid rgba(29, 185, 84, 0.15);
  border-radius: 16px; padding: 30px; max-width: 500px; width: 100%;
  display: flex; flex-direction: column; gap: 25px;
}
.loginTitle { font-size: 1.5rem; margin: 0; color: #e0e0e0; font-weight: 600; }
.loginSubtitle { font-size: 1rem; color: #aaa; margin: 0; text-align: center; }
.securityNotice {
  background: rgba(29, 185, 84, 0.08); border: 1px solid rgba(29, 185, 84, 0.2);
  border-radius: 12px; padding: 16px; display: flex; gap: 12px; align-items: flex-start;
}
.securityIcon { width: 20px; height: 20px; fill: #1DB954; flex-shrink: 0; margin-top: 2px; }
.securityNotice p { font-size: 0.9rem; color: #aaa; margin: 0; line-height: 1.5; }

.dashboardWelcomeBanner {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(90deg, rgba(29, 185, 84, 0.15) 0%, rgba(27, 153, 231, 0.08) 100%);
  border: 1px solid rgba(29, 185, 84, 0.3); border-radius: 20px; padding: 30px 40px; text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); backdrop-filter: blur(10px); animation: slideInUp 0.6s ease-out;
}
.bannerContent h2 { font-size: 2.2rem !important; margin: 10px 0 !important; text-align: left !important; color: #fff; font-weight: 800; }
.bannerContent p { max-width: 550px; color: #aaa; line-height: 1.6; font-size: 1rem; }

.magicRevealContainer {
  width: 100%; max-width: 600px; text-align: center; margin-bottom: 40px; padding: 15px 20px;
  background: rgba(29, 185, 84, 0.05); border-radius: 12px; border: 1px dashed rgba(29, 185, 84, 0.4);
  animation: slideInUp 0.6s ease-out;
}
.magicRevealText { font-size: 1.1rem; color: #1DB954; font-weight: 600; margin: 0; font-style: italic; }

.sectionHeader { width: 100%; display: flex; justify-content: flex-start; margin-bottom: 30px; }
.userSectionHeader { justify-content: center; }
.sectionTitle { font-size: 0.95rem; font-weight: 700; color: #aaa; text-transform: uppercase; letter-spacing: 2px; margin: 0; }
.userSectionTitle { text-align: center; }

.userProfileSection { width: 100%; display: flex; justify-content: center; margin-bottom: 50px; }
.userProfileCard {
  display: flex; align-items: center; gap: 15px; background: linear-gradient(135deg, rgba(29, 185, 84, 0.08) 0%, rgba(27, 153, 231, 0.08) 100%);
  border: 1px solid rgba(29, 185, 84, 0.2); padding: 20px 30px; border-radius: 14px; width: 100%; max-width: 400px;
}
.userAvatar { width: 85px; height: 85px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(29, 185, 84, 0.4); display: none; }
.userAvatar[src]:not([src=""]) { display: block; }
.userInfo { display: flex; flex-direction: column; flex: 1; }
.userName { font-size: 1.5rem; color: #e0e0e0; margin: 0; font-weight: 700; }

.nowPlayingSection, .statsSection, .recentlyPlayedSection { width: 100%; margin-bottom: 50px; }

.nowPlayingCard {
  display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center;
  background: linear-gradient(135deg, rgba(29, 185, 84, 0.05) 0%, rgba(27, 45, 65, 0.05) 100%);
  padding: 30px; border-radius: 12px; border: 1px solid rgba(29, 185, 84, 0.2);
}
.nowPlayingLeft { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.albumCover { width: 180px; height: 180px; border-radius: 8px; box-shadow: 0 8px 24px rgba(29, 185, 84, 0.25); object-fit: cover; }

.nowPlayingInfo { display: flex; flex-direction: column; gap: 10px; }
.nowPlayingInfo h2 { font-size: 2rem; margin: 0; color: #e0e0e0; text-align: left; }
.nowPlayingInfo p { margin: 0; font-size: 1.05rem; color: #aaa; }
.nowPlayingInfo p:first-of-type { color: #1DB954; font-weight: 600; font-size: 1.15rem; }

.notPlayingMessage {
  padding: 40px; text-align: center; 
  background: linear-gradient(135deg, rgba(29, 185, 84, 0.05) 0%, rgba(27, 45, 65, 0.08) 100%);
  border-radius: 12px; border: 1px dashed rgba(29, 185, 84, 0.4); width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 15px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.notPlayingMessage p { font-size: 1.15rem; color: #e0e0e0; font-weight: 600; margin: 0; }

.statsSection .sectionTitle { margin-bottom: 30px; } 
.statsPeriod { font-weight: 400; color: #777; text-transform: none; letter-spacing: normal; margin-left: 8px; }
.statsContainer { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

.statItem {
  display: flex; gap: 20px; align-items: center; background: linear-gradient(135deg, #2a2a2a 0%, #1e1e2e 100%);
  padding: 20px; border-radius: 12px; border: 1px solid rgba(29, 185, 84, 0.2); transition: all 0.3s ease;
}
.statItem:hover { transform: translateY(-3px); border-color: rgba(29, 185, 84, 0.4); }
.statItemImage { width: 120px; height: 120px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.statImage { width: 100%; height: 100%; object-fit: cover; }
.statItemInfo { display: flex; flex-direction: column; flex: 1; gap: 8px; }
.statItemInfo h4 { font-size: 0.95rem; color: #1DB954; margin: 0; text-transform: uppercase; }
.statItemInfo p { font-size: 1rem; color: #e0e0e0; margin: 0; }
.statLink {
  display: inline-block; padding: 6px 12px; border: 1px solid #1DB954; color: #1DB954;
  border-radius: 20px; font-size: 0.85rem; font-weight: 600; margin-top: 10px; width: fit-content;
}
.statLink:hover { background: #1DB954; color: #121212; }

.recentlyPlayedList { display: grid; grid-template-columns: 1fr; gap: 12px; }
.recentlyPlayedItem {
  display: flex; align-items: center; gap: 15px; padding: 15px;
  background: rgba(29, 185, 84, 0.05); border-left: 3px solid #1DB954; border-radius: 6px;
}
.recentlyPlayedItem:hover { background: rgba(29, 185, 84, 0.1); transform: translateX(5px); }
.recentlyPlayedNumber { width: 35px; height: 35px; background: #1DB954; color: #121212; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; flex-shrink: 0; }
.recentlyPlayedInfo { display: flex; flex-direction: column; }
.recentlyPlayedName { font-weight: 600; color: #e0e0e0; margin: 0;}
.recentlyPlayedArtist { font-size: 0.85rem; color: #1DB954; margin: 0;}
.recentlyPlayedAlbum { font-size: 0.85rem; color: #aaa; margin: 0;}

.spotifyDataAttribution { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(29, 185, 84, 0.15); font-size: 0.85rem; color: #aaa; }
.spotifyFullLogo { height: 24px; object-fit: contain; }

.errorMessage { font-size: 1rem; color: #e0e0e0; margin: 15px 0; text-align: center; }
.errorHumor { font-size: 0.95rem; color: #aaa; font-style: italic; margin-bottom: 20px; }
.loadingState .spotifyContentBlock { max-width: 400px; padding: 60px 40px; margin: 0 auto; justify-content: center; }
@keyframes pulseText { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.spotifyLoader { display: flex; gap: 8px; justify-content: center; margin-bottom: 25px; }
.loaderDot { width: 15px; height: 15px; background: #1DB954; border-radius: 50%; animation: pulse 1.4s infinite; }
.loaderDot:nth-child(2) { animation-delay: 0.2s; }
.loaderDot:nth-child(3) { animation-delay: 0.4s; }

.loadingText {
  font-size: 1.1rem;
  color: #1DB954;
  font-weight: 600;
  text-align: center;
  animation: pulseText 2s infinite ease-in-out;
  margin: 0;
}

/* ===== RESPONSIVE ===== */
@media(max-width: 768px) {
  #navbar .navLinks {
    position: absolute; top: 100%; right: 5%; width: 180px; padding: 10px;
    border-radius: 8px; background: rgba(18,18,18,1); flex-direction: column;
    opacity: 0; transform: translateY(-10px); visibility: hidden; transition: all 0.3s ease;
  }
  #navbar .navLinks.active { opacity: 1; transform: translateY(0); visibility: visible; }
  .burger { display: flex; }
  .spotifyLabel { display: inline; }
  .spotifyBtn { width: 100%; justify-content: flex-start; }
  .flexSections .card { flex: 1 1 calc(50% - 15px); max-width: none; }
  .dashboardWelcomeBanner { flex-direction: column; text-align: center; padding: 30px 20px; gap: 20px;}
  .bannerContent h2 { text-align: center !important; }
  
  .nowPlayingCard { flex-direction: column; text-align: center; gap: 20px;}
  .nowPlayingInfo h2 { font-size: 1.5rem; text-align: center; }
  .statsContainer { grid-template-columns: 1fr; }
  
  .spotifyLayoutWrapper { margin-top: -40px; }
  .spotifyContentBlock { padding: 40px 20px; }
  .spotifyState { gap: 50px; }
}

@media(max-width: 480px) {
  h1 { font-size: clamp(1.5rem, 10vw, 4rem); }
  h2 { font-size: clamp(1.2rem, 6vw, 2.2rem); }
  
  .container { margin: 15px 5%; padding: 15px; }
  .flexSections { gap: 15px; }
  .flexSections .card { flex: 1 1 100%; }

  .albumCover { width: 140px; height: 140px; }
  .nowPlayingInfo h2 { font-size: 1.3rem; }

  .statItem { flex-direction: column; text-align: center; padding: 25px 15px;}
  .statItemImage { width: 100px; height: 100px; }
  .statLink { margin: 15px auto 0 auto; }
}
