/* RESET */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* VARIABLES */

:root {
    --color-grey: #9e9e9e;
    --color-grey-50: #fafafa;
    --color-grey-100: #f5f5f5;
    --color-grey-200: #eee;
    --color-grey-300: #e0e0e0;
    --color-grey-400: #bdbdbd;
    --color-grey-500: var(--color-grey);
    --color-grey-600: #757575;
    --color-grey-700: #616161;
    --color-grey-800: #424242;
    --color-grey-900: #212121;

    --color-red: #f44336;
    --color-red-50: #ffebee;
    --color-red-100: #ffcdd2;
    --color-red-200: #ef9a9a;
    --color-red-300: #e57373;
    --color-red-400: #ef5350;
    --color-red-500: var(--material-color-red);
    --color-red-600: #e53935;
    --color-red-700: #d32f2f;
    --color-red-800: #c62828;
    --color-red-900: #b71c1c;
    --color-red-a100: #ff8a80;
    --color-red-a200: #ff5252;
    --color-red-a400: #ff1744;
    --color-red-a700: #d50000;

    --color-blue: #2196f3;
	--color-blue-50: #e3f2fd;
	--color-blue-100: #bbdefb;
	--color-blue-200: #90caf9;
	--color-blue-300: #64b5f6;
	--color-blue-400: #42a5f5;
	--color-blue-500: var(--material-color-blue);
	--color-blue-600: #1e88e5;
	--color-blue-700: #1976d2;
	--color-blue-800: #1565c0;
	--color-blue-900: #0d47a1;
	--color-blue-a100: #82b1ff;
	--color-blue-a200: #448aff;
	--color-blue-a400: #2979ff;
	--color-blue-a700: #2962ff;
}

/* COMPONENTS */
button {
    border: none;
    background: transparent;
    padding: 0;
}

.icon-button {
    height: 40px;
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--color-grey-200);
    background-color: var(--color-grey-50);
    border-radius: 9px;

    & img {
        height: 18px;
    }

    &:hover {
        background-color: var(--color-grey-100);
    }
}

.delete-button img svg {
    fill: var(--color-red);
}

/* APP LAYOUT */

html {
    height: 100dvh;
}

body {
    height: 100%;
    font-family: system-ui;
    
}

main {
    height: 100%;
    display: flex;
    flex-direction: column;
    color: var(--color-grey-900);
    font-size: 16px;
}

.tabs {
    columns: 2;
    column-gap: 0;
    column-fill: balance;
    border-bottom: 1px solid var(--color-grey-200);
}

.tab {
    text-align: center;
    background-color: var(--color-grey-300);
    padding: 8px;
    font-weight: bold;

    &.active {
        background-color: white;
    }

    & span {
        font-size: 16px;
    }
}

.tab-panel {
    flex: 1;
    display: none;
}

.tab-panel.active {
    display: block;
}

.panels {
    display: flex;
    height: 100%;
}

/* TODO PANEL */
#todo-panel #todo-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#todo-panel ul {
    list-style-type: none;
    padding: 0;
}

#todo-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px;
    max-height: 64px;

    .action-buttons {
        display: flex;

        & button {
            margin-left: 8px;
        }
    }

    transition:
        max-height 200ms ease-in,
        border-bottom-width 200ms  ease-in,
        padding 200ms ease-in,
        opacity 200ms ease-in;

    > div:first-child {
        overflow: hidden;
        max-height: 40px;
        line-height: 20px;;
    }
}


#todo-list[data-show-hidden="false"] {
    & li[data-visibility="hidden"] {
        max-height: 0;
        overflow: hidden;
        padding-block: 0;
        opacity: 0;
        border-bottom-width: 0;
    }
}

#todo-list li[data-visibility="default"] .visibility-button {
    background-image: url('./icons/hide.svg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 18px 18px;
}

#todo-list li[data-visibility="hidden"] > * {
    opacity: 30%;
}

#todo-list li[data-visibility="hidden"] .visibility-button {
    background-image: url('./icons/show.svg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 18px 18px;
}

#todo-list li:not(:last-child) {
    border-bottom: 1px solid var(--color-grey-200);
}

#todo-list li span {
    line-height: 16px;
}

#todo-list li[data-status="done"] div:first-child {
    text-decoration-line: line-through;
    text-decoration-thickness: 2px;
}

#visibility-toggle-button {
    width: 100%;
    padding-block: 8px;
    font-size: 14px;
    color: var(--color-blue);
}

#visibility-toggle-button:hover {
    color: var(--color-blue-700);
}

#todo-input-form {
    border-top: 1px solid var(--color-grey-200);
    padding: 8px;
    display: flex;

    & input {
        border: none;
        flex: 1;
        margin-right: 8px;
        padding: 8px;
    }
}

@media screen and (display-mode: standalone) {
    #todo-input-form:has(input:not(:focus)) {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* NOTES PANEL */
#notes-panel {
    & textarea {
        background-color: var(--color-grey-50);
        height: 100%;
        width: 100%;
        border: 0;
        resize: none;
        outline: none;
        color: inherit;
        padding: 8px;
        font-family: monospace;
        display: block;
        line-height: 18px;
    }
}

/* ADJUSTMENTS FOR DESKTOP */
@media screen and (min-width: 1023px) {
    .tab-panel {
        display: block;
    }

    .tab-panel:not(:first-child) {
        border-left: 1px solid var(--color-grey-200);
    }

    .tab {
        background-color: white;
    }
}