@view-transition {
    navigation: auto;
}

:root {
    --error: hsl(11 87 48);
    --toggle-green: hsl(128 90 45);
    --toggle-red: hsl(351 91 56);
}

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

.htmx-indicator {
    opacity: 0;
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
    display: block;
    transition: opacity 200ms ease-in;
    transition-behavior: allow-discrete;
}


.htmx-request .indicating-hide,
.htmx-request.indicating-hide {
    opacity: 0;
    display: none;
    transition: opacity 200ms ease-in;
    transition-behavior: allow-discrete;
}


body {
    overflow-y: scroll;
    font-size: 18px;
    margin: 0;
}


/* site header styles */

.site-header {
    border-bottom: 1px solid black;

    div {
        height: 48px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

main > div:first-of-type {
    padding-top: 1rem;
}

section {
    margin-bottom: 1rem;
}


.wrapper {
    max-width: 500px;
    margin: auto;
}

@media screen and (max-width: 600px) {
    .wrapper {
        padding-inline: 0.5rem;
    }
}

.page-header,
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid black;
}

.page-header {
    margin-bottom: 2rem;
}

.section-header {
    margin-bottom: 1rem;
}




.list-header {
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.example {
    margin: 0;
}

form {
    display: grid;
    
    .input-group {
        display: flex;
        flex-direction: column;
        margin: 0 0 0.5rem 0;
    }

    li {
        display: flex;
        justify-content: space-between;
        padding: 0;
        list-style-type: none;
        margin-bottom: 1rem;
    }

    li > input {
        flex-grow: 1;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    li > button {
        width: 50px;
        padding-inline: 0.5rem;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    label {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding-block: 0.5rem;
        display: flex;
        width: 100%;
        justify-content: space-between;
    }

    input {
        border: 1px solid black;
        padding: 0.5rem;
        border-radius: 0.25rem;
        font-size: 16px;
    }

    label.toggle {
        flex-direction: row;
        border-bottom: 1px solid black;
    }

    label.quantity {
        align-items: center;
        margin-bottom: 1rem;
        border-bottom: 0;
    }

    label.quantity > input {
        text-align: right;
        padding-block: 0.25rem;
        padding-inline: 0.5rem;
    }

    label:last-of-type {
        border-bottom: 0;
    }
    
    .toggle input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .track {
        display: inline-block;
        width: 44px;
        height: 24px;
        border-radius: 12px;
        background-color: var(--toggle-red);
        position: relative;
        transition: background-color 0.2s ease-in;
    }

    .track::after {
        content: "";
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: white;
        position: absolute;
        top: 2px;
        left: 2px;
        transition: transform 0.2s;
    }

    .toggle input:checked + .track {
        background-color: var(--toggle-green);
    }

    .toggle input:checked + .track::after {
        transform: translateX(20px);
    }

    .error {
        height: 16px;
        color: var(--error);
        text-align: right;
        font-size: 14px;
    }

    #teams-button {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 48px;
        margin: 1rem 0 0 0;
    }

    button {
        display: block;
        padding-block: 0.5rem;
        border: 1px solid black;
        background-color: black;
        border-radius: 0.25rem;
        color: white;
        text-decoration: none;
        font-size: 1rem;
        cursor: pointer;
        transition: 
            background-color 100ms ease-in,
            color 100ms ease-in;
    }

    button:hover {
        background-color: rgb(26, 25, 25);
    }

    button:active {
        background-color: rgb(51, 51, 51);
    }

    button:disabled {
        cursor: not-allowed;
        opacity: 0.7;
    }
    
}

.flexform {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

/* Media query for screens larger than typical mobile phones */
@media screen and (min-width: 400px) {
    form {
        #teams-button {
            position: static; /* Button no longer fixed at bottom */
            width: auto;
            height: auto;
            margin-top: 1rem;
        }
    }
}


/* class-list styles */

.class-list {
    padding: 0;
    list-style-type: none;

    li {
        display: flex;
        justify-content: space-between;
        padding-block: 0.5rem;
        border-bottom: 1px solid black;
    }

    li:last-of-type {
        border-bottom: none;
    }

   
    .add-btn {
        justify-content: end;
    }
    .add-btn > a {
        display: block;
        place-self: right;
        padding-block: 0.25rem;
        padding-inline: 1rem;
        border: 1px solid black;
        border-radius: 0.25rem;
        color: black;
        text-decoration: none;
        
    }

    .add-btn > a:hover {
        background-color: rgb(22, 22, 22);
        color: white;
    }

    .add-btn > a:active {
        background-color: rgb(59, 59, 59);
    }
}

.button-group {
    display: flex;
    gap: 0.5rem;

    button {
        background: none;
        border: none;
        padding-inline: 0.5rem;
        padding-block: 0.25rem;
        border: 1px solid;
        border-radius: 0.25rem;
        cursor: pointer;
    }

    .edit {
        background-color: white;
        color: black;
        border-color: black;
    }

    .edit:hover {
        background-color: black;
        color: white;
    }

    .delete {
        background-color: var(--error);
        color: white;   
        border-color: var(--error);
    }

    .delete:hover {
        background-color: red;

    }
}
#student-list {
    margin-bottom: 0;
}

.add-student-item {
    transition: opacity 200ms ease-in;
}

.add-student-item:last-of-type {
    margin-bottom: 0;
}

.add-student-item.htmx-added {
    opacity: 0;
}

.count-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

#student-error {
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

.student-input-btn {
    display: block;
    padding-block: 0.5rem;
    padding-inline: 1rem;
    margin-block: 1rem;
    border: 1px solid black;
    background-color: white;
    border-radius: 0.25rem;
    color: black;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    transition: 
        background-color 100ms ease-in,
        color 100ms ease-in;
}

.student-input-btn:hover {
    background-color: black;
    color: white;
}

/* student list styles */
.student-list {
     padding: 0;
    list-style-type: none;

    li {
        display: flex;
        justify-content: space-between;
        padding-block: 0.5rem;
        border-bottom: 1px solid black;
    }

    li:last-of-type {
        border-bottom: none;
    }

   
    .add-btn {
        justify-content: start;
    }
    .add-btn > a {
        display: block;
        padding-block: 0.25rem;
        padding-inline: 1rem;
        border: 1px solid black;
        border-radius: 0.25rem;
        color: black;
        text-decoration: none;
        
    }

    .add-btn > a:hover {
        background-color: rgb(22, 22, 22);
        color: white;
    }

    .add-btn > a:active {
        background-color: rgb(59, 59, 59);
    }
}


.delete-container {
    display: flex;
    justify-content: left;
    margin-top: 1rem;

    .delete-btn {
        display: block;
        width: fit-content;
        padding-block: 0.25rem;
        padding-inline: 1rem;
        border: 1px solid var(--error);
        border-radius: 0.25rem;
        color: var(--error);
        text-decoration: none;
    }

    .delete-btn:hover {
        background-color: var(--error);
        color: white;
    }
}

/* team page styles */
.team-page {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    padding-inline: 0.5rem;


    section {
        scroll-snap-align: start;
        height: 100vh;
        overflow-y: auto;
        padding-block: 3rem;
        margin-bottom: 0;
    }

    label {
        position: relative;
    }
}

@media screen and (min-width: 600px) {
    .team-page {
        height: auto;
        padding-inline: 0;

        section {
            max-width: 600px;
            margin-inline: auto;
            height: auto;
        }
    }
}

.center {
    height: 100%;
    display: grid;
    place-content: center;
}

.team {
    min-height: 25%;
    margin-bottom: 1rem;

    ul > li {
        padding-block: 0.5rem;
        border-bottom: 1px solid black;
    }

    ul > li:last-of-type {
        border-bottom: 0;
    }

    label {
        font-size: 1.5rem;
    }
}
