<template>
    <section v-if="!addBool"
        :class="['template-checklist-information', darkMode ? 'section-darkmode' : 'section-lightmode']">
        <div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Checklist:</div>
        <table class="data-table" id="template-checkklist">
            <tbody>
                <tr :class="['table-row', darkMode ? 'tr-head-darkmode' : 'tr-head-lightmode']" id="table-head">
                    <th
                        :class="['Step', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Step-darkmode' : 'Step-lightmode']">
                        Step</th>
                    <th
                        :class="['Asset', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        Asset</th>
                    <th
                        :class="['Task', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        Task</th>
                    <th :class="['Comments', darkMode ? 'th-darkmode' : 'th-lightmode']">Comments</th>
                </tr>
                <tr v-for="todo in potTodos" :key="todo.primaryID"
                    :class="['table-row-data', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1">
                    <td
                        :class="['Step', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Step-darkmode' : 'Step-lightmode']">
                        {{ todo.rowID }}
                    </td>
                    <td v-if="!editable"
                        :class="['Asset', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        {{ todo.asset }}</td>
                    <td v-if="editable"
                        :class="['Asset', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        <select id="customersDropDownChosenCI" v-model="todo.asset" @change="updatePOTTodo(todo)"
                            :class="[darkMode ? 'select-darkmode' : 'select-lightmode']">
                            <option v-for="ci in configItemList" :key="ci.primaryID">
                                {{ ci.assetName }}
                            </option>
                        </select>
                    </td>
                    <td v-if="!editable"
                        :class="['Task', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        {{ todo.task }}</td>
                    <td v-if="editable"
                        :class="['Task', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        <input type="text" v-model="todo.task" @change="updatePOTTodo(todo)"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
                    </td>
                    <td :class="['Comments', darkMode ? 'td-darkmode' : 'td-lightmode']">
                        <textarea type="text" v-model="todo.comments" :readonly="!editable"
                            @change="updatePOTTodo(todo)"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']"> </textarea>                    
                        <button v-if="editable" :class="[darkMode ? 'deletePOTTodos-darkmode' : 'deletePOTTodos-lightmode']"
                            @click="deletePOTTodo(todo.primaryID)">-</button>
                    </td>
                </tr>
                <tr v-if="editable && addRow" :class="['table-row-data', darkMode ? 'tr-darkmode' : 'tr-lightmode']"
                    id="row-1">
                    <td
                        :class="['Step', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Step-darkmode' : 'Step-lightmode']">
                        {{ newStepTodo }}
                    </td>
                    <td
                        :class="['Asset', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        <select id="customersDropDownChosenCI" v-model="newAssetTodo"
                            :class="[darkMode ? 'select-darkmode' : 'select-lightmode']">
                            <option v-for="ci in configItemList" :key="ci.primaryID">
                                {{ ci.assetName }}
                            </option>
                        </select>
                    </td>
                    <td
                        :class="['Task', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        <input type="text" v-model="newTaskTodo"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
                    </td>
                    <td :class="['Comments', darkMode ? 'td-darkmode' : 'td-lightmode']">
                        <textarea type="text" v-model="newCommentsTodo"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']"> </textarea>
                        <button :class="[darkMode ? 'savePOTTodos-darkmode' : 'savePOTTodos-lightmode']"
                            @click="addPOTTodo()">Save</button> <button
                            :class="[darkMode ? 'deleteLastPOTTodos-darkmode' : 'deleteLastPOTTodos-lightmode']"
                            @click="deleteNewRow()">-</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </section>
    <section v-if="editable && !addBool" id="editPOTTodos">
        <button :class="[darkMode ? 'editPOTTodos-darkmode' : 'editPOTTodos-lightmode']"
            @click="addChecklistRow()">+</button>
    </section>
    <section v-if="addBool"
        :class="['template-checklist-information', darkMode ? 'section-darkmode' : 'section-lightmode']">
        <div :class="['label', darkMode ? 'label-darkmode' : 'label-lightmode']">Checklist:</div>
        <table class="data-table" id="template-checkklist">
            <tbody>
                <tr :class="['table-row', darkMode ? 'tr-head-darkmode' : 'tr-head-lightmode']" id="table-head">
                    <th
                        :class="['Step', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Step-darkmode' : 'Step-lightmode']">
                        Step</th>
                    <th
                        :class="['Asset', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        Asset</th>
                    <th
                        :class="['Task', darkMode ? 'th-darkmode' : 'th-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        Task</th>
                    <th :class="['Comments', darkMode ? 'th-darkmode' : 'th-lightmode']">Comments</th>
                </tr>
                <tr v-for="(newT, index) in newTodos" :key="index"
                    :class="['table-row-data', darkMode ? 'tr-darkmode' : 'tr-lightmode']" id="row-1">
                    <td
                        :class="['Step', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Step-darkmode' : 'Step-lightmode']">
                        {{ newT.rowID }}
                    </td>
                    <td
                        :class="['Asset', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Asset-darkmode' : 'Asset-lightmode']">
                        <select id="customersDropDownChosenCI" v-model="newT.asset"
                            :class="[darkMode ? 'select-darkmode' : 'select-lightmode']">
                            <option v-for="ci in configItemList" :key="ci.primaryID">
                                {{ ci.assetName }}
                            </option>
                        </select>
                    </td>
                    <td
                        :class="['Task', darkMode ? 'td-darkmode' : 'td-lightmode', darkMode ? 'Task-darkmode' : 'Task-lightmode']">
                        <input type="text" v-model="newT.task"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']">
                    </td>
                    <td :class="['Comments', darkMode ? 'td-darkmode' : 'td-lightmode']"> <textarea type="text"
                            v-model="newT.comments"
                            :class="['data', 'input', darkMode ? 'data-darkmode' : 'data-lightmode']"> </textarea>
                        <button :class="[darkMode ? 'deletePOTTodos-darkmode' : 'deletePOTTodos-lightmode']"
                            @click="deletePOTTodoFromNewTodos(index)">-</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </section>
    <section v-if="addBool" id="editPOTTodos">
        <button :class="[darkMode ? 'editPOTTodos-darkmode' : 'editPOTTodos-lightmode']"
            @click="addRowForNewPOT()">+</button>
    </section>
    <section v-if="addBool" id="saveNewPOT">
        <button :class="[darkMode ? 'saveNewPOT-darkmode' : 'saveNewPOT-lightmode']" @click="addPOT()">Save</button>
    </section>
