:root {
    --primary-bg: #100C1F;
    --secondary-bg: #1A1333;
    --accent-color: #6C60B4;
    --logo-purple: #9B5DE5;
    --text-color: #E2D9F3;
    --faded-text: #6A5B87;
    --border-color: #382C53;
    --selected-bg: #6C60B4;
    --event-dot-color: #E2D9F3;
    --hover-bg: #2C2347;
    --button-gradient-start: #7568C3;
    --button-gradient-end: #6C60B4;

    /* New Tag Colors */
    --tag-tech-color: #587FBB;
    --tag-cultural-color: #BB5858;
    --tag-academic-color: #58BB6F;
    --tag-sports-color: #BB8C58;

    /* Letter card colors */
    --letter-tech-bg: #40689E;
    --letter-cultural-bg: #9E4040;
    --letter-academic-bg: #409E5A;
    --letter-sports-bg: #9E7440;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Global overflow prevention */
* {
    box-sizing: border-box;
}

/* Form container sizing */
form {
    max-width: 100%;
    box-sizing: border-box;
}

html {
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    background-color: var(--bg-color, #f9fafb);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-color, #1f2937);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    position: relative;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
}

main {
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 1.5rem 0;
    position: relative;
    z-index: 10;
    background: transparent !important;
}

.logo {
    font-size: 1.75rem;
    font-weight: 600;
}

.logo-giki {
    color: var(--logo-purple);
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    color: var(--faded-text);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
}

.nav-link:hover {
    color: #fff;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease-in-out;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: #3b82f6;
    font-weight: 600;
}

/* New navigation styles for the updated header */
#nav-events.active,
#nav-submit.active {
    color: #3b82f6;
    font-weight: 600;
}

.sign-in-btn {
    background: linear-gradient(90deg, var(--button-gradient-start) 0%, var(--button-gradient-end) 100%);
    color: var(--text-color);
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.sign-in-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 96, 180, 0.4);
}

.arrow {
    width: 1.25rem;
    height: 1.25rem;
}

/* Main Content and Hero Section */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 4rem;
    position: relative;
    z-index: 5;
}

.hero-section {
    margin-bottom: 4rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    background: linear-gradient(90deg, var(--text-color) 0%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--faded-text);
    font-weight: 400;
}

/* Calendar */
.calendar-container {
    background-color: transparent;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    padding: 2.5rem;
    width: min(92vw, 1100px);
    max-width: 1100px;
    height: auto; /* let content define height to prevent cutoff */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 auto;
    min-height: 520px;
    box-sizing: border-box;
    position: relative;
    overflow: visible; /* avoid inner scrolling */
}

.calendar-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.nav-arrow {
    background: linear-gradient(135deg, rgba(10,25,49,0.85), rgba(26,61,99,0.85));
    border: 1px solid rgba(179,207,229,0.25);
    color: #B3CFE5;
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(10,25,49,0.35);
    transition: background 0.25s ease, color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
}

.nav-icon { width: 1.25rem; height: 1.25rem; display: block; }

