diff --git a/index.html b/index.html
index a37d81a..942221d 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,7 @@
+
diff --git a/js/calendar.js b/js/calendar.js
new file mode 100644
index 0000000..7d9d0c4
--- /dev/null
+++ b/js/calendar.js
@@ -0,0 +1,131 @@
+// Calendar tab — monthly grid + sidebar + day hover popups
+const CAL_FB_CONFIG = {
+ apiKey: "AIzaSyDuSjEGEKx5FnWYnQq8f_owbpYRBRrl5x0",
+ authDomain: "esef-514bf.firebaseapp.com",
+ projectId: "esef-514bf",
+ storageBucket: "esef-514bf.firebasestorage.app",
+ messagingSenderId: "353969651290",
+ appId: "1:353969651290:web:41e3aaf8e54c743702a263"
+};
+
+const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
+const MONTHS = ["January","February","March","April","May","June",
+ "July","August","September","October","November","December"];
+
+document.addEventListener("DOMContentLoaded", () => {
+ const tab = document.getElementById("calendar");
+ if (!tab) return;
+
+ if (!firebase.apps.length) firebase.initializeApp(CAL_FB_CONFIG);
+ const db = firebase.firestore();
+
+ let allEvents = [];
+ let viewDate = new Date();
+
+ const gridEl = document.getElementById("cal-grid");
+ const navEl = document.getElementById("cal-nav-title");
+ const sidebarEl = document.getElementById("cal-sidebar-list");
+
+ db.collection("calendar_events").onSnapshot(snap => {
+ allEvents = [];
+ snap.forEach(doc => {
+ const d = doc.data();
+ allEvents.push({
+ id: doc.id,
+ title: d.title || "",
+ date: d.date || "",
+ time: d.time || "",
+ description: d.description || "",
+ createdBy: d.createdBy || ""
+ });
+ });
+ allEvents.sort((a, b) => (a.date + a.time).localeCompare(b.date + b.time));
+ render();
+ }, () => {
+ if (gridEl) gridEl.innerHTML = '
Could not load.
';
+ });
+
+ document.getElementById("cal-prev").onclick = () => { viewDate.setMonth(viewDate.getMonth()-1); render(); };
+ document.getElementById("cal-next").onclick = () => { viewDate.setMonth(viewDate.getMonth()+1); render(); };
+
+ function render() {
+ const year = viewDate.getFullYear();
+ const month = viewDate.getMonth();
+ navEl.textContent = MONTHS[month] + " " + year;
+
+ // Group events by date for quick lookup
+ const byDate = {};
+ allEvents.forEach(e => {
+ if (!byDate[e.date]) byDate[e.date] = [];
+ byDate[e.date].push(e);
+ });
+
+ // Build grid
+ const firstDay = new Date(year, month, 1).getDay();
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
+ const today = new Date();
+ const todayStr = today.getFullYear() + "-" +
+ String(today.getMonth()+1).padStart(2,"0") + "-" +
+ String(today.getDate()).padStart(2,"0");
+
+ let html = "";
+ WEEKDAYS.forEach(d => html += '");
+
+ for (let i = 0; i < firstDay; i++) {
+ html += '
';
+ }
+
+ for (let d = 1; d <= daysInMonth; d++) {
+ const dateStr = year + "-" +
+ String(month+1).padStart(2,"0") + "-" +
+ String(d).padStart(2,"0");
+ const dayEvents = byDate[dateStr] || [];
+ const isToday = dateStr === todayStr;
+ const hasEvents = dayEvents.length > 0;
+
+ html += '
';
+
+ html += '
' + d + "
";
+ if (hasEvents) {
+ // Dot indicators
+ dayEvents.forEach(() => html += '
');
+
+ // Hover popup
+ html += '";
+ }
+ html += "
";
+ }
+
+ gridEl.innerHTML = html;
+
+ // Sidebar: upcoming events
+ const upcoming = allEvents.filter(e => e.date >= todayStr);
+ if (upcoming.length === 0) {
+ sidebarEl.innerHTML = '
No upcoming events.
Use !book in Discord.
';
+ } else {
+ sidebarEl.innerHTML = upcoming.slice(0, 15).map(e =>
+ '
' +
+ '
' + e.date + (e.time ? " at " + e.time : "") + "
" +
+ '
' + esc(e.title) + "
" +
+ (e.description ? '
' + esc(e.description) + "
" : "") +
+ "
"
+ ).join("");
+ }
+ }
+
+ function esc(s) {
+ if (!s) return "";
+ return String(s).replace(/&/g,"&").replace(//g,">").replace(/"/g,""");
+ }
+});
diff --git a/style/calendar.css b/style/calendar.css
new file mode 100644
index 0000000..00f5182
--- /dev/null
+++ b/style/calendar.css
@@ -0,0 +1,118 @@
+/* Calendar tab */
+
+#calendar-btn {
+ background-color: aliceblue; color: #153dee;
+ border: none; padding: 12px 24px; border-radius: 8px;
+ cursor: pointer; transition: box-shadow 0.3s ease;
+}
+
+/* ── Two-column layout ─────────────────────────────────────── */
+.cal-wrap {
+ max-width: 1200px; margin: 0 auto;
+ padding: 120px 40px 60px;
+ display: flex; gap: 28px;
+ color: #fff;
+}
+.cal-main { flex: 1; min-width: 0; }
+.cal-sidebar { width: 280px; flex-shrink: 0; }
+
+/* ── Month nav ─────────────────────────────────────────────── */
+.cal-nav {
+ display: flex; align-items: center; justify-content: center;
+ gap: 20px; margin-bottom: 18px;
+}
+.cal-nav h2 {
+ font-size: 1.4rem; margin: 0; min-width: 200px; text-align: center;
+ color: rgba(255,255,255,0.9);
+}
+.cal-nav button {
+ background: rgba(91,111,222,0.2); border: 1px solid rgba(91,111,222,0.3);
+ color: #fff; font-size: 1.1rem; width: 36px; height: 36px;
+ border-radius: 8px; cursor: pointer; transition: background 0.2s;
+}
+.cal-nav button:hover { background: rgba(91,111,222,0.4); }
+
+/* ── Month grid ────────────────────────────────────────────── */
+.cal-grid {
+ display: grid;
+ grid-template-columns: repeat(7, 1fr);
+ gap: 3px;
+}
+.cal-day-header {
+ text-align: center; font-size: 0.7rem; text-transform: uppercase;
+ color: rgba(255,255,255,0.35); padding: 6px 0;
+ font-family: Arial, sans-serif; letter-spacing: 1px;
+}
+.cal-day {
+ background: rgba(15,15,35,0.5); border: 1px solid rgba(91,111,222,0.12);
+ border-radius: 6px; min-height: 70px; padding: 4px 6px;
+ position: relative; transition: border-color 0.2s;
+}
+.cal-day.today { border-color: rgba(91,111,222,0.45); }
+.cal-day.other-month { opacity: 0.2; pointer-events: none; }
+.cal-day.has-events { cursor: pointer; }
+.cal-day.has-events:hover {
+ border-color: rgba(91,111,222,0.6);
+ box-shadow: 0 0 16px rgba(91,111,222,0.15);
+ z-index: 2;
+}
+.cal-day .day-num {
+ font-size: 0.75rem; color: rgba(255,255,255,0.45); margin-bottom: 2px;
+}
+.cal-day .day-dot {
+ display: inline-block; width: 6px; height: 6px;
+ border-radius: 50%; background: #a5b4fc;
+ margin: 1px 2px 0 0; vertical-align: middle;
+}
+
+/* ── Hover popup ───────────────────────────────────────────── */
+.cal-popup {
+ display: none; position: absolute;
+ top: 100%; left: 50%; transform: translateX(-50%);
+ background: rgba(20,20,45,0.95); backdrop-filter: blur(12px);
+ border: 1px solid rgba(91,111,222,0.4); border-radius: 10px;
+ padding: 14px 16px; min-width: 200px; max-width: 280px;
+ z-index: 10; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
+ pointer-events: none;
+}
+.cal-day:hover .cal-popup { display: block; }
+.cal-popup h4 {
+ margin: 0 0 10px; font-size: 0.85rem; color: #a5b4fc;
+ font-family: Arial, sans-serif;
+}
+.cal-popup-item {
+ padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
+ font-size: 0.82rem; color: rgba(255,255,255,0.85);
+}
+.cal-popup-item:last-child { border-bottom: none; }
+.cal-popup-item .pop-time {
+ font-weight: bold; color: #c4b5fd; margin-right: 6px;
+}
+.cal-popup-item .pop-desc {
+ font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 2px;
+}
+
+/* ── Sidebar ───────────────────────────────────────────────── */
+.cal-sidebar h3 {
+ font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px;
+ color: rgba(255,255,255,0.4); margin: 0 0 14px;
+ font-family: Arial, sans-serif;
+}
+.cal-side-event {
+ padding: 10px 12px; background: rgba(15,15,35,0.4);
+ border: 1px solid rgba(91,111,222,0.1); border-radius: 8px;
+ margin-bottom: 6px; font-size: 0.82rem;
+}
+.cal-side-event .se-date {
+ color: rgba(255,255,255,0.35); font-size: 0.7rem; margin-bottom: 2px;
+}
+.cal-side-event .se-title {
+ color: #fff; font-weight: 500;
+}
+.cal-side-event .se-desc {
+ color: rgba(255,255,255,0.35); font-size: 0.7rem; margin-top: 2px;
+}
+.cal-side-empty {
+ text-align: center; color: rgba(255,255,255,0.2); padding: 30px 0;
+ font-family: Arial, sans-serif; font-size: 0.8rem;
+}