/* ********** Start of Universal Styling ********** */

* {
	margin: 0;
	box-sizing: border-box;
	font-family: "Poppins", sans-serif;
}

:root {
	--main-color: #f2f2f2;
	--secondary-color: #d1d8e3;
	--accent-color: #a8ceec;
	--task-list-color: white;
	--box-shadow: lightgrey;
	--input-shadow: #719ECE;

	--left-icon: url('../icons/left-icon.png');
	--right-icon: url('../icons/right-icon.png');

	color: black;
	--mode-color: black;
}

[theme="dark"] {
	--main-color: #121212;
	--secondary-color: #1c1c1c;
	--accent-color: #888888;
	--task-list-color: #1c1c1c;
	--box-shadow: #080808;
	--input-shadow: #d6d6d6;

	--left-icon: url('../icons/left-icon-dark.png');
	--right-icon: url('../icons/right-icon-dark.png');

	color: white;
	--mode-color: white;
}

html {
	height: 100%;
	overflow: hidden;
}

body {
	height: 100%;
	background-color: var(--main-color);
}

main {
	display: flex;
	overflow: hidden;
	height: 100%;
	position: relative;
}

/* Universal background color for buttons to clear */
button {
	background-color: rgba(0, 0, 0, 0);
	border: rgba(0, 0, 0, 1);
}

/* Remove outline around focused button */
button:focus {
	outline: none;
}

/* Change mouse cursor when hovering over button */
button:hover {
	cursor: pointer;
}

/* ********** End of Universal Styling **** */

/* ********** Start of Task List ********** */

.task-list {
	flex: 0 0 18%;
	max-width: 17rem;
	height: 100%;
	margin: 5px;
	padding: 1%;
	border-radius: 15px;
	background-color: var(--task-list-color);
	box-shadow: 3px 3px 3px var(--box-shadow);
	position: relative;
}

/* Hide scroll-bar for Chrome, Safari, Opera*/
.task-list::-webkit-scrollbar {
	display: none;
}

/* Formatting for the task list header */
.task-header {
	display: flex;

}

/* Wrapper for overflow of current tasks */
.task-wrapper {
	position: absolute;
	top: 44px;
	bottom: 0;
	width: 88%;
	overflow: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

/* Wrapper for overflow of completed tasks */
.completed-task-wrapper {
	position: absolute;
	bottom: 0;
	height: 82%;
	width: 96%;
	overflow: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

/* Aligns add button to right */
#addbutton {
	margin-left: auto;
}

/* Formatting for the add button */
#addbutton img {
	width: 25px;
	height: 25px;
	cursor: pointer;
}

/* Styling for task name */
.task-list .task-name {
	width: max(10em, 12vw);
	resize: none;
	margin-top: -4px;
	height: 24px;
	max-height: 108px;
	background-color: rgba(0, 0, 0, 0);
	border: rgba(0, 0, 0, 0);
}

/* New width when in completed task list */
.complete .task-name {
	width: max(14em, calc(10em + 13vw));
}

/* Hides bullets for list */
.task-list ul {
	list-style: none;
	padding: 0;
}

/* Sizing for each individual task */
.task {
	background: var(--main-color);
	padding: 10px;
	margin-top: 0.5em;
	margin-bottom: 0.5em;
	border-radius: 5px;
	position: relative;
	word-wrap: break-word;
	text-align: left;
	list-style-type: none;
	transition: max-height 0.5s ease-in;
	max-height: 4em;
}

/* Expands individual taskbox when hovered over */
.task:hover {
	max-height: fit-content;
}

/* Input box for task name */
.task-input {
	margin-left: 1.4em;
	margin-right: 0.6em;
	min-width: 80%;
	border: none;
	padding: 4px;

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Styling when editing a task */
.task:has(.task-input:focus) {
	max-height: fit-content;

	/* Make buttons appear */
	.color-buttons {
		opacity: 1;
	}

	.task-input {
		outline: 0px solid transparent;
		border: var(--accent-color) solid 1px;
		border-radius: 0.6em;
		box-shadow: 0 0 5px var(--input-shadow);

		word-break: break-all;
		
		-webkit-line-clamp: unset;
		-webkit-box-orient: unset;
		overflow: unset;
		text-overflow: unset;
	}
}

/* Set task placeholder */
.task-input:empty:before {
	content: attr(placeholder);
	pointer-events: none;
	display: block;

	color: #777;
}

/* Positioning for trash icon */
.trash-icon {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 18px;
	height: 18px;
	cursor: pointer;
}

/* Display buttons when hovering or actively editing */
.task:hover .color-buttons {
	opacity: 1;
}

/* Checkbox appearance */
.task-checkbox {
	position: absolute;
	top: 1.4em;
	appearance: none;
	margin: 0 10px 0 0;
	width: 16px;
	height: 16px;
	border: 2px solid var(--mode-color);
	border-radius: 50%;
	vertical-align: middle;
	cursor: pointer;
}

/* Formatting for check in checkbox */
.task-checkbox img {
	height: 15px;
	margin-left: -6px;
}

/* Change to indicate task was completed */
.complete .task-checkbox {
	background: var(--mode-color);
}

/* Default set up for color buttons */
.color-buttons {
	opacity: 0;
	transition: opacity 0.3s ease;
	max-height: 5em;
	display: flex;
	justify-content: space-around;
	margin-top: 5px;
}

/* Size, shape, and color of each color button */
.color-button {
	width: 15px;
	height: 15px;
	border-radius: 100%;
	border: solid grey 1px;

	&#purple {
		background-color: #C380CC;
	}

	&#green {
		background-color: #91DC79;
	}

	&#blue {
		background-color: #6BB1D9;
	}

	&#pink {
		background-color: #EEBAE9;
	}

	&#grey {
		background-color: var(--main-color);
	}
}

