/* Rainbow Achievement Section - Frame overlay on specific rows */
.rainbow-frame {
    border: 6px solid transparent;
    border-radius: 15px;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, 
                    #ff0000, #ff7f00, #ffff00, #00ff00, 
                    #0000ff, #4b0082, #8b00ff, #ff0000) border-box;
    animation: rainbow-border-spin 6s linear infinite;
    pointer-events: none;
    margin: 0;
}

.rainbow-user-row {
    position: relative;
}

.rainbow-user-row.rainbow-first td {
    padding-top: 15px;
}

.rainbow-user-row.rainbow-last td {
    padding-bottom: 10px;
}

.rainbow-celebration-row {
    background: linear-gradient(135deg, 
        rgba(255, 0, 0, 0.1) 0%, 
        rgba(255, 127, 0, 0.1) 14.3%, 
        rgba(255, 255, 0, 0.1) 28.6%, 
        rgba(0, 255, 0, 0.1) 42.9%, 
        rgba(0, 0, 255, 0.1) 57.1%, 
        rgba(75, 0, 130, 0.1) 71.4%, 
        rgba(139, 0, 255, 0.1) 85.7%, 
        rgba(255, 0, 0, 0.1) 100%);
}

.rainbow-celebration-text {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    font-weight: bold;
    color: #4b0082;
    text-align: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    margin: 5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    animation: bounce-celebration 2s ease-in-out infinite;
}

/* Hide old rainbow elements */
.leaderboard-content-wrapper {
    display: none;
}

.rainbow-indicator {
    display: none;
}

.rainbow-indicator::before {
    content: "";
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        #ff0000, #ff7f00, #ffff00, #00ff00, 
        #0000ff, #4b0082, #8b00ff, #ff0000);
    border-radius: 18px;
    z-index: -1;
    animation: rainbow-border-spin 6s linear infinite;
}

.rainbow-celebration-vertical {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 
        1px 1px 0 #333, 
        2px 2px 0 #333,
        3px 3px 0 #333;
    text-align: center;
    line-height: 1.2;
    animation: bounce-celebration 2s ease-in-out infinite;
}

.leaderboard-content-wrapper table {
    flex: 1;
}

/* Original Rainbow Achievement Section - Keep for backward compatibility but hide */
.rainbow-achievement {
    display: none;
}

.rainbow-achievement::before {
    display: none;
}

.rainbow-celebration {
    display: none;
}

.rainbow-users {
    display: none;
}

