* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    font-family: sans-serif; 
    background-image: url("background-goalstepper.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* ==============================================================
   Intro Overlay
   ============================================================== */
#intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: url("background-goalstepper.jpg");
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#intro-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    text-align: center;
    padding: 20px;
}

.intro-title {
    font-size: clamp(36px, 10vw, 60px);
    letter-spacing: 0.05em;
    animation: introFadeDown 1.2s ease both;
    color: #1a3340;
    font-family: "Goudy Old Style", Garamond, "Big Caslon", "Times New Roman", serif;
}

.intro-subtitle {
    font-family: 'Lucida Sans', Geneva, Verdana, sans-serif;
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    color: #1a3340;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    animation: introFadeDown 1.2s ease 0.3s both;
}

.intro-click-hint {
    font-family: 'Lucida Sans', Geneva, Verdana, sans-serif;
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: #1a3340;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0;
    animation: introFadeDown 1s ease 1.2s both, introPulse 2.5s ease 2.4s infinite;
}

@keyframes introFadeDown {
    from { opacity: 0; transform: translateY(-18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes introPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ==============================================================
   Navbar
   ============================================================== */
#navbar {
    color: #1a3340;
    padding: 10px;
    height: auto;
    min-height: 50px;
    text-align: center;
    font-family: "Goudy Old Style", Garamond, "Big Caslon", "Times New Roman", serif;
    font-size: clamp(18px, 4vw, 24px);
}

#header {
    height: 0;
}

/* ==============================================================
   Calendar Section
   ============================================================== */
#calendar-section { 
    flex: 1;
    display: flex; 
    flex-direction: column;
    font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    font-size: clamp(16px, 3vw, 30px);
    padding-bottom: 10px;
}

#calendar-section p {
    color: #1a3340;
}

#eventDisplayArea {
    margin: 20px auto;
    text-align: center;
    padding: 0 16px;
    font-size: clamp(13px, 3vw, 18px);
}

/* ==============================================================
   Buttons — Create & Last Minute
   ============================================================== */
.calendarBtn {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
}

.calendarBtn button {
    width: clamp(160px, 40vw, 250px);
    height: 50px;
    border-radius: 200px;
    background-color: rgb(233, 242, 216);
    box-shadow: 0px 3px 4px rgba(0, 0, 0, 0.2);
    border: 6px double rgb(226, 227, 176);
    text-align: center;
    transition: ease-in-out 0.3s;
    cursor: pointer;
    font-size: clamp(12px, 2.5vw, 16px);
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

.calendarBtn button:hover {
    background-color: rgb(190, 186, 115);
}

/* ==============================================================
   Week Navigation
   ============================================================== */
.weekNav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 0 16px;
}