.nav-arrow:hover {
    background: linear-gradient(135deg, #4A7FA7, #1A3D63);
    color: #F6FAFD;
    border-color: rgba(179,207,229,0.35);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(10,25,49,0.45);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 0.75rem;
    text-align: center;
    min-height: 0; /* do not force extra height that could clip container */
    width: 100%;
    position: relative;
    overflow: visible; /* prevent grid from creating its own scroll */
}

.day-of-week {
    font-weight: 500;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.day {
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-weight: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px; /* slightly smaller tiles to fit reliably */
    user-select: none;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    /* Icy paint-drop tile (darker by default) */
    background:
        radial-gradient(60px 40px at 20% 26%, rgba(168,203,231,0.85), transparent 65%),
        radial-gradient(50px 35px at 80% 22%, rgba(137,185,213,0.70), transparent 62%),
        radial-gradient(55px 36px at 30% 70%, rgba(74,127,167,0.55), transparent 60%),
        linear-gradient(155deg, #A7CBE6 0%, #4A7FA7 100%);
    color: #F6FAFD;
    border: 1px solid rgba(26,61,99,0.28);
}

.day:hover:not(.selected):not(.other-month) {
    background:
        radial-gradient(60px 40px at 20% 26%, rgba(137,185,213,0.85), transparent 65%),
        radial-gradient(50px 35px at 80% 22%, rgba(74,127,167,0.70), transparent 62%),
        radial-gradient(55px 36px at 30% 70%, rgba(26,61,99,0.55), transparent 60%),
        linear-gradient(155deg, #4A7FA7 0%, #1A3D63 100%);
    color: #F6FAFD;
    border-color: rgba(26,61,99,0.35);
}

.day.selected {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(137,185,213,0.90), transparent 60%),
        radial-gradient(58px 40px at 78% 26%, rgba(74,127,167,0.75), transparent 58%),
        radial-gradient(60px 42px at 35% 72%, rgba(26,61,99,0.60), transparent 58%),
        linear-gradient(155deg, #4A7FA7 0%, #1A3D63 100%);
    color: #F6FAFD;
    font-weight: 700;
    border-color: rgba(26,61,99,0.45);
    box-shadow: 0 8px 18px rgba(10,25,49,0.35), inset 0 0 0 1px rgba(179,207,229,0.15);
    transform: translateY(-1px);
    transition: transform 0.2s ease;
}

.day.other-month {
    color: var(--text-muted, #9ca3af);
    opacity: 0.6;
    cursor: default;
}

.day.other-month:hover {
    background-color: transparent;
}

.day.event {
    position: relative;
}

/* Support calendars that render a dot element instead of an 'event' class */
.calendar-grid .day:has(.event-dot) {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(207,227,242,0.95), transparent 60%),
        radial-gradient(58px 40px at 78% 26%, rgba(168,203,231,0.75), transparent 58%),
        linear-gradient(155deg, #B3CFE5 0%, #4A7FA7 100%);
    color: #0A1931;
    border: 2px solid #B3CFE5;
    box-shadow: 0 10px 22px rgba(74,127,167,0.45), inset 0 0 0 1px rgba(255,255,255,0.15);
    position: relative;
}

.calendar-grid .day:has(.event-dot)::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #B3CFE5;
    border: 2px solid #1A3D63;
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(179,207,229,0.8);
}

.calendar-grid .day:has(.event-dot):hover {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(207,227,242,1), transparent 58%),
        radial-gradient(58px 40px at 78% 26%, rgba(137,185,213,0.85), transparent 56%),
        linear-gradient(155deg, #A7CBE6 0%, #1A3D63 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
}

.calendar-grid .day:has(.event-dot).selected {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(137,185,213,0.92), transparent 58%),
        radial-gradient(60px 42px at 35% 72%, rgba(26,61,99,0.60), transparent 58%),
        linear-gradient(155deg, #4A7FA7 0%, #102843 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
    box-shadow: 0 12px 26px rgba(10,25,49,0.45), inset 0 0 0 1px rgba(179,207,229,0.2);
}

.event-dot {
    position: absolute;
    bottom: 5px;
    width: 5px;
    height: 5px;
    background-color: var(--event-dot-color);
    border-radius: 50%;
}

.day.active {
    border: 1px solid var(--accent-color);
}

/* Event days: visibly highlighted tiles */
.day.event {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(207,227,242,0.95), transparent 60%),
        radial-gradient(58px 40px at 78% 26%, rgba(168,203,231,0.75), transparent 58%),
        linear-gradient(155deg, #B3CFE5 0%, #4A7FA7 100%);
    color: #0A1931;
    border: 2px solid #B3CFE5;
    box-shadow: 0 10px 22px rgba(74,127,167,0.45), inset 0 0 0 1px rgba(255,255,255,0.15);
    position: relative;
}

.day.event::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #B3CFE5;
    border: 2px solid #1A3D63;
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(179,207,229,0.8);
}

.day.event:hover {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(207,227,242,1), transparent 58%),
        radial-gradient(58px 40px at 78% 26%, rgba(137,185,213,0.85), transparent 56%),
        linear-gradient(155deg, #A7CBE6 0%, #1A3D63 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
}

.day.event.selected {
    background:
        radial-gradient(70px 46px at 24% 30%, rgba(137,185,213,0.92), transparent 58%),
        radial-gradient(60px 42px at 35% 72%, rgba(26,61,99,0.60), transparent 58%),
        linear-gradient(155deg, #4A7FA7 0%, #102843 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
    box-shadow: 0 12px 26px rgba(10,25,49,0.45), inset 0 0 0 1px rgba(179,207,229,0.2);
}

.watermark-container {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    opacity: 0.3;
}

.watermark {
    fill: var(--text-color);
}

/* Prevent body scrolling when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Event Pop-up Modal */
.event-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.event-popup.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* fully remove to avoid extra scrollbars */
}

.popup-content {
    background: linear-gradient(135deg, rgba(10,25,49,0.94) 0%, rgba(26,61,99,0.92) 100%);
    border: 1px solid rgba(179,207,229,0.25);
    padding: 2.0rem 2.25rem;
    border-radius: 1rem;
    width: min(90vw, 640px);
    position: relative;
    text-align: left;
    box-shadow: 0 20px 50px rgba(10,25,49,0.45);
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-height: 82vh;
    overflow-y: auto;
    box-sizing: border-box;
    overflow-x: hidden;
    color: #F6FAFD;
}

.event-popup:not(.hidden) .popup-content {
    transform: scale(1);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    color: rgba(179,207,229,0.85);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.2s ease;
}

.close-btn:hover {
    color: #F6FAFD;
    transform: rotate(90deg) scale(1.05);
}

.event-details-card {
    padding: 1.25rem;
    border-radius: 0.875rem;
    background: linear-gradient(135deg, rgba(10,25,49,0.7), rgba(26,61,99,0.7));
    border: 1px solid rgba(179,207,229,0.2);
    margin-bottom: 1.25rem;
}

.popup-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #B3CFE5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-date {
    font-size: 1rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-description {
    font-size: 1rem;
    line-height: 1.65;
    color: #B3CFE5;
    font-weight: 400;
    margin-bottom: 1.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-tags {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
}

.event-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    background-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.event-tag:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.tag-cultural {
    color: var(--tag-cultural-color);
    border-color: var(--tag-cultural-color);
}

.tag-academic {
    color: var(--tag-academic-color);
    border-color: var(--tag-academic-color);
}

.tag-tech {
    color: var(--tag-tech-color);
    border-color: var(--tag-tech-color);
}

.tag-sports {
    color: var(--tag-sports-color);
    border-color: var(--tag-sports-color);
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.add-to-calendar-btn,
.delete-event-btn {
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.add-to-calendar-btn {
    background:
        radial-gradient(120% 180% at 8% -20%, rgba(246,250,253,0.25), transparent 60%),
        linear-gradient(155deg, #B3CFE5 0%, #4A7FA7 100%);
    color: #0A1931;
    border: 2px solid #B3CFE5;
    box-shadow: 0 10px 22px rgba(74,127,167,0.35), inset 0 0 0 1px rgba(255,255,255,0.12);
}

.add-to-calendar-btn:hover {
    background:
        radial-gradient(120% 180% at 8% -20%, rgba(246,250,253,0.3), transparent 58%),
        linear-gradient(155deg, #A7CBE6 0%, #1A3D63 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(10,25,49,0.45), inset 0 0 0 1px rgba(255,255,255,0.15);
}

.delete-event-btn {
    background:
        radial-gradient(120% 180% at 8% -20%, rgba(246,250,253,0.25), transparent 60%),
        linear-gradient(155deg, #A7CBE6 0%, #1A3D63 100%);
    color: #0A1931;
    border: 2px solid #B3CFE5;
    box-shadow: 0 10px 22px rgba(74,127,167,0.35), inset 0 0 0 1px rgba(255,255,255,0.12);
}

.delete-event-btn:hover {
    background:
        radial-gradient(120% 180% at 8% -20%, rgba(246,250,253,0.3), transparent 58%),
        linear-gradient(155deg, #4A7FA7 0%, #102843 100%);
    color: #F6FAFD;
    border-color: #B3CFE5;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(10,25,49,0.45), inset 0 0 0 1px rgba(255,255,255,0.15);
}

.add-to-calendar-btn:focus-visible,
.delete-event-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(179,207,229,0.35), 0 10px 22px rgba(10,25,49,0.35);
}

.add-to-calendar-btn:active,
.delete-event-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 16px rgba(10,25,49,0.35);
}

.submit-event-section {
    display: none;
    width: 100%;
    max-width: 800px;
    text-align: center;
    margin: 2rem auto;
    animation: fadeIn 0.5s ease-in-out;
    box-sizing: border-box;
}

.submit-event-section .hero-title,
.submit-event-section .hero-subtitle {
    text-align: center;
}

.submit-event-form {
    background-color: var(--card-bg, var(--secondary-bg));
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color, #1f2937);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-color, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    color: var(--text-color, #1f2937);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-form-btn {
    background: var(--primary-color, #3b82f6);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.submit-form-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.events-section {
    display: none;
    width: 100%;
    max-width: 1200px;
    text-align: center;
    margin: 2rem auto;
    animation: fadeIn 0.5s ease-in-out;
}

.event-category-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: left;
    padding-left: 1rem;
    color: var(--text-color, #1f2937);
}

.events-container {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    margin-bottom: 3rem;
}

.event-card {
    background-color: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.letter-card {
    width: 70px;
    height: 70px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.event-card:hover .letter-card {
    transform: scale(1.05);
}

.letter-card.tech {
    background-color: var(--letter-tech-bg);
}

.letter-card.cultural {
    background-color: var(--letter-cultural-bg);
}

.letter-card.academic {
    background-color: var(--letter-academic-bg);
}

.letter-card.sports {
    background-color: var(--letter-sports-bg);
}

.event-card-content {
    flex-grow: 1;
    text-align: left;
}

.event-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color, #1f2937);
    margin-bottom: 0.25rem;
}

.event-card-date {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.event-card-description {
    font-size: 0.9rem;
    color: var(--text-muted, #6b7280);
    font-weight: 300;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.event-card-location {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-section {
    display: none;
    text-align: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-in-out;
}

.map-image {
    width: 100%;
    max-width: 900px;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.popup-location-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--faded-text);
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-location-container svg {
    color: var(--faded-text);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* fully remove to avoid extra scrollbars */
}

.modal-content {
    background-color: var(--secondary-bg);
    background: linear-gradient(135deg, var(--secondary-bg) 0%, #20183F 100%);
    padding: 2rem;
    border-radius: 1rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: var(--faded-text);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--logo-purple);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.cancel-btn,
.confirm-btn {
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    width: 50%;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.cancel-btn {
    background-color: var(--faded-text);
    color: var(--text-color);
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(106, 91, 135, 0.4);
}

.confirm-btn {
    background-color: #E53E3E;
    color: #fff;
}

.confirm-btn:hover {
    background-color: #C53030;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
}

.notification {
    background-color: var(--secondary-bg);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
    position: relative;
    border-left: 4px solid;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: #4CAF50;
}

.notification.error {
    border-left-color: #F44336;
}

.notification-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    font-size: 1.5rem;
    color: var(--faded-text);
    cursor: pointer;
}

.notification-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Add to Calendar Modal Styles */
.calendar-options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calendar-option-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: var(--hover-bg);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.calendar-option-btn:hover {
    background-color: #382C53;
    transform: translateY(-2px);
}

.calendar-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 0;
        overflow-x: hidden;
        width: 100%;
    }

    html {
        overflow-x: hidden;
        width: 100%;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }

    .nav {
        gap: 1.5rem;
        justify-content: center;
        width: 100%;
    }
    
    .logo {
        font-size: 1.5rem;
    }

    .sign-in-btn {
        width: 100%;
        justify-content: center;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .calendar-container {
        padding: 1rem;
        max-width: 100%;
        margin: 0;
        border-radius: 8px;
        box-sizing: border-box;
        overflow: visible; /* let content define height to avoid clipping */
        position: relative;
        width: min(94vw, 720px);
        aspect-ratio: auto; /* allow natural height */
        min-height: auto; /* allow content to dictate height */
    }
    
    .submit-event-section {
        max-width: min(94vw, 800px);
        margin: 1.5rem auto;
        padding: 0 1rem;
        box-sizing: border-box;
    }
    
    .submit-event-form {
        padding: 2rem;
        border-radius: 1.25rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .submit-form-btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0.75rem 1.25rem;
    }

    .calendar-header {
        flex-direction: row; /* keep arrows beside month */
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .month-year { flex: 1; text-align: center; }
    .nav-arrow { width: 2.25rem; height: 2.25rem; }

    .month-year {
        font-size: 1.25rem;
    }

    .nav-arrow {
        width: 2rem;
        height: 2rem;
        font-size: 1.25rem;
    }

    .calendar-grid {
        gap: 0.25rem;
        min-height: 300px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        position: relative;
    }

    .day {
        min-height: 32px;
        padding: 0.25rem 0.125rem;
        font-size: 0.875rem;
        word-wrap: break-word;
        max-width: 100%;
        overflow: hidden;
    }

    .day-of-week {
        min-height: 28px;
        font-size: 0.875rem;
        overflow: hidden;
    }

    .event-dot {
        bottom: 2px;
        width: 3px;
        height: 3px;
    }

    .popup-content {
        padding: 1rem;
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        width: calc(100vw - 2rem);
        border-radius: 0.75rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        box-sizing: border-box;
    }

    .popup-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .popup-description {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    .popup-buttons {
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .add-to-calendar-btn,
    .delete-event-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px; /* Touch-friendly minimum height */
    }

    .event-details-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .popup-tags {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .event-tag {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
        min-height: 32px; /* Touch-friendly minimum height */
        display: flex;
        align-items: center;
    }

    .close-btn {
        top: 1rem;
        right: 1rem;
        font-size: 1.75rem;
        min-width: 44px; /* Touch-friendly minimum width */
        min-height: 44px; /* Touch-friendly minimum height */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .events-container {
        grid-template-columns: 1fr;
    }

    .map-image {
        max-width: 100%;
    }
}

/* Additional overflow prevention for calendar */
@media (max-width: 480px) {
    .calendar-header { flex-direction: row; gap: 0.5rem; margin-bottom: 0.75rem; }
    .month-year { flex: 1; text-align: center; }
    .nav-arrow { width: 2rem; height: 2rem; }
    body {
        overflow-x: hidden;
        width: 100%;
        padding: 0;
    }

    html {
        overflow-x: hidden;
        width: 100%;
    }
    
    .calendar-container {
        padding: 0.5rem;
        margin: 0;
        border-radius: 6px;
        box-sizing: border-box;
        overflow: visible; /* avoid clipping at very small heights */
        position: relative;
        width: 94vw;
        aspect-ratio: auto; /* let content define height */
        max-width: 100%;
        min-height: auto; /* let content define height */
    }
    
    .submit-event-section {
        max-width: 94vw;
        margin: 1rem auto;
        padding: 0 0.5rem;
        box-sizing: border-box;
    }
    
    .submit-event-form {
        padding: 1.5rem;
        border-radius: 1rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .submit-form-btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .calendar-grid {
        gap: 0.125rem;
        min-height: 250px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        position: relative;
    }
    
    .day {
        min-height: 28px;
        padding: 0.125rem;
        font-size: 0.75rem;
        word-wrap: break-word;
        max-width: 100%;
        overflow: hidden;
    }
    
    .day-of-week {
        min-height: 24px;
        font-size: 0.75rem;
        word-wrap: break-word;
        max-width: 100%;
        overflow: hidden;
    }
    
    .month-year {
        font-size: 1rem;
    }
    
    .nav-arrow {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 1rem;
    }

    /* Enhanced popup styles for very small screens */
    .popup-content {
        padding: 0.75rem;
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
        width: calc(100vw - 1rem);
        border-radius: 0.5rem;
        max-height: calc(100vh - 1rem);
    }

    .popup-title {
        font-size: 1.125rem;
        margin-bottom: 0.375rem;
    }

    .popup-date {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }

    .popup-description {
        font-size: 0.8rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }

    .event-details-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .popup-tags {
        gap: 0.375rem;
        margin-bottom: 0.5rem;
    }

    .event-tag {
        font-size: 0.65rem;
        padding: 0.25rem 0.6rem;
        min-height: 32px; /* Touch-friendly minimum height */
        display: flex;
        align-items: center;
    }

    .popup-buttons {
        gap: 0.5rem;
        margin-top: 0.75rem;
    }

    .add-to-calendar-btn,
    .delete-event-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 44px; /* Touch-friendly minimum height */
    }

    .close-btn {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.5rem;
        min-width: 44px; /* Touch-friendly minimum width */
        min-height: 44px; /* Touch-friendly minimum height */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .popup-location-container {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
}

/* Allow normal scrolling */
.calendar-page {
    max-width: 100vw !important;
}

.calendar-page * {
    max-width: 100% !important;
}

/* Calendar page specific overflow prevention */
.calendar-page {
    max-width: 100vw !important;
    overflow-x: hidden;
    width: 100%;
}

.calendar-page * {
    max-width: 100% !important;
}

.calendar-page main {
    max-width: 100%;
    overflow: visible; /* prevent inner scrolling; let body handle */
    width: 100%;
    height: auto;
}

.calendar-page .container {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* Comprehensive overflow prevention - overrides Tailwind */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

.calendar-page {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

.calendar-page main {
    overflow: visible !important; /* prevent inner scrolling; let body handle */
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

.calendar-page .container {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    height: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
}

.calendar-page .calendar-container {
    overflow: hidden !important;
    width: min(92vw, 1100px) !important;
    max-width: 1100px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.calendar-page .calendar-grid {
    overflow: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.calendar-page .day,
.calendar-page .day-of-week {
    overflow: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Main content area overflow prevention */
main.min-h-screen {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

main.min-h-screen .container {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
}

main.min-h-screen .container > div {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Header overflow prevention */
header {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

header nav {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

header .container {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Prevent navigation links from causing overflow */
header a {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}