.rainbow-user {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    background: linear-gradient(45deg, #ff9aa2, #ffb7b2, #ffdac1, #e2f0cb, #b5ead7, #c7ceea);
    border-radius: 12px;
    animation: sparkle-user 4s ease-in-out infinite;
}

/* Rainbow achievement animations */
@keyframes rainbow-glow {
    0% {
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    }
    16.6% {
        box-shadow: 0 0 20px rgba(255, 127, 0, 0.5);
    }
    33.3% {
        box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    }
    66.6% {
        box-shadow: 0 0 20px rgba(0, 0, 255, 0.5);
    }
    83.3% {
        box-shadow: 0 0 20px rgba(75, 0, 130, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(139, 0, 255, 0.5);
    }
}

@keyframes rainbow-border-spin {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

@keyframes bounce-celebration {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes sparkle-user {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* User Avatar Styles */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

/* Adjust name cell layout for avatars */
.member-name {
    display: flex;
    align-items: center;
    min-height: 40px;
}

/* Rainbow themed leaderboard styles */
body {
    font-family: 'Fredoka One', 'Bubblegum Sans', 'Nunito', sans-serif;
    background: linear-gradient(to bottom, #ff9aa2, #ffb7b2, #ffdac1, #e2f0cb, #b5ead7, #c7ceea);
    background-attachment: fixed;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #ffffff;
    text-shadow: 2px 2px 0 #ff0000, 
                4px 4px 0 #ff7700,
                6px 6px 0 #ffff00,
                8px 8px 0 #00ff00,
                10px 10px 0 #0000ff,
                12px 12px 0 #8a2be2;
    font-size: 3em;
    margin-bottom: 30px;
}

.leaderboard {
    max-width: 900px; /* Increased from 700px */
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    /* Remove these conflicting lines */
    /* width: 100%; */
    /* border-collapse: collapse; */
    /* margin-top: 20px; */
    /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */
    /* border-radius: 8px; */
    /* overflow: hidden; */
}

.leaderboard::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 20px;
    background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    padding: 15px;
    text-align: left;
    background-color: #ff9cee;
    color: white;
    font-weight: bold;
    border-radius: 10px;
    font-size: 1.2em;
}

td {
    padding: 15px;
    background-color: white;
    border-bottom: 3px solid #ffd700;
    color: #333;
    font-weight: 500;
}

tr:nth-child(1) td {
    background-color: #ffd700; /* Gold for 1st place */
    font-weight: bold;
    font-size: 1.2em;
    border-bottom: 3px solid #cc9900;
}

tr:nth-child(2) td {
    background-color: #c0c0c0; /* Silver for 2nd place */
    border-bottom: 3px solid #999999;
}

tr:nth-child(3) td {
    background-color: #cd7f32; /* Bronze for 3rd place */
    border-bottom: 3px solid #a05a2c;
}

/* Add rainbow colors to all rows, not just the top 3 */
tr:nth-child(7n+1) td {
    background-color: rgba(255, 0, 0, 0.25); /* Red - increased opacity */
    border-bottom: 3px solid #ff0000;
}

tr:nth-child(7n+2) td {
    background-color: rgba(255, 127, 0, 0.25); /* Orange - increased opacity */
    border-bottom: 3px solid #ff7f00;
}

tr:nth-child(7n+3) td {
    background-color: rgba(255, 255, 0, 0.25); /* Yellow - increased opacity */
    border-bottom: 3px solid #ffff00;
}

tr:nth-child(7n+4) td {
    background-color: rgba(0, 255, 0, 0.25); /* Green - increased opacity */
    border-bottom: 3px solid #00ff00;
}

tr:nth-child(7n+5) td {
    background-color: rgba(0, 0, 255, 0.25); /* Blue - increased opacity */
    border-bottom: 3px solid #0000ff;
}

tr:nth-child(7n+6) td {
    background-color: rgba(255, 20, 147, 0.4); /* Deep pink - vibrant instead of dull indigo */
    border-bottom: 3px solid #ff1493;
}

tr:nth-child(7n+7) td {
    background-color: rgba(139, 0, 255, 0.25); /* Purple/Violet - complete the rainbow */
    border-bottom: 3px solid #8b00ff;
}

.controls {
    margin-bottom: 20px;
    text-align: left; /* Change from center to left */
    position: relative;
}

#refresh-btn {
    padding: 12px 24px;
    background: linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

#refresh-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(0,0,0,0.3);
}

#refresh-btn:active {
    transform: scale(0.95);
}

/* Updated styles for left-aligned timer */
.refresh-timer {
    position: absolute;
    left: -110px; /* Position it to the left of the leaderboard */
    top: 20px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.9) 100%);
    padding: 3px 10px;
    border-radius: 30px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    border: 1px dashed #ffcc00;
    transition: all 0.3s ease;
    width: 100px; /* Make it narrower */
    z-index: 5;
}

.refresh-timer:hover {
    transform: scale(1.02); /* Smaller hover effect */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.timer-icon {
    font-size: 1.1rem;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

.timer-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.timer-text span {
    font-size: 0.65rem;
}

.countdown {
    font-size: 0.9rem;
    font-weight: bold;
    color: #ff6b8b;
    font-family: 'Bubblegum Sans', cursive;
    margin-top: 0; /* Remove top margin */
}

/* Reduced animation for smaller pulse */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Keep the urgent countdown effect */
.countdown.urgent {
    color: #ff3366;
    animation: flash 1s infinite;
}

/* Add some decorative elements */
.leaderboard::after {
    content: "🌈";
    position: absolute;
    top: -40px;
    right: 20px;
    font-size: 40px;
}

/* Points sparkle effect */
td:last-child::after {
    content: " ✨";
}


/* Rainbow Loading Animation */
.loading-container {
  display: none; /* Hidden by default, shown when loading */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.rainbow-loader {
  position: relative;
  width: 200px;
  height: 120px;
  margin: 0 auto 20px;
}

.rainbow-arc {
  position: absolute;
  width: 120px;
  height: 60px;
  border-radius: 120px 120px 0 0;
  border-width: 5px;
  border-style: solid;
  left: 40px;
  top: 40px;
  border-color: #ff0000 #ff9900 #ffff00 #33cc33 #3399ff #6633cc;
  animation: rainbow-rotate 2.5s linear infinite;
  transform-origin: 50% 100%;
  z-index: 5;
}

.cloud {
  position: absolute;
  font-size: 30px;
  opacity: 0.8;
  z-index: 2;
}

.cloud-left {
  left: 10px;
  top: 60px;
  animation: float-left 3s ease-in-out infinite;
}

.cloud-right {
  right: 10px;
  top: 70px;
  animation: float-right 2.7s ease-in-out infinite;
}

.unicorn {
  position: absolute;
  font-size: 40px;
  bottom: 10px;
  left: 80px;
  z-index: 10;
  animation: bounce 1s ease-in-out infinite alternate;
}

.loading-text {
  color: #6633cc;
  font-size: 18px;
  font-weight: bold;
  animation: color-shift 2.5s linear infinite;
}

/* Animations */
@keyframes rainbow-rotate {
  0% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
  100% { transform: rotate(-5deg); }
}

@keyframes float-left {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-10px) translateX(5px); }
  100% { transform: translateY(0) translateX(0); }
}

@keyframes float-right {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-8px) translateX(-5px); }
  100% { transform: translateY(0) translateX(0); }
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-15px); }
}

