* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 3rem; /* Add space at the bottom of the container so the footer doesn't overlap */
}

.header {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px 0 rgba(44,62,80,0.10);
    padding: 24px 32px 18px 32px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: -8rem;
}

.logo-container {
    background: #fff;
    border-radius: 16px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 2px 0 rgba(44,62,80,0.08);
}

.header-logo {
    height: 60px;
    width: 60px;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
    
    display: block;
    object-fit: contain;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.title-section {
    text-align: allign;
    margin-bottom: 0rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: bold;
    color: #cd9c09;
    margin: 25px 0 0rem -2px;
}

.subtitle {
    color: #586276;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.mode-indicator {
    font-size: 0.95rem;
    color: #888;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #dba527;
    color: white;
}

.view-toggle-btn:hover {
    background-color: #00204f;
}

.view-toggle-btn.student-mode {
    background-color: #dba527;
}

.view-toggle-btn.student-mode:hover {
    background-color: #00204f;
}

.night-mode-btn {
    background: #232946;
    color: #d5a924;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.night-mode-btn:hover, .night-mode-btn:focus {
    background: #35374b;
    color: #ffe066;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    outline: none;
}

.night-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    background: none;
    mask: url('data:image/svg+xml;utf8,<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 1 0 9.79 9.79z" /></svg>') center/contain no-repeat;
    background-color: currentColor;
}

