@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap");

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: hsl(227, 75%, 14%);
    --secondary-color: hsl(200, 60%, 99%);
    --text: hsl(226, 11%, 37%);
    --white: hsl(200, 60%, 99%);
    --accent: hsl(3, 77%, 44%);
    --accent-2: hsl(3, 71%, 56%);
    --btn-background: hsl(0, 0%, 78%);
    --theme-switch-bg: hsl(0, 0%, 92%);
    --neutral: hsl(0, 0%, 78%);
    --focus: hsl(3, 71%, 56%);

    --gradient: linear-gradient(180deg, #ebf2fc 0%, #eef8f9 100%);
}

.dark-theme {
    --gradient: linear-gradient(180deg, #040918 0%, #091540 100%);
    --primary-color: hsl(200, 60%, 99%);
    --secondary-color: hsl(226, 25%, 17%);
    --accent: hsl(3, 86%, 64%);
    --accent-2: hsl(3, 77%, 44%);
    --text: hsl(0, 0%, 78%);
    --neutral: hsl(226, 11%, 37%);
    --btn-background: hsl(226, 11%, 37%);
    --theme-switch-bg: hsl(225, 23%, 24%);
}

body {
    background: var(--gradient);
    font-family: "Noto Sans";
    min-height: 100vh;
}

.container {
    max-width: 90%;
    width: 100%;
    margin: 2.5em auto;
    padding: 0 2em;
}

header {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--secondary-color);
    border-radius: 18px;
    padding: 1em 0.9em;
}

.logo {
    position: relative;
    display: flex;
    align-items: center;
}

.logo svg path {
    fill: var(--accent);
}

.logo span {
    position: absolute;
    left: 52px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.theme-toggle {
    padding: 1em;
    border: none;
    border-radius: 12px;
    background: var(--theme-switch-bg);
    display: flex;
    align-items: center;
    cursor: pointer;
}

.theme-toggle:focus-visible {
    outline: 1px solid var(--focus);
}

.theme-toggle:hover {
    background: var(--btn-background);
}

.theme-toggle img:last-child {
    display: none;
}

.dark-theme .theme-toggle img:first-child {
    display: none;
}

.dark-theme .theme-toggle img:last-child {
    display: block;
}

.dark-theme button:focus-visible {
    background: var(--neutral);
}

.list {
    display: flex;
    font-size: 34px;
    font-weight: 700;
    justify-content: space-between;
    align-items: center;
    margin: 1.75em 0 1em;
}

.list p {
    color: var(--primary-color);
}

.buttons {
    list-style-type: none;
    display: flex;
    color: var(--primary-color);
}

.buttons button {
    font-size: 1.3rem;
    font-weight: 500;
    padding: 0.4em 0.95em;
    border: none;
    border-radius: 25px;
    background: var(--secondary-color);
    margin-inline: 0.3em;
    color: var(--primary-color);
    cursor: pointer;
}

.buttons button:focus-visible {
    outline: 2.5px solid var(--focus);
    outline-offset: 3px;
}

.buttons button:hover {
    opacity: 0.7;
}

.dark-theme .buttons button:hover {
    background: var(--neutral);
    opacity: 1;
}

.buttons .selected {
    background: var(--accent) !important;
    color: var(--secondary-color);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 15px;
    margin: 0 auto;
    justify-content: center;
}

.card {
    background: var(--secondary-color);
    padding: 1.1em;
    box-shadow: 0px 0px 1px 1px var(--neutral);
    border-radius: 15px;
}

.top {
    display: flex;
    align-items: flex-start;
    margin-bottom: 3em;
}

.bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top img {
    margin-right: 1em;
}

.name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3em;
    color: var(--primary-color);
}

.description {
    font-size: 1rem;
    color: var(--text);
    letter-spacing: -0.03em;
}

.remove {
    padding: 0.4em 0.85em;
    background: none;
    border: none;
    outline: 1px solid var(--neutral);
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
}

.remove:focus-visible {
    outline: 2.5px solid var(--focus);
    outline-offset: 2px;
    border: none;
    background: var(--theme-switch-bg);
}

.remove:hover {
    background: var(--accent);
    color: var(--secondary-color);
    outline: none;
}

.toggle {
    position: relative;
    border: none;
    width: 36px;
    height: 20px;
    /*border: 1px solid red;*/
    border-radius: 10px;
    /*opacity: 0;*/
}

.toggle label {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    /*border: 1px solid green;*/
    cursor: pointer;
}

.toggle input {
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: var(--btn-background);
    border-radius: 10px;
}

.toggle input:focus-visible+.slider {
    outline: 2.5px solid var(--focus);
    outline-offset: 2.5px;
}

.slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--white);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 400ms;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: var(--accent);
}

input:checked+.slider::before {
    transform: translateX(16px);
}

@media only screen and (max-width: 500px) {
    .container {
        padding: 0em;
        margin: 1.3em auto;
    }

    header {
        height: 65px;
        border-radius: 8px;
    }

    .list {
        margin: 1em 0 1em;
        flex-direction: column;
        gap: 15px;
        align-items: center;
        justify-content: center;
    }

    .top {
        margin-bottom: 2em;
    }
}