</template>


<script setup>
import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js';
import clientsideConfig from '../../clientsideConfig.js';
import { useStore } from 'vuex';
import { computed } from 'vue';

const store = useStore();
const modeChanged = computed(() => store.state.updateDarkMode);

const addBool = computed(() => store.state.new);
const editable = computed(() => store.state.editable);

const newNamePOT = computed(() => store.state.newNamePOT);
const newCustomerIDPOT = computed(() => store.state.newCustomerIDPOT);
const newCustomerPOT = computed(() => store.state.newCustomerPOT);
const newLastViewPOT = computed(() => store.state.newLastViewPOT);
const newUserPOT = computed(() => store.state.newUserPOT);
const newDescriptionPOT = computed(() => store.state.newDescriptionPOT);
const newNotesPOT = computed(() => store.state.newNotesPOT);
const newStepTodo = computed(() => potTodos.value.length);
const chosenPOTId = computed(() => store.state.chosenPOTId);
const customerChanged = computed(() => store.state.customerChanged);
const changedCustomerId = computed(() => store.state.changedCustomerId);

const darkMode = ref('');
const addRow = ref(false);
const configItemList = ref([]);
const productionOrderTemplates = ref([]);
const potTodos = ref([])
const pot = ref({})
const newAssetTodo = ref('');
const newTaskTodo = ref('');
const newCommentsTodo = ref('');
const newTodos = reactive([]);
const newRowId = computed(() => newTodos.length)

// delete new todo row
const deleteNewRow = () => {
    newAssetTodo.value = '';
    newTaskTodo.value = '';
    newCommentsTodo.value = '';
    addRow.value = false;
}

const deletePOTTodoFromNewTodos = (index) => {
    newTodos.splice(index, 1);
    newTodos.forEach((todo, i) => {
        todo.rowID = i
    })
}