/* ********** End of Task List ********** */

/* ********** Start of Main Wrap ******** */

/* Container of top bar, journal, feeling widgets, completed tasks, and past week */
.main-wrap {
	flex: 1;
	position: relative;
	float: left;
	height: 100%;
}

/* ========== Start of top bar ========== */

/* Container of prev/next buttons, current date, and homepage-calendar buttons */
.top-bar {
	position: relative;
	height: 10%;
	min-height: 65px;
}

.date-header-wrap {
	position: absolute;
	height: max(30%, 5rem);
	height: 100%;
	width: min(70em, 100%);
	width: 100%;
	display: grid;
	grid-template-columns: 1fr 1fr;
}

/* Container of prev/next buttons, current date */
.date-header {
	display: grid;
	grid-template-columns: 1fr 8fr;
	margin-left: 1.1em;
	position: absolute;
	bottom: 0;
	width: 50%;
	max-width: 40em;
}

/* Container of the previous and next day buttons*/
.date-header-buttons {
	display: grid;
	grid-template-columns: 1.2em 1fr;
	margin-top: auto;
	margin-bottom: min(0.6em, 14%);
	margin-left: 0.4em;
}

.prev-date-btn {
	width: 2em;
	height: 2em;
	border-radius: 4em;
	background-image: var(--left-icon);
	background-size: 14px 14px;
	background-repeat: no-repeat;
	background-position: center;
	background-position: 4px;
}

.next-date-btn {
	width: 2em;
	height: 2em;
	margin-left: 0.4em;
	border-radius: 4em;
	background-image: var(--right-icon);
	background-size: 14px 14px;
	background-repeat: no-repeat;
	background-position: center;
	background-position: 8px;

}

/* Change button background color when hovering over prev/next buttons */
.date-header-buttons button:hover {
	background-color: var(--secondary-color);
}

.date-header-text {
	width: 100%;
	margin-top: auto;
	margin-bottom: 0em;
	margin-left: 0.2em;
	white-space: nowrap;
	font-size: calc(1.4em + .7vw);
}

.nav-buttons {
	position: absolute;
	top: 0.6em;
	right: 2em;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 1em;
}

.nav-buttons button img {
	width: min(3.4em, 4vw);
	min-width: 2.6em;
	padding-left: 0em;
	padding-right: 0em;
}

/* ============== End of Top Bar =========== */


/* ============ Begin Entry Content ========= */

/* Container of journal, feeling widgets, completed tasks, and past week */
.journal-past-wrap {
	width: 100%;
	min-width: 40rem;
	height: 86%;
	max-width: 94.4rem;
}

/* Container of journal, feeling widgets, completed tasks, and past week */
.today-entry {
	width: min(66rem, 100%);
	height: 78%;
	padding-right: min(2rem, 3%);
	padding-left: min(2.1rem, 3%);
}

/* ============== Start of Journal ========== */

.journal {
	height: 60%;
}

.journal-entry {
	height: 94%;
	margin-top: 0.4%;
	margin-right: 2em;
	margin-bottom: 1rem;
	padding: 0.4em 1em 0.4em 1em;
	background-color: var(--secondary-color);
	border-radius: 1em;
}

.journal-entry #textarea {
	width: 100%;
	height: 90%;
	margin-bottom: 1em;
	padding-top: 0.2em;
	padding-left: 0.4em;
	background: var(--secondary-color);
	border: none;
	border-radius: 1em;
	resize: none;
	color: var(--mode-color);
}

/* Highlight journal when clicked on */
.journal-entry #textarea:focus {
	outline: none !important;
	border: 1px solid var(--accent-color);
	box-shadow: 0 0 10px var(--input-shadow);
}

/* =========== End of Journal ========= */

/* === Start of Rating and Completed Task ===== */

/* Container of rating and completed tasks */
.rating-completed-wrap {
	position: relative;
	height: 40%;
}

.rating-completed-wrap h4 {
	text-align: center;
	font-size: max(calc(0.7em + 0.4vw), 15px);
}

.rating-widget {
	position: absolute;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	align-items: center;
	justify-content: center;
	left: 0;
	width: min(50%, 33rem);
	height: 100%;
	background-color: var(--secondary-color);
	border-radius: 1em;
	padding: min(1.5em, 5%);
	padding-right: min(0.8em, 5%);
	padding-left: min(0.8em, 5%);
	padding-top: min(1em, 5%);
	box-shadow: 3px 3px 3px var(--box-shadow);
}

