body {
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
    padding:0%;
    margin:0%;
    background-image: url('images/glob.gif');
    background-size: cover;
}

.tile {
    position: relative;
    background-color: white;
    border: 2px solid black;
    width: 100%;
    max-height: fit-content;
    box-sizing: border-box;
    aspect-ratio: 1 / 1; /*makes tiles square*/
    border-radius: 4px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0%;
    margin: 0%;
    display:flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
}


.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
}

.tileItems {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 80%;   /*bottom 80% of tile*/
    overflow-y: hidden;
    scroll-behavior: smooth;
}

.tileItems:hover {
    overflow-y: none;
}




.item {
    background-color: rgb(67, 143, 67);
    width: 90%;
    height: 20%;
    border-radius: 4px;
    flex-shrink: 0;
    margin: 2px 0;
    position: relative;
    font-size: 12px;
    text-indent: 2px; /*used text-indent because padding messed with box display*/    
}

/* applies to any deleteBtn inside of item, no matter the depth */
.item .deleteBtn{
    position: absolute;
    right: 2px;
    top: 2px;
    background-color: aquamarine;
    color: black; /*text color*/
    font-size: 7px;
    height: 10px;
    width: 10px;
    border-radius: 50%;
    padding: 1px;
}

.dayNum {
    padding:0%;
    margin: 0%;
    position: absolute;
    top: 0px;
    left: 0px;
}

.tileGroup{
    display: grid;
}

.weekdayRowDiv {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /*7 columns side-by-side*/
    text-align: center;
    color:white;
    background-color: rgba(0, 0, 0, 0.25);
    width: 100%;
    padding:0px;
    margin:0px;
}

.weekday{
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0px 0;
    margin: 0px;
   
}

.monthOfYear{
    color:white;
    text-align: center;
    padding:0px;
    margin:0px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    /*-webkit-text-stroke: 1px black; is also cool */
}


.calendar{
    opacity:100%;
    position:relative;
}


#sidePanel{
    pointer-events: none;/*not clickable when hidden*/
    position: relative;
    flex:1;
    background-color: white;
    opacity:0;
    text-align: center;
    color:white;
    padding:0px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

#sidePanel.active {
    opacity: 1;
    pointer-events: auto; /*clickable when visible*/
}


#eventFormWrapper{
    background-color:rgba(0, 0, 0, 0.8);
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width:50%;
    height:50%;
    border-radius: 15px;
    text-align: center;
    justify-content: center;
    display:none;
}

#addEventTitle{
    font-size: 30px;
    color:hotpink;
}


/*dropdown*/
#addEventType {
    width: 60%;
    padding: 10px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    
}

#addEventType:hover {
    border-color: #2196f3;
}

.taskForm{
    display: none;
}


#addEventTitle {
    color: #1976d2;
    font-size: 20px;
    margin-bottom: 15px;
}

input[type="text"] {
  width: 70%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid #bbb;
  font-size: 15px;
  text-align: center;
  transition: all 0.2s ease-in-out;
}

input[type="text"]:focus {
  border-color: #42a5f5;
  box-shadow: 0 0 5px rgba(66, 165, 245, 0.4);
  outline: none;
}

#formButtons {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
}

#saveEvent, #saveAlarm, #closeForm {
  background: #2196f3;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s ease-in-out, transform 0.1s ease-in-out;
  min-width: 100px;
}

#saveEvent:hover, #saveAlarm:hover {
  background: #1976d2;
  transform: scale(1.03);
}

#closeForm {
  background: #ef5350;
}

#closeForm:hover {
  background: #d32f2f;
  transform: scale(1.03);
}

#saveAlarm {
  display: none;
}

#calendarHeader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
}

#calendarHeader button {
    background:none;
    -webkit-text-stroke: 1px black; /* proper vendor prefix */
    -moz-text-stroke: 1px black;    /* Firefox support */
    color: white;
    border: none;
    padding: 0;
    font-size: 3rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-shadow:
        -1px -1px 0 black,
         1px -1px 0 black,
        -1px  1px 0 black,
         1px  1px 0 black; /* 4-way stroke */
    transition: transform 0.2s, color 0.2s;
}

#calendarHeader button:hover {
    transform: scale(1.1);
    color: #1ae9f0;
}

#closePanel{
    position:absolute;
    top:10px;
    right:10px;
    width:30px;
    height:30px;
    border-radius: 50%;
}


    #addEvent {
        border-radius: 50%;
        width: 50px;
        height: 50px;
        position: absolute;
        bottom: 5%;
        right: 5%;
        background-color: green;
        cursor: pointer;
        
        box-shadow: 5px 5px 20px rgba(0, 0, 0, 1); /*x, y, darkness*/
        transition: transform 0.25s ease, box-shadow 0.25s ease, width .25s ease, height .25s ease;
    }



