.subtitle {
    font-size: 1.125rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.mode-indicator {
    font-size: 0.875rem;
    color: #6b7280;
}

.mode-indicator span {
    font-weight: 600;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.student-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.student-card:hover {
    transform: translateY(-2px) scale(1.015);
}

.card-header {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 2rem; /* Add space between battery and name */
    margin-bottom: 1rem;
}

.student-info {
    flex: 1;
    text-align: right;
}

.student-info h3 {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 0.25rem;
}



.battery-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 60px;
    justify-content: flex-end;
}

.battery-icon {
    position: relative;
    width: 32px;
    height: 32px;
    transition: color 0.3s ease;
}

.battery-fill {
    position: absolute;
    bottom: 20%;
    left: 15%;
    right: 15%;
    background: currentColor;
    transition: all 0.5s ease;
    border-radius: 1px;
}

.battery-gray { color: #9ca3af; }
.battery-red { color: #ef4444; }
.battery-orange { color: #f97316; }
.battery-yellow { color: #eab308; }
.battery-blue { color: #3b82f6; }

.task-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
}

.progress-section {
    margin-bottom: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
  height: 8px;
  border-radius: 6px;
  transition: width 0.3s;
  background: #eee;
}

/* Progress bar color classes */
.progress-green  { background: #4caf50 !important; }
.progress-blue   { background: #2196f3 !important; }
.progress-yellow { background: #ffd900 !important; }
.progress-orange { background: #ff7b00 !important; }
.progress-red    { background: #d20707 !important; }
.progress-gray   { background: #bbb !important; }

.supervisor-controls {
    margin-top: 1rem;
}

.controls-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.75rem;
}

.task-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.task-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-btn:hover:not(:disabled) {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background-color: #f9fafb;
}

.task-btn.completed {
    background-color: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.task-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reset-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background-color: #f3f4f6;
    color: #4b5563;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.reset-btn:hover {
    background-color: #e5e7eb;
}

.student-view-message {
    text-align: center;
    padding: 1rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.club-logo {
  height: 48px;
  width: auto;
  border-radius: 8px;
  margin-right: 12px;
}

/* Compact grid for student view: 6 columns, minimal gap */
.student-view-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr) !important;
    grid-template-rows: repeat(6, 1fr) !important;
    gap: 4px !important;
    padding: 0 !important;
    max-height: 100vh !important;
    overflow: visible !important;
}

/* Compact student card styling */
.student-view-grid .student-card {
    padding: 0.2rem 0.2rem !important;   /* Less vertical space */
    font-size: 10.5px !important;
    min-width: 0 !important;
    height: 50px !important;
    margin: 0 !important;
    box-shadow: 0 1px 3px -2px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    transition: box-shadow 0.2s;
}

/* Subtle hover effect for interactivity */
.student-view-grid .student-card:hover {
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.12);
    z-index: 2;
}

/* Name: smaller, efficient */
.student-view-grid .student-info h3 {
    font-size: 0.60rem !important;
    margin-bottom: 0.08rem !important;
    margin-top: 0.08rem !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
    line-height: 1.1;
}

/* Task/completion icons smaller */
.student-view-grid .battery-icon svg {
    width: 22px !important;
    height: 22px !important;
}
.student-view-grid .battery-icon {
    width: 22px !important;
    height: 22px !important;
}

/* Task count font size match */
.student-view-grid .task-count {
    font-size: 0.85em !important;
}

/* Progress section: compact, aligned */
.student-view-grid .progress-section {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

.student-view-grid .progress-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1em !important;
    color: #910b0b !important;
    margin-bottom: 0.05rem !important;
    margin-top: 0 !important;
    font-weight: 400 !important;
}

.student-view-grid .progress-bar {
    width: 100% !important;
    height: 0.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 9999px;
    background-color: #e5e7eb;
    overflow: hidden;
}

/* Hide supervisor controls and student view message */
.student-view-grid .supervisor-controls,
.student-view-grid .student-view-message {
    display: none !important;
}

/* Student view: align battery to far right, add spacing from name */
.student-view-grid .card-header {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;           /* Increase gap for more space */
    margin-bottom: 0.5rem !important;
}

.student-view-grid .battery-section {
    min-width: 48px !important;
    justify-content: flex-end !important;
    flex-shrink: 0 !important;
    margin-left: 1rem !important; /* Add space between battery and name */
}

.student-view-grid .student-info {
    flex: 1 1 0% !important;
    text-align: right !important;
    margin-right: 0 !important;     /* Remove extra margin if present */
}

/* Reduce font size and padding in student view */
.student-view-grid .student-card {
  font-size: 0.85em;
  padding: 1em 1em;
  margin: 3em 2em;
}

.student-view-grid .student-card h3 {
  font-size: 0.50000em;
  margin: 0.2em 0;
}

.student-view-grid .rank-badge {
  font-size: 1em;
  padding: 0.1em 1em;
}

/* Night mode styles */
body.night-mode {
    background: linear-gradient(135deg, #232946 0%, #16161a 100%);
    color: #eaeaea;
}

body.night-mode .container {
    background: none;
}

body.night-mode .student-card,
body.night-mode .student-view-grid .student-card {
    background: #232946 !important;
    color: #eaeaea !important;
    box-shadow: 0 1px 6px -2px rgba(0,0,0,0.4);
}

body.night-mode .student-info h3,
body.night-mode .rank-badge,
body.night-mode .task-count {
    color: #eaeaea !important;
}

body.night-mode .rank-badge {
    background: #35374b !important;
    color: #fff !important;
    border: none;
}

body.night-mode .progress-bar {
    background-color: #35374b !important;
}

body.night-mode .progress-gray { background-color: #35374b !important; }
body.night-mode .progress-red { background-color: #ff6b6b !important; }
body.night-mode .progress-orange { background-color: #ffb86b !important; }
body.night-mode .progress-yellow { background-color: #ffd86b !important; }
body.night-mode .progress-blue { background-color: #6bbaff !important; }

body.night-mode .view-toggle-btn,
body.night-mode .night-mode-btn {
    background-color: #35374b !important;
    color: #eaeaea !important;
}

body.night-mode .view-toggle-btn:hover,
body.night-mode .night-mode-btn:hover {
    background-color: #44475a !important;
}

.night-mode-btn {
    margin-right: 0.5rem;
    background: #f3f4f6;
    color: #232946;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.7rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

/* Add to your styles.css */
.gold-finish {
    border: 2.5px solid #ffd700 !important;
    box-shadow: 0 0 24px 0 #ffd70055, 0 2px 12px 0 rgba(44,62,80,0.08);
    background: linear-gradient(120deg, #fffbe6 60%, #fffde4 100%);
    position: relative;
    transition: box-shadow 0.3s, border 0.3s, background 0.3s;
}
.gold-finish::after {
    content: "🏅";
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px #ffd70088);
}
body.night-mode .gold-finish {
    background: linear-gradient(120deg, #232946 60%, #ffd70022 100%);
    border-color: #ffd700;
}

/* Responsive: stack to fewer columns on smaller screens */
@media (max-width: 1200px) {
    .student-view-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: none !important;
    }
}
@media (max-width: 800px) {
    .student-view-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: none !important;
    }
}
@media (max-width: 600px) {
    .student-card, .student-view-grid .student-card {
        box-shadow: 0 2px 6px -2px rgba(0,0,0,0.08);
    }
}

@media (max-width: 768px) {
    .title-section {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
}

body.night-mode h1 {
    color: #dba527 !important; /* Gold or bright color for the title */
}

body.night-mode .subtitle {
    color: #00204f !important; /* Light gray for subtitle */
}

body.night-mode .mode-indicator {
    color: #00204f !important; /* Light gray for mode indicator */
}

/* Modern battery SVG, color via CSS class */
.modern-battery-svg {
    width: 24px;
    height: 24px;
}

.modern-battery-svg rect {
    transition: fill 0.3s ease;
}

.battery-gray .modern-battery-svg rect {
    fill: #9ca3af;
}
.battery-red .modern-battery-svg rect {
    fill: #ef4444;
}
.battery-orange .modern-battery-svg rect {
    fill: #f97316;
}
.battery-yellow .modern-battery-svg rect {
    fill: #eab308;
}
.battery-blue .modern-battery-svg rect {
    fill: #3b82f6;
}

/* Modern battery icon color by progress */
.battery-icon.battery-red .modern-battery-svg { color: #ef4444; }
.battery-icon.battery-orange .modern-battery-svg { color: #f97316; }
.battery-icon.battery-yellow .modern-battery-svg { color: #eab308; }
.battery-icon.battery-blue .modern-battery-svg { color: #2563eb; }
.battery-icon.battery-gray .modern-battery-svg { color: #9ca3af; }

.battery-icon:hover,
.rank-badge:hover {
    filter: brightness(1.2) drop-shadow(0 2px 6px #2563eb22);
    cursor: pointer;
    transition: filter 0.2s;
}

.view-toggle-btn:focus-visible,
.night-mode-btn:focus-visible,
.task-btn:focus-visible,
.reset-btn:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

:root {
    --primary-blue: #2563eb;
    --primary-green: #16a34a;
    --primary-red: #ef4444;
    --primary-yellow: #eab308;
    --primary-orange: #f97316;
    --gray: #9ca3af;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #586276;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s, bottom 0.4s;
    z-index: 9999;
}
.toast.show {
    opacity: 1;
    bottom: 3.5rem;
    pointer-events: auto;
}

.footer {
    background: linear-gradient(120deg, #232946cc 60%, #1e213aee 100%);
    color: #eaeaea;
    padding: 2rem 0 1.2rem 0;
    text-align: center;
    margin-top: 3rem;
    border-radius: 1.5rem 1.5rem 0 0;
    font-size: 1.13rem;
    box-shadow: 0 -8px 32px 0 rgba(44, 62, 80, 0.18);
    letter-spacing: 0.01em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(8px) saturate(1.3);
    border-top: 2px solid #35374b;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #6bbaff22 0%, #ffd86b22 100%);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.footer p {
    margin: 0.5rem 0 0 0;
    line-height: 1.7;
    font-weight: 400;
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
}

.footer-link {
    color: #6bbaff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 999px;
    padding: 0.2em 0.8em;
    background: rgba(107,186,255,0.08);
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
    margin-left: 0.3em;
    box-shadow: 0 2px 8px 0 #6bbaff22;
    display: inline-block;
}
.footer-link:hover {
    color: #232946;
    background: #ffd86b;
    box-shadow: 0 4px 16px 0 #ffd86b44;
    text-decoration: none;
}

.footer-tech {
    color: #ffd86b;
    font-weight: 600;
    margin: 0 0.15em;
    letter-spacing: 0.03em;
}

.footer-coffee {
    font-size: 1.2em;
    vertical-align: middle;
    margin: 0 0.1em;
    filter: drop-shadow(0 1px 2px #0002);
}

.simple-footer {
  width: 100%;
  background: #f3f4f6;
  padding: 16px 0;
  margin-top: 32px;
  border-radius: 16px 16px 16px 16px; /* Only top corners rounded */
  box-shadow: 0 -2px 12px 0 rgba(44, 62, 80, 0.08);
  position: relative;
  bottom: 0;
  left: 0;
}

body.night-mode .simple-footer {
  background: #232946;
  color: #eaeaea;
  border-top: 1.5px solid #35374b;
}

.simple-footer-container {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.97rem;
  color: #444;
  letter-spacing: 0.01em;
}

body.night-mode .simple-footer-container {
  color: #eaeaea;
}

.simple-footer-link {
  display: inline-block;
  margin-left: 0em;
  color: #2563eb;
  text-decoration: none;
  font-size: 0.97rem;
  border-radius: 990px;
  padding: 0.1em 0.2em;
  transition: background 0.2s, color 0.2s;
}

.simple-footer-link:hover {
  background: #2563eb;
  color: #fff;
  text-decoration: none;
}

.achievers-list {
  max-width: 700px;
  margin: 32px auto 0 auto;
  background: #fffbe6;
  border-radius: 12px;
  box-shadow: 0 2px 12px 0 #ffd70022;
  padding: 20px 24px;
  text-align: center;
  font-size: 1.1rem;
  color: #b48800;
  font-weight: 600;
}
body.night-mode .achievers-list {
  background: #232946;
  color: #ffd700;
  box-shadow: 0 2px 12px 0 #ffd70044;
}
.achievers-list ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}
.achievers-list li {
  margin: 0.3em 0;
  font-size: 1.08rem;
}

.leaderboard-section {
    background: #fffbe7;
    border-radius: 12px;
    margin: 1.5em auto;
    max-width: 500px;
    padding: 1em 2em;
    box-shadow: 0 2px 8px -3px #dba52733;
    text-align: right;
}
.leaderboard-title {
    font-size: 1.3em;
    color: #dba527;
    margin-bottom: 0.5em;
    text-align: center;
}
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.leaderboard-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4em 0;
    border-bottom: 1px solid #f3e6c1;
    font-size: 1.05em;
}
.leaderboard-list li:last-child {
    border-bottom: none;
}
.leaderboard-rank {
    font-weight: bold;
    color: #dba527;
    margin-left: 0.5em;
}
.leaderboard-name {
    flex: 1;
    margin: 0 0.5em;
    text-align: right;
}
.leaderboard-tasks {
    color: #888;
    font-size: 0.95em;
}

@media print {
  body > *:not(#print-achievers) {
    display: none !important;
  }
  #print-achievers {
    display: block !important;
    position: static !important;
    width: 100vw !important;
    background: #fff !important;
    color: #222 !important;
    padding: 2em !important;
    font-size: 1.2em !important;
    box-shadow: none !important;
    margin: 0 !important;
    min-height: 0 !important;
    page-break-after: avoid !important;
    z-index: 99999 !important;
  }
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
  }
}

#print-btn {
  display: block;
  margin: 2em auto;
  padding: 0.5em 1.5em;
  font-size: 1.2em;
  background: #dba527;
  color: #232946;
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 8px #ffd70044;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.5px;
}

#print-btn:hover {
  background: #00204f;
  color: #dba527;
}

@media print {
  #print-btn {
    display: none !important;
  }
}

body.student-mode .header {
    margin-bottom: 0rem !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    min-height: unset !important;
}

body.student-mode .title-section {
    margin-bottom: 0.2rem !important;
}

body.student-mode .container {
    padding-top: 0 !important;
}

body.student-mode .logo-container {
    display: none !important;
}

/* Make footer stick to bottom in student view */
body.student-mode {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.student-mode .container {
    flex: 1 0 auto;
    padding-bottom: 0 !important;
}

body.student-mode footer.simple-footer {
    flex-shrink: 0;
}

body.student-mode .simple-footer {
    margin-top: 5 !important;
}
body.student-mode .container {
    padding-bottom: 0 !important;
    flex: 1 0 auto !important;
}

.supervisor-task-controls {
    display: flex;
    gap: 0.5em;
    margin-top: 0.7em;
    justify-content: flex-end;
}
.add-task-btn, .delete-task-btn {
    padding: 0.3em 0.8em;
    border-radius: 6px;
    border: none;
    background: #ffd700;
    color: #232946;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.add-task-btn:disabled, .delete-task-btn:disabled {
    background: #eee;
    color: #aaa;
    cursor: not-allowed;
}
.delete-task-btn {
    background: #e57373;
    color: #fff;
}
.delete-task-btn:disabled {
    background: #eee;
    color: #aaa;
}