.rating-widget::-webkit-scrollbar {
	display: none;
}

.rating-widget button img {
	height: max(min(3em, 6vw), 50px);
	height: min(50px, 8vw);
	transition: 0.3s ease;
	border-radius: 50%;
}

/* Highlight current hovered feelings button */
.rating-widget button img:hover {
	transform: scale(1.2);
	background: radial-gradient(circle, rgb(3, 128, 237) 0%, rgba(0, 0, 0, 0) 100%);
	transition: 0.1s ease-in-out;
}

/* Highlight current selected feelings button */
.rating-widget img.active,
.rating-widget img.active:hover {
	background-color: #008FC6;
	transition: 0.1s ease;
}

.feelings {
	display: flex;
	justify-content: center;
	gap: 0em;
	padding-top: calc(0.4em - 1.2vw);
	padding-bottom: min(calc(2.2em - 1.8vw), 1.3em);
	padding-bottom: calc(0.4em - 1.2vw);
	padding: 0;
}

.productiveness {
	display: flex;
	justify-content: center;
	gap: 0.1em;
	padding-top: calc(1em - 1vw);
}

/* Completed List */
.journal-past-wrap .task-list {
	position: absolute;
	right: 2em;
	width: min(44%, 30rem);
	height: 100%;
	margin: 0;
	max-width: none;
	background-color: var(--secondary-color);
	border-radius: 1em;
	transform: none;
}

/* === End of Rating and Completed Task ===== */

/* ========== End Entry Content ========= */

/* ======== Start of Past Week ========== */

/* Container for past week */
.past-week-wrap {
	margin-top: 2%;
	margin-right: 5%;
	margin-left: 2%;
	height: 19%;
	font-size: min(14px, 4vw);
}

.past-week-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
	width: min(78rem, 100%);
	height: min(12em, 80%);
	padding-top: max(1.5rem, 3.5vh);
	padding-bottom: max(1.5rem, 3.5vh);
	;
	padding-left: 1em;
	padding-right: 3em;
}

.past-day {
	border: var(--mode-color) solid 2px;
}

/* Calendar Table Styling */
.table-week {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	margin: 0;
	height: 100%;
	min-width: 40rem;
	font-size: min(16px, 1vw);
}

/* Calendar Data Cell Styling */
.table-week td {
	position: relative;
	border: 3px solid #777;
	padding: 0;
}

/* Calendar date */
td .cell-date {
	position: absolute;
	top: 0;
	left: 2px;
}

/* Sentiment icon */
td .sentiment-icon {
	position: absolute;
	top: 2px;
	right: 5px;
	height: 18px;
}

/* Productivity icon */
td .productivity-icon {
	position: absolute;
	top: 2px;
	right: 24px;
	height: 18px;
}

/* Task div in calendar cell */
td .task-div {
	position: absolute;
	top: 24px;
	justify-content: space-between;

	width: 96%;
	height: 78%;
}

/* Unordered list in calendar cell */
.task-ul {
	margin: 0;
	padding-left: 6px;
	color: var(--mode-color);
	font-size: 12px;
	line-height: 1;
}

/* Individual tasks in calendar cell */
.task-item {
	list-style-position: inside;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Extra tasks in calendar cell */
.task-indicator {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	padding-top: 7px;
	font-weight: bolder;
}

/* Individual tasks in calendar cell */
.task-item::marker {
	color: var(--task-color, "black");
	font-size: 1.5em;
}

/* Button links to specific homepage in calendar cell */
.a-link {
	position: absolute;
	height: 100%;
	width: 100%;
	top: 0;
	left: 0;
	z-index: 10;
}

/* Highlight boxes when hovering over specific calendar cell */
.a-link:hover {
	background-color: skyblue;
	opacity: 0.3;
}

/* ======== End of Past Week ========== */

/* ******** End of Main Wrap ********** */

/* ****** Start of Responsiveness ****** */

/* Add scroll bar to rating wiget when screen height is small */
@media (max-height: 740px) {
	.rating-widget {
		overflow: auto;
	}
}

/* Slide task bar offscreen when screen width is small */
@media (max-width: 740px) {
	main {
		overflow-x: scroll;
	}

	.task-list {
		flex: 0 0 25%;
		z-index: 100000;
		transition: transform 0.3s ease;
		transform: translateX(-88%);
	}

	.task-wrapper {
		display: none;
	}

	.task-wrapper.active {
		display: block;
	}

	.main-wrap {
		position: absolute;
		left: 3%;
		bottom: 0;
		top: 0;
		right: 0;
	}

	.task-list.active {
		transform: translateX(0%);
	}

	.journal-past-wrap {
		display: block;
	}

	.rating-widget h4 {
		font-size: 12px;
	}

	.rating-widget {
		overflow: auto;
	}

	.table-week {
		font-size: 10px;
	}
}

/* ****** End of Responsiveness ****** */