/* Universal selector */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Body and container */
body {
    background: linear-gradient(135deg, #3e2799 0%, #6c47e6 100%);
    min-height: 100vh;
    padding: 0;
}

.container {
    width: 740px;
    margin: 32px auto 32px auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(62,39,153,0.10);
    padding: 32px 18px 24px 18px;
}

/* Header */
h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #3e2799;
    font-size: 2.1rem;
    margin-bottom: 18px;
}

h1 img {
    width: 38px;
    height: 38px;
}

/* Input section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    width: 100%;
}

.input-section input,
.input-section select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.input-section button {
    width: 100%;
    min-width: 100px;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.input-section button[onclick="addItem()"] {
    background: #2ecc40;
    color: #fff;
}
.input-section button[onclick="addItem()"]:hover {
    background: #229c30;
}
.input-section button[onclick="sharePage()"] {
    background: #007bff;
    color: #fff;
}
.input-section button[onclick="sharePage()"]:hover {
    background: #0056b3;
}
.input-section button[onclick="saveListWithName()"] {
    background: #f39c12;
    color: #fff;
}
.input-section button[onclick="saveListWithName()"]:hover {
    background: #c87f0a;
}
.input-section button[onclick="loadListByName()"] {
    background: #16a085;
    color: #fff;
}
.input-section button[onclick="loadListByName()"]:hover {
    background: #117864;
}

/* Select especial */
#categorySelect {
    background: #f8f9fa;
    color: #3d2d7e;
    border: 1.5px solid #3e2799;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 1px 4px rgba(62,39,153,0.04);
    margin-bottom: 0;
}

#categorySelect:focus {
    border: 2px solid #3e2799;
    background: #f3f6ff;
    box-shadow: 0 0 0 3px rgba(62,39,153,0.12);
    outline: none;
    transition: box-shadow 0.2s, background 0.2s, border 0.2s;
}

#categorySelect option {
    color: #2c3e50;
    background: #fff;
    font-weight: 400;
}

/* List section */
.list-section {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fdfdfd;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.07);
    padding-bottom: 10px;
    transition: box-shadow 0.2s;
}

.list-section::-webkit-scrollbar {
    width: 8px;
    background: #f1f1f1;
    border-radius: 8px;
}
.list-section::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 8px;
}

/* List header */
.list-header {
    display: grid;
    grid-template-columns: 100px 1fr 150px 100px 100px 150px;
    gap: 18px;
    padding: 12px 24px;
    background: linear-gradient(90deg, #3d2d7e 80%, #3e2799 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
    font-weight: bold;
    font-size: 15px;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.10);
    align-items: center;
    border-bottom: 1px solid #3e2799;
    text-shadow: 0 1px 2px rgba(0,0,0,0.08);
    margin-bottom: 0;
    text-align: center;
}

.list-header > div {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

/* List item */
.list-item {
    display: grid;
    grid-template-columns: 80px 1fr 150px 120px 120px 100px;
    gap: 18px;
    padding: 12px 24px;
    align-items: center;
    background: #fff;
    font-size: 1rem;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    grid-template-rows: auto auto;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item input,
.list-item select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    background: #f8f9fa;
    color: #2c3e50;
}

.list-item input:focus,
.list-item select:focus {
    outline: 2px solid #3e2799;
    background: #eef2fb;
}

.list-item .action-btn {
    background: #3e2799;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 1.1rem;
    margin: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.list-item .action-btn:hover {
    background: #5a3ee6;
}

.list-item > div:last-child {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 100%;
}

/* Checkbox row */
.list-item .item-check-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    margin-top: 6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    color: #3d2d7e;
    font-weight: 500;
}

.item-check {
    accent-color: #3e2799;
    width: 20px;
    height: 20px;
    margin-right: 4px;
}

.item-check-row label {
    margin-left: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Item comprado */
.list-item.bought {
    opacity: 0.5;
    background: #e6f3e6;
    text-decoration: line-through;
    transition: background 0.2s, opacity 0.2s;
}

/* Footer */

.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 50%; /* Centraliza em relação à largura da tela */
    transform: translateX(-50%); /* Ajusta para alinhar ao centro */
    width: 739px ; /* Mantém o tamanho que você definiu */
    background-color: #f3f6fa;
    color: #2c3e50;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
    font-size: 1.2rem;
}

#totalItems, #totalPrice {
    color: #e74c3c;
    font-weight: bold;
}

/* Responsividade */
@media (max-width: 700px) {
    .container {
        max-width: 98vw;
        padding: 8px 2vw 16px 2vw;
    }

    .list-header,
    .list-item {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        font-size: 0.95rem;
        padding: 10px 8px;
    }

    .list-header > div,
    .list-item > * {
        justify-content: flex-start;
        text-align: left;
    }
}

@media (max-width: 400px) {
    .input-section,
    .list-header,
    .list-item {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: row;
        justify-content: center;
    }
}
