* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Work Sans", serif;
    overflow: hidden;
    transition: .1s;
}

html, body {
    height: 100vh;
    width: 100vw;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

body {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: column;
    color: white;
    background: #171411;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: column;
    width: 100vw;
    padding: .5em;
    gap: .5em;
}

header > span {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

header > span > span {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: .2em;
    position: absolute;
    left: 1em;
    border: none;
    background: none;
    color: white;
    font-size: 1em;
}

header > span > span > input {
    width: 2em;
}

header > span > div > * {
    font-size: 1.1em;
}

header > span > button {
    position: absolute;
    right: 1em;
    border: none;
    border-radius: 5px;
    background: none;
    color: white;
    aspect-ratio: 1;
    width: 2em;
}

header > div {
    font-size: smaller;
}

header > div > input {
    width: 2em;
}

header > * > input {
    border: none;
    border-bottom: 1px solid black;
    position: absolute;
    z-index: 100;
}

.categoryTotals {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
}

.categoryTotals > div {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: .2em;
}

.categoryTotals > div > b {
    font-size: .9em;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

main {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-direction: column;
    width: 100vw;
    height: auto;
    padding: 1em;
    overflow-y: auto;
}

.botonesPartidas {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 1em;
    width: 100%;
    z-index: 200;
}

.botonesPartidas > button {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.2em;
    border: none;
    border-radius: .2em;
    color: white;
    background: #ff1a1a;
    padding: .5em 1em;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90vw;
    gap: .5em;
    font-size: 1.3em;
}

.allPartidasContainer {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0; /* Ensure no padding that could cause overflow */
    margin: 0; /* Ensure no margin that could cause overflow */
}

.partida-header {
    width: 100%;
    min-height: 5em;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
}

.partida-header > b {
    font-size: 1.5em;
}

.partida-header > span {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
}

.categoriesContainer {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    gap: .4em;
    background: #171411;
    min-width: 100%; /* Ensure each partida occupies the full width of the page */
    height: 100%;
    scroll-snap-align: start;
    position: relative;
    padding: 0; /* Ensure no padding that could cause overflow */
    margin: 0; /* Ensure no margin that could cause overflow */
}

.categoriesContainer p {
    font-size: 1em;
    font-weight: bold;
}

.category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    padding: 2em 0 2em 0;
    border-radius: 5px 0 5px 0;
    width: 100%;
    height: 3em;
    border-right: 1px solid #ff8b3e96;
    border-bottom: 1px solid #ff8b3e96;
}

.category-name {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    gap: .2em;
}

.category-name > p {
    font-size: .8em;
    white-space: nowrap; /* Ensure text is always on a single line */
    overflow: hidden; /* Hide overflow text */
    text-overflow: ellipsis; /* Add ellipsis for overflow text */
    line-height: 1.2em; /* Adjust line height for better spacing */
}

.category-controls {
    display: flex;
    align-items: center;
    gap: .5em;
    position: absolute;
    right: 0;
    padding: .5em;
}

.category-controls > button {
    background: #362f2a;
    font-size: 1em;
    padding: 0.5em 1em;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
    aspect-ratio: 1;
    width: 3em;
}

.category-controls > button:nth-child(2) {
    background: #ff8b3e;
}

.category-controls .units {
    cursor: pointer;
    background: #362f2a;
    padding: .5em;
    border-radius: .3em;
    width: 2em;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
}

.botonesPartida {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    gap: 1em;
    padding: 1em;
    top: .2em;
    right: .2em;
    background: none;
    position: absolute;
    right: 0;
}

.botonesPartida > button {
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    color: white;
}

.botonesPartida > button > span {
    font-size: 2em;
}

footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-direction: column;
    width: 100%;
}

.modal {
    display: none; /* Hidden by default */
    z-index: 1000; /* Sit on top */
    width: 100vw; /* Full width */
    height: 100vh; /* Full height */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: #25211c;
    width: 80vw;
    padding: 1em;
    border-radius: .5em;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1em;
}

.modal-content > div {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content > div > button {
    width: 4.5em;
    height: 2.5em;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    background: #362f2a;
}

.modal-content > div > button:nth-child(2) {
    background: #ff8b3e;
}

.modal-content > button {
    margin: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#settingsModal .modal-content {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

#resetProjectsModal .modal-content {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.categorySqft {
    font-size: .7em;
}

.start-screen {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: #171411;
    padding: 1em;
}

h1 {
    padding: 2em;
}

.start-screen > span {
    width: 100%;
    max-width: 40em;
    height: 3em;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .2em;
}

.start-screen > span > div {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .2em;
    width: 90%;
}

.start-screen > span > span {
    position: absolute;
    color: #b3a79e;
    font-size: 1.5em;
    z-index: 5;
}

.start-screen input {
    width: 100%;
    height: 3em;
    padding: 1em;
    border: none;
    background: #362f2a;
    color: #b3a79e;
    border-radius: .5em 0 0 .5em;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: .7em;
    padding-left: 3em;
}

.start-screen input::placeholder {
    color: #b3a79e;
}

.start-screen > span > div > button {
    height: 3em;
    aspect-ratio: 1;
    border: none;
    background: #362f2a;
    color: #b3a79e;
    border-radius: 0 .5em .5em 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.start-screen > span > div > span {
    position: absolute;
    left: 0;
    padding-left: .5em;
    color: #b3a79e;
}

#openCreateProjectModal {
    padding: .5em 1em;
    border: none;
    border-radius: .2em;
    background-color: #ff8b3e;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 40em;
    gap: .5em;
    z-index: 100;
    position: absolute;
    bottom: 0;
}

#openCreateProjectModal.multiple-projects {
    padding: .5em;
    width: 5em;
    aspect-ratio: 1;
    position: absolute;
    right: 0;
    bottom: 0;
    border-radius: 1em;
}

.start-screen > button {
    padding: .5em 1em;
    border: none;
    border-radius: .2em;
    background-color: #ff8b3e;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 40em;
    gap: .5em;
    z-index: 100;
}

.project-screen {
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: #171411;
    padding: 1em;
}

.project-list {
    margin-top: 3em;
    width: 100%;
    text-align: center;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.project-list ul {
    width: 100%;
    position: absolute;
    list-style-type: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 1em;
    overflow-y: auto;
}

.project-list li {
    padding: 1em;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    flex-shrink: 0;
}

.project-list > ul > li > span {
    background: #362f2a;
    padding: .7em;
    border-radius: .3em;
    width: 2em;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
}

.project-details {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
    gap: .2em;
}

.project-details > p {
    text-align: left;
}

.button-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.2em;
    width: 25%;
}

.project-list li button {
    border: none;
    border-radius: .7em;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    background: #362f2a;
    padding: .3em 1em;
}

.no-projects-message {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.5em;
    color: #ff8b3e;
    padding: 1em;
    align-self: center;
    font-size: 2em;
    width: 100%;
    aspect-ratio: 1;
}

.no-projects-message > span {
    font-size: 2em;
}

.project-form {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: .2em;
}

.project-form > div {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
}

.project-form > div > input {
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 200px;
}

.project-form > button {
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 5px;
    background: #4CAF50;
    aspect-ratio: 1;
    width: 2.4em;
    color: white;
}

.project-form > button > span {
    min-width: 1em;
    aspect-ratio: 1;
}

.total-summary {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    gap: 1em;
    padding: 1em 1em 0 1em;
    background: #25211c;
    border-radius: 2em 2em 0 0;
    cursor: pointer; /* Add cursor pointer */
    transition: height 0.3s ease; /* Smooth transition for height */
    height: 3em; /* Initial height */
    overflow: hidden; /* Hide overflow content */
    z-index: 200;
}

.total-summary.expanded {
    height: 80vh; /* Expanded height */
}

.total-summary.expanded #summaryArrow {
    transform: rotate(180deg); /* Rotate arrow when expanded */
}