/*for pc */
@media (min-width: 1024px) {
    body {
        display: flex;
        flex-direction: row; /* ensures side-by-side layout */
        align-items: center; /* vertical centering */
        justify-content: center;
        height: 100vh; /* needed for vertical centering */
        margin: 0;
        padding: 0;
        column-gap: .75vw; /* small consistent gap */
        padding-right: 1vw;
    }

    .calendar {
        position: relative;
        height: 90vh;
        width: 90vh;
        display: grid;
        grid-template-rows: auto auto 1fr;
        margin-left: 1vw;
        padding: 0;
        flex-shrink: 0;
    }
    
    #sidePanel {
        flex: 0 0 0;
        width: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: flex 0.35s ease, width 0.35s ease, opacity 0.2s ease;
    }


    #sidePanel.active {
        flex: 1;              /* take all leftover space */
        width: auto;          /* let flexbox decide */
        height: 90vh;
        opacity: 1;
        pointer-events: auto;
    }


    #sidePanelTitle{
        margin: 0;
        padding: 3vh;
        position: relative;
        top:0px;
    }



    #addEvent:hover {
        transform: translateY(-1px);
        width:52px;
        height:52px;
    }

    .monthOfYear {
        flex: 0 0 auto;
        margin: 0;
        padding: .75em 0;
    }

    .weekdayRowDiv {
        grid-template-columns: repeat(7, 1fr);
        margin: 0;
        padding: 0;
    }

    .weekday {
        display: flex;
        margin: 0;
        padding: 0.25em 0;
    }

    .tileGroup {
        grid-template-columns: repeat(7, 1fr);
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .tile {
        aspect-ratio: 1 / 1; /* keep square */
        margin: 0;
        padding: 0;
    }
}

/*for tablet */
@media (min-width: 481px) and (max-width: 1023px) {

    body, html {
        height: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        min-height: 100vh;
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center;
        overflow: hidden;
    }

    .calendar {
        width: 90vw;
        height: 90vw;
        max-height: 90vh;
        max-width: 90vh;
        margin: 0 auto;
        padding: 0;
        display: grid;
        grid-template-rows: auto auto 1fr;
    }

    .weekdayRowDiv {
        width: 100%;
    }

    .tileGroup {
        position: relative;
        width: 100%;
        grid-template-columns: repeat(7, 1fr);
    }

    .tile {
        aspect-ratio: 1 / 1;
    }

    .monthOfYear {
        padding: 0.75em 0;
    }

    #sidePanel {
        position: fixed;       /* always fixed at the bottom */
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: white;
        height: 35vh;          /* default height */
        transition: height 0.35s ease; /* smooth expand/collapse */
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2); /* subtle shadow on top */
        overflow: auto;        /* scroll if content overflows */
    }

    #sidePanel.expanded {
        position:fixed;
        height: 70vh;
    }
    #sidePanel.contracted {
        height: 35vh;
    }
}



/*for phone */
@media (max-width: 480px){
    body, html{
        height:100%;
        margin:0;
        padding:0;
    }
    html {
        overflow-x: hidden; /*prevents horizontal scrolling (need both)*/
    }
    body{
        overflow-x: hidden; /*prevents horizontal scrolling (need both)*/
        width: 100vw;
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center;
    }
    .calendar{
        top:0%;
        width: 100%;
        max-width: 100vw;
        background-color: opaque 50;
    }

    .weekdayRowDiv{
        width:100%;
    }

    .tileGroup{
        position:relative;
        width:100%;
        grid-template-columns: repeat(7, 1fr); /* 7 columns for calendar */
        
    }
    
    .tile{
        aspect-ratio: 1 / 1.25; /* keep square */
    }

    .monthOfYear {
        padding: 0.5em 0;
    }

    #sidePanel{
        position: fixed;    /*overlap everything*/
        bottom: 0;
        left: 0;
        width: 100%;
        margin: 0px;
        opacity: 0.9;
        background-color: white;
        height: 35vh;
        transition: height 0.35s ease;
        z-index: 999;    /*makes sure it overlaps calendar*/
    }

    #sidePanel.expanded {
        height: 70vh;
    }
    #sidePanel.contracted {
        height: 35vh;
    }

    .item {
        font-size: 8px;
    }

    .item .deleteBtn{
    right: 1px;
    top: 1px;
    font-size: 5px;
    height: 8px;
    width: 8px;
    }
}