// add new production order template
const addPOT = async () => {
    // check if all input data is valid
    if (newNamePOT.value.trim() === "") {
        alert("Please add a production order template name!");
        return;
    } else {
        var counter = 0;
        if (!(productionOrderTemplates.value.length == null)) {
            // check if production order template name already exists
            productionOrderTemplates.value.forEach(pot => {
                if (pot.name === newNamePOT.value) {
                    counter += 1;
                }
            });
            if (counter == 1) {
                alert("This production order template name already exists. Please choose an unique production order template name or modify respectively delete the old one!");
                return;
            }
        }
    }
    if (newCustomerPOT.value.length === 0) {
        alert("Please choose a customer!");
        return;
    }
    let allFine = true;
    newTodos.forEach(todo => {
        if (todo.asset.length === 0) {
            alert(`Please choose a config item for all todos.`);
            allFine = false
        }
    })
    if (!allFine) {
        return
    }
    try {
        const response = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/addPOT`,
            {
                name: newNamePOT.value,
                customerID: newCustomerIDPOT.value,
                customer: newCustomerPOT.value,
                lastView: newLastViewPOT.value,
                user: newUserPOT.value,
                description: newDescriptionPOT.value,
                notes: newNotesPOT.value,
            });
        store.commit('resetStore');
        store.commit('changeToTemplatelist');
        newTodos.forEach(async todo => {
            try {
                const res = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/addTodoPOT`,
                    {
                        templateID: response.data,
                        rowID: todo.rowID,
                        asset: todo.asset,
                        task: todo.task,
                        comment: todo.comments,
                    });
            } catch (err) {
                console.log(err.response.statusText);
            }
        })
    } catch (err) {
        console.log(err.response.statusText);
    }
}

// add new row of todo for the new pot
const addRowForNewPOT = async () => {
    if (newCustomerPOT.value.length === 0) {
        alert("Please choose a customer first!");
        return;
    }
    await getConfigItemsFromCustomer();
    newTodos.push({
        templateID: chosenPOTId.value,
        rowID: newRowId.value,
        asset: '',
        task: '',
        comments: ''
    });
}

//update data
const updatePOTTodo = async (todo) => {
    if (todo.asset.length === 0) {
        alert(`Please add the missing config item in row ${todo.rowID}!`);
        return;
    }
    try {
        await Axios.put(
            `https://${clientsideConfig.url}:${clientsideConfig.port}/api/updatePOTTodo`,
            {
                primaryID: todo.primaryID,
                templateID: todo.templateID,
                rowID: todo.rowID,
                asset: todo.asset,
                task: todo.task,
                comments: todo.comments,
            }
        );
        await getPOTById();
    } catch (err) {
        console.log(err.response.statusText);
    }
}

// add new production order template todo
const addPOTTodo = async () => {
    // check if all input data is valid
    if (newAssetTodo.value.length === 0) {
        alert("Please choose an asset for the new todo!");
        return;
    }
    try {
        const response = await Axios.post(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/addTodoPOT`,
            {
                templateID: chosenPOTId.value,
                rowID: newStepTodo.value,
                asset: newAssetTodo.value,
                task: newTaskTodo.value,
                comment: newCommentsTodo.value,
            });
        addRow.value = false;
        await getPOTTodosById();
        newAssetTodo.value = '';
        newTaskTodo.value = '';
        newCommentsTodo.value = '';
    } catch (err) {
        console.log(err.response.statusText);
    }
}

// add new row for the template checklist
const addChecklistRow = async () => {
    await getConfigItemsFromCustomer();
    if (addRow.value) {
        alert('Please confirm the last added row first.')
        return
    }
    addRow.value = true
}

//get all production order templates
const getProductionOrderTemplates = async () => {
    try {
        const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getAllProductionOrderTemplates`);
        productionOrderTemplates.value = response.data;
    } catch (err) {
        console.log(err.response.statusText);
    }
}

// include delay to avoid 503 error
const triggerBackendCallsWithDelay = async (fetchDataFunc) => {
    setTimeout(() => {
        fetchDataFunc();
    }, 1000);
}

// get production order template todos from id
const getPOTTodosById = async () => {
    if (!addBool.value) {
        try {
            const response = await Axios.get(
                `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getTodosProductionOrderTemplate/${chosenPOTId.value}`
            );
            potTodos.value = response.data;
        } catch (err) {
            console.log(err.response.statusText);
        }
    }
}