.total-summary > span {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1em;
}

.total-summary b {
    font-size: larger;
    position: absolute;
    top: .5em;
    display: flex;
    justify-content: center;
    align-items: center;
}

.total-summary > span > p {
    font-size: .7em;
    color: #ff8b3e;
}

.total-summary > div {
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    padding: .2em;
}

.total-summary-container {
    padding-top: 2em;
    margin-top: 3em;
}

.total-summary > div > div {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
    gap: 1em;
}

.total-summary > div > div > div {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1em;
    padding: .2em;
    width: 100%;
    height: 100%;
}

.total-summary > div > div > div > span {
    background: #362f2a;
    padding: .7em;
    border-radius: .3em;
    width: 2em;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
}

.summary {
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: .2em;
    padding: .3em 0 0 0;
    background: #25211c;
    border-radius: 5px;
    height: fit-content;
    /* padding-bottom: 3em; */
    /* position: absolute;
    bottom: 0; */
}

.summary b {
    font-size: larger;
    text-align: center;
}

.mainInfo {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
}

.summary .categoryTotals > div {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    gap: .2em;
}

.chart-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

#categoryChart {
    all: unset; /* Remove all styles */
    width: 40% !important; /* Override width */
    aspect-ratio: 1;
    height: auto !important; /* Override height */
    display: block !important; /* Ensure display is block */
    box-sizing: inherit !important; /* Override box-sizing */
    position: relative;
    /* right: .1em;
    bottom: .5em; */
    border: 2px dashed #ff8b3e; /* Add border */
    margin: 1em;
}

#categoryChart.has-data {
    border: none; /* Remove border when data is present */
}

.color-indicator {
    width: 1em;
    aspect-ratio: 1;
}

.color-indicator.a {
    background-color: rgba(255, 99, 132, 0.2);
    border: 1px solid rgba(255, 99, 132, 1);
}

.color-indicator.b {
    background-color: rgba(54, 162, 235, 0.2);
    border: 1px solid rgba(54, 162, 235, 1);
}

.color-indicator.c {
    background-color: rgba(255, 206, 86, 0.2);
    border: 1px solid rgba(255, 206, 86, 1);
}

.color-indicator.d {
    background-color: rgba(75, 192, 192, 0.2);
    border: 1px solid rgba(75, 192, 192, 1);
}

.color-indicator.e {
    background-color: rgba(153, 102, 255, 0.2);
    border: 1px solid rgba(153, 102, 255, 1);
}

.color-indicator.r {
    background-color: rgba(255, 159, 64, 0.2);
    border: 1px solid rgba(255, 159, 64, 1);
}

.partida-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.5em;
}

.partida-buttons button {
    padding: 0.5em 1em;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
}

.partida-buttons .addPartida {
    background: #4CAF50;
}

@media (min-width: 1024px) {

    html {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body {
        width: 1024px;
        position: absolute;
        border: 1px solid white;
        border-radius: 5px;
    }

    .start-screen , .project-screen {
        width: 1024px;
    }

    .project-list ul {
        width: 50%;
    }

    header , main {
        width: 100%;
    }

    .summary {
        height: 20%;
        width: 100%;
    }

    #categoryChart {
        width: 20% !important; /* Override width */
    }
}

/* .project-list li {
    padding: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    flex-shrink: 0;
} */

@media (max-height: 784px) {
    .summary {
        /* height: 27.5%; */
    }
}