.weekNav button {
    width: clamp(140px, 38vw, 250px);
    height: 46px;
    border: none;
    border-radius: 50px;
    background-color: rgb(233, 242, 216);
    box-shadow: 0px 3px 4px rgba(0, 0, 0, 0.2);
    border: 6px double rgb(226, 227, 176);
    text-align: center;
    transition: ease-in-out 0.3s;
    cursor: pointer;
    font-size: clamp(12px, 2.5vw, 16px);
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

.weekNav button:hover {
    background-color: rgb(190, 186, 115);
}

/* ==============================================================
   Modal Styles
   ============================================================== */
.modal-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(4, 1, 25, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s ease;
    z-index: 1000;
    padding: 16px;
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 28px;
    border-radius: 12px;
    background-color: rgb(15, 70, 148);
    box-shadow: 0px 3px 16px rgba(125, 207, 104, 0.25);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.form-header h2 {
    margin: 0;
    font-size: clamp(16px, 4vw, 22px);
    font-family: Georgia, 'Times New Roman', Times, serif;
    color: white;
}

.form-group {
    margin-bottom: 14px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #5f91a2;
    font-size: 14px;
}

.form-group input, 
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #040b34;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group input:focus, 
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2a9d8f;
    box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.time-row {
    display: flex;
    gap: 12px;
}

.time-row .form-group {
    flex: 1;
}

.modal-actions {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

.form-btn {
    min-width: 80px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    border: none;
    border-radius: 50px;
    transition: all 0.3s ease;
    color: #1a3340;
    background-color: rgb(233, 242, 216);
}

.form-btn:hover {
    color: rgb(133, 143, 50);
    background-color: rgba(224, 243, 181, 0.983);
}

.modal-actions button:hover {
    color: #333;
    background-color: hsl(66, 58%, 75%);
}

#createEvent.show,
#lastMinute.show {
    opacity: 1;
    pointer-events: auto;
}

/* ==============================================================
   Calendar Grid — scrollable wrapper
   ============================================================== */
#calendar-wrap {
    margin: 16px 10px;
    border: 6px double rgb(226, 227, 176);
    border-radius: 12px;
    /* KEY: horizontal scroll so grid never squashes */
    overflow-x: auto;
    overflow-y: auto;
max-height: 70vh;
    -webkit-overflow-scrolling: touch;
}

#calendar-grid {
    /* Minimum width keeps columns readable; scroll kicks in below this */
    min-width: 620px;
    width: 100%;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(25px);
}

.calendar-row {
    display: grid;
    grid-template-columns: 70px repeat(7, 1fr);
    position: relative;
}

.calendar-cell {
    border: 1px solid #1c114b;
    min-height: 52px;
    padding: 6px 4px;
    position: relative;
    overflow: visible;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
}

.calendar-header {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.time-header,
.time-label {
    font-size: 11px;
    background-color: #00000025;
    text-align: center;
}

.day-header {
    text-align: center;
    background-color: #00000025;
    font-size: 11px;
    line-height: 1.4;
}

.day-cell {
    position: relative;
    overflow: visible;
}

/* ==============================================================
   Event Blocks
   ============================================================== */
.event-block {
    background-color: hsl(57, 37%, 60%);
    transition: background-color 0.5s;
    color: white;
    border-radius: 4px;
    padding: 4px 5px;
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    z-index: 5;
    overflow: visible;
    min-height: 48px;
    cursor: pointer;
}

.event-block:hover {
    background-color: hsl(57, 37%, 75%);
}

.event-block-title {
    display: block;
    font-weight: 700;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-block-time {
    display: block;
    font-size: 10px;
    opacity: 0.85;
}

/* ==============================================================
   Event Popup (inside block)
   ============================================================== */
.event-popup {
    margin-top: 6px;
    color: inherit;
    font-size: 11px;
}

.event-popup-title,
.event-popup-detail {
    color: inherit;
    white-space: normal;
    font-size: 11px;
    margin-bottom: 3px;
}

.event-popup-actions {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.event-popup-actions button {
    flex: 1;
    min-width: 44px;
    padding: 4px 6px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: rgba(255,255,255,0.25);
    color: white;
    transition: background-color 0.2s;
}

.event-popup-actions button:hover {
    background-color: rgba(255,255,255,0.45);
}

/* ==============================================================
   Last Minute Event Blocks
   ============================================================== */
.last-minute-event {
    margin: 3px 2px;
    padding: 5px 6px;
    background-color: #b0dbb2;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: 0.2s ease-in-out;
    position: relative;
    overflow: visible;
}

.last-minute-event:hover {
    background-color: #9bd19e;
    transform: scale(1.02);
}

.last-minute-event strong {
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
}

/* ==============================================================
   Footer
   ============================================================== */
#footer-actions { 
    height: 80px; 
}

/* ==============================================================
   Phone — extra small tweaks (under 400px)
   ============================================================== */
@media (max-width: 400px) {
    .calendarBtn button,
    .weekNav button {
        width: 90%;
    }

    .modal {
        padding: 18px 14px;
    }

    #calendar-wrap {
        margin: 10px 4px;
    }
}