//get all config items from the selected customer
const getConfigItemsFromCustomer = async () => {
    if (!addBool.value) {
        try {
            const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCIFromCustomer/${pot.value.customerID}`);
            configItemList.value = response.data;
        } catch (err) {
            console.log(err.response.statusText);
        }
    } else {
        try {
            const response = await Axios.get(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/getCIFromCustomer/${changedCustomerId.value}`);
            configItemList.value = response.data;
        } catch (err) {
            console.log(err.response.statusText);
        }
    }
    if (customerChanged.value) {
        store.commit('toggleCustomerChanged');
    }
}

// get production order template from id
const getPOTById = async () => {
    if (!addBool.value) {
        try {
            const response = await Axios.get(
                `https://${clientsideConfig.url}:${clientsideConfig.port}/api/getProductionOrderTemplate/${chosenPOTId.value}`
            );
            pot.value = response.data;
        } catch (err) {
            console.log(err.response.statusText);
        }
    }
    await getConfigItemsFromCustomer();
}

const deletePOTTodo = async (id) => {
    if (confirm("Do you really want to delete this production order template todo? It cannot be undone!")) {
        try {
            await Axios.delete(`https://${clientsideConfig.url}:${clientsideConfig.port}/api/deletePOTTodo/${id}`);
        } catch (err) {
            console.log(err.response.statusText);
        }
    }
    await getPOTTodosById();
}

const getSession = async () => {
    const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
    if (loggedInUserDarkModeBool == 1) {
        darkMode.value = true;
    } else {
        darkMode.value = false;
    }
}

function getItem(item) {
    if (process.client) {
        return localStorage.getItem(item)
    } else {
        return undefined
    }
}

// const inputValue = ref('');
// const widthMachine = computed(() => inputValue.value);

// function handleInput(event) {
//     inputValue.value = event.target.value;
// }

// // Textarea height handling
// const textareaValue = ref('');
// const textareaHeight = computed(() => calcHeight(textareaValue.value));

// function handleTextareaInput(event) {
//     textareaValue.value = event.target.value;
// }

// function calcHeight(value) {
//     const numberOfLineBreaks = (value.match(/\n/g) || []).length;
//     // min-height + lines x line-height + padding + border
//     const newHeight = 20 + numberOfLineBreaks * 20 + 12 + 2;
//     return newHeight;
// }

// const spanElement = ref(null);
// const computedHeight = ref('auto'); // Default height is 'auto'

// // Compute the height of the span element
// const computeSpanHeight = () => {
//     if (spanElement.value) {
//         computedHeight.value = spanElement.value.offsetHeight + 'px';
//     }
// };

// // Watch for changes in the content of the span element
// watch(() => textareaValue.value, () => {
//     computeSpanHeight();
// });

watch(customerChanged, getPOTById);
watch(modeChanged, getSession)

onMounted(async () => {
    getSession();
    await getPOTTodosById();
    await getPOTById();
    triggerBackendCallsWithDelay(getProductionOrderTemplates);
});
</script>

<script>
export default {
    name: "TemplateChecklist",
};
</script>


<style scoped>
.data {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 0 0.625rem;
    border-radius: 0.3125rem;
    box-shadow: 0.0625rem 0.0625rem 0.25rem 0rem rgba(0, 0, 0, 0.25) inset;
    letter-spacing: 5%;
    font: 400 0.75rem/250% Overpass, sans-serif;
}

/* .data-span {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 0 0.625rem;
    border-radius: 0.3125rem;
    box-shadow: 0.0625rem 0.0625rem 0.25rem 0rem rgba(0, 0, 0, 0.25) inset;
    letter-spacing: 5%;
    font: 400 0.75rem/250% Overpass, sans-serif;
} */

.section-darkmode {
    background-color: #2c2c2c;
}

.section-lightmode {
    background-color: #fff;
}

.data-darkmode {
    background-color: #212121;
    color: #fff;
}

.data-lightmode {
    background-color: #EBEBEB;
    color: #000;
}

.select-darkmode {
    border: none;
    color: white;
    background: #212121;
    padding: 0.4rem;
    border-radius: 0.3125rem;
}

.select-lightmode {
    border: none;
    color: black;
    background: #EBEBEB;
    padding: 0.4rem;
    border-radius: 0.3125rem;
}

.input {
    border: none;
}

.data-table {
    width: 100%;
    padding: 0 0.625rem;
    table-layout: fixed;
    border-collapse: collapse;
}

.table-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 3.125rem;
    padding: 0.625rem;
    gap: 0.625rem;
}