@keyframes color-shift {
  0% { color: #ff0000; }
  16.6% { color: #ff9900; }
  33.3% { color: #ffff00; }
  50% { color: #33cc33; }
  66.6% { color: #3399ff; }
  83.3% { color: #6633cc; }
  100% { color: #ff0000; }
}

/* Cute info cloud */
.info-cloud {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  z-index: 100;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
  animation: float 6s ease-in-out infinite;
}

.cloud-shape {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: white;
  border-radius: 50px;
  z-index: -1;
}

.cloud-shape:before, .cloud-shape:after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}

.cloud-shape:before {
  width: 140px;
  height: 140px;
  top: -50px;
  left: 25px;
}

.cloud-shape:after {
  width: 120px;
  height: 120px;
  top: -30px;
  right: 25px;
}

.cloud-content {
  position: relative;
  padding: 30px 25px;
  text-align: center;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
}

.cloud-content p {
  margin: 10px 0;
}

.cloud-content .example {
  background: rgba(255, 192, 203, 0.3);
  padding: 8px;
  border-radius: 8px;
  margin: 15px 0;
  color: #ff6b8b;
}

@keyframes float {
  0% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-10px); }
  100% { transform: translateY(-50%) translateX(0); }
}

/* Make the cloud responsive */
@media (max-width: 1200px) {
  .info-cloud {
    position: static;
    margin: 30px auto;
    transform: none;
    animation: float 6s ease-in-out infinite;
  }
  
  @keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
  }
}

/* Add media query for mobile devices */
@media (max-width: 1100px) {
    .refresh-timer {
        position: static;
        margin: 0 0 10px 0;
        width: auto;
    }
}

/* Month display styles */
.month-display {
    text-align: center;
    margin-bottom: 15px;
    margin-top: 5px;
}

.current-month {
    display: inline-block;
    font-family: 'Bubblegum Sans', cursive;
    font-size: 1.8rem; /* Increased from 1.4rem */
    color: #5c4694;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    padding: 8px 25px; /* Slightly larger padding */
    border-radius: 30px;
    box-shadow: 0 3px 10px rgba(92, 70, 148, 0.3), 0 0 5px rgba(255, 255, 255, 0.8); /* Enhanced shadow */
    border: 2px dashed #ffcc00; /* Thicker border */
    position: relative;
    animation: sparkle 2s infinite alternate;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Add sparkly effect with pseudo-elements */
.current-month::before,
.current-month::after {
    content: "✨";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.current-month::before {
    left: -5px;
    animation: floatLeft 3s ease-in-out infinite;
}

.current-month::after {
    right: -5px;
    animation: floatRight 3s ease-in-out infinite;
}

/* Animations for sparkly effects */
@keyframes sparkle {
    0% {
        box-shadow: 0 3px 10px rgba(92, 70, 148, 0.3), 0 0 5px rgba(255, 255, 255, 0.8);
    }
    100% {
        box-shadow: 0 3px 15px rgba(92, 70, 148, 0.5), 0 0 10px rgba(255, 204, 0, 0.5);
    }
}

@keyframes floatLeft {
    0%, 100% { transform: translate(0, -50%); }
    50% { transform: translate(-3px, -50%); }
}

@keyframes floatRight {
    0%, 100% { transform: translate(0, -50%); }
    50% { transform: translate(3px, -50%); }
}