.table-row-data {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.625rem;
    gap: 0.625rem;
}

.tr-head-darkmode {
    border-top: none;
    border-bottom: 0.0625rem solid #000000;
}

.tr-head-lightmode {
    border-top: none;
    border-bottom: 0.0625rem solid #8e8e8e;
}

.tr-darkmode {
    border-top: 0.0625rem solid #000000;
}

.tr-lightmode {
    border-top: 0.0625rem solid #8e8e8e;
}

th,
td {
    height: 1.875rem;
    text-align: left;
    padding: 0;
    letter-spacing: 5%;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
}

td {
    height: 5rem;
}

th {
    font: 700 0.875rem/1.875rem Overpass, sans-serif;
}

.th-darkmode,
.td-darkmode {
    color: #ffffff;
}

.th-lightmode,
.td-lightmode {
    color: #000;
}

.template-checklist-information {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem 1.875rem;
    border-radius: 0.625rem;
    box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
}

.Step {
    width: 8%;
}

.Step-darkmode {
    border-right: 0.0625rem solid #000000;
}

.Step-lightmode {
    border-right: 0.0625rem solid #8e8e8e;
}

.Asset {
    width: 22%;
}

.Asset-darkmode {
    border-right: 0.0625rem solid #000000;
}

.Asset-lightmode {
    border-right: 0.0625rem solid #8e8e8e;
}

.Task {
    width: 35%;
}

.Task-darkmode {
    border-right: 0.0625rem solid #000000;
}

.Task-lightmode {
    border-right: 0.0625rem solid #8e8e8e;
}

.Comments {
    width: 35%;
    display: flex;
}

.label {
    width: 6.0625em;
    height: 1.875em;
    font-family: 'Overpass';
    font-style: normal;
    font-weight: 400;
    font-size: 1em;
    line-height: 1.875em;
    letter-spacing: 0.05em;
}

.label-darkmode {
    color: #FFFFFF;
}

.label-lightmode {
    color: #000;
}

.editPOTTodos-darkmode {
    background: #2c2c2c;
    color: #fff;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    padding: 0.825rem 0.7rem;
    width: 4%;
    border-radius: 0.625rem;
    box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
}

.savePOTTodos-darkmode {
    background: #212121;
    color: #fff;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 1rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}

.saveNewPOT-darkmode {
    background: #2c2c2c;
    color: #fff;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    padding: 1rem 1.875rem;
    width: 8%;
    border-radius: 0.625rem;
    box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
}

.deletePOTTodos-darkmode {
    background: #212121;
    color: #fff;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 6rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}

.deleteLastPOTTodos-darkmode {
    background: #212121;
    color: #fff;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 1rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}


.editPOTTodos-lightmode {
    background: #EBEBEB;
    color: #212121;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    margin-left: 15rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    border-radius: 0.625rem;
}

.savePOTTodos-lightmode {
    background: #EBEBEB;
    color: #212121;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 1rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}

.deletePOTTodos-lightmode {
    background: #EBEBEB;
    color: #212121;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 6rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}

.deleteLastPOTTodos-lightmode {
    background: #EBEBEB;
    color: #212121;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    border-radius: 0.625rem;
    margin-left: 1rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    height: 2.1rem;
    margin-top: 1.5rem;
}

.saveNewPOT-lightmode {
    background: #EBEBEB;
    color: #212121;
    font: 400 0.875rem/1.875rem Overpass, sans-serif;
    border: none;
    padding: 1rem 1.875rem;
    width: 8%;
    border-radius: 0.625rem;
    box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
}

.deletePOTTodos-darkmode:hover,
.deleteLastPOTTodos-darkmode:hover,

.savePOTTodos-darkmode:hover,
.editPOTTodos-darkmode:hover,
.saveNewPOT-darkmode:hover {
    background-color: #444444;
    cursor: pointer;
}

.deletePOTTodos-lightmode:hover,
.deleteLastPOTTodos-lightmode:hover,

.savePOTTodos-lightmode:hover,
.editPOTTodos-lightmode:hover,
.saveNewPOT-lightmode:hover {
    background-color: #ACACAC;
    cursor: pointer;
}

#saveNewPOT {
    text-align: center;
}

#editPOTTodos {
    text-align: right;
}

textarea {
    resize: none;
    width: 20rem;
    height: 5rem;
}
</style>