@font-face {
    font-family: "JetBrains Sans";
    src: url("fonts/JetBrainsSans-Regular.woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/JetBrainsMono-Regular.woff2");
}

* {
    box-sizing: border-box;
}

:root {
    font-family: "JetBrains Sans", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.87);
    background-color: #0f0f12;
}

body {
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

#app {
    width: 100%;
    max-width: 600px;
    background: #1e1e24;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.item-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

input {
    background: #2a2a32;
    border: 1px solid #3f3f4a;
    color: white;
    padding: 12px;
    border-radius: 8px;
    flex: 1;
    font-size: 16px; /* Prevents iOS zoom on focus */
}

button {
    background: #007eff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background: #006ae6;
}

.membership-status {
    margin-bottom: 20px;
    background: #2a2a32;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #3f3f4a;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-size: 16px;
    user-select: none;
    line-height: 25px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #1e1e24;
    border: 1px solid #3f3f4a;
    border-radius: 4px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #3f3f4a;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #007eff;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.common-items {
    margin-bottom: 20px;
}

.common-items h3, .options-container h3 {
    font-size: 16px;
    color: #888;
    margin-bottom: 10px;
}

.common-items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.common-item-btn {
    background: #2a2a32;
    color: white;
    border: 1px solid #3f3f4a;
    padding: 8px;
    font-size: 13px;
    font-weight: 400;
    width: 100%; /* Ensures buttons fill grid cell */
}

.common-item-btn:hover {
    background: #3f3f4a;
}

.common-item-btn.selected {
    background: #007eff;
    border-color: #007eff;
}

.common-item-btn:disabled {
    cursor: not-allowed;
    background: #1a1a20;
    border-color: #2a2a32;
}

.item-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.item-list-container li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #2a2a32;
    margin-bottom: 8px;
    border-radius: 6px;
    gap: 10px;
}

.item-list-container li span:first-child {
    flex: 1;
    word-break: break-word;
}

.remove-btn {
    background: #ff4d4d;
    padding: 4px 10px;
    font-size: 18px;
    line-height: 1;
}

.summary {
    border-top: 1px solid #3f3f4a;
    padding-top: 20px;
    margin-bottom: 20px;
}

.summary-box p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
}

.total {
    font-size: 20px;
    font-weight: 700;
    color: #00c5f5;
    margin-top: 10px !important;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-wrapper {
    background: #2a2a32;
    padding: 15px;
    border-radius: 8px;
}

.table-wrapper h3 {
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #3f3f4a;
}

th {
    color: #888;
    font-weight: 400;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    #app {
        padding: 15px;
    }

    .item-input {
        flex-direction: column;
    }

    #addItem {
        width: 100%;
    }

    .common-items-grid {
        grid-template-columns: 1fr;
    }
    
    .table-wrapper {
        padding: 10px;
        overflow-x: auto;
    }

    table {
        font-size: 13px;
        min-width: 400px; /* Ensures table doesn't squash too much */
    }
    
    th, td {
        padding: 10px 8px;
    }

    .item-list-container li {
        padding: 8px;
    }

    .remove-btn {
        padding: 8px 12px;
        min-width: 44px; /* Better touch target */
    }

    .total {
        font-size: 18px;
    }
}

.reward-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.reward-row:hover {
    background: #3f3f4a;
}

.reward-row.disabled-row {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.reward-row.selected {
    background: #007eff;
    color: white;
}

.reward-row.selected:hover {
    background: #006ae6;
}

.total-reward-row {
    font-weight: 700;
    border-top: 2px solid #3f3f4a;
    background: #2a2a32;
}

.reward-row td:first-child::before {
    content: '○';
    margin-right: 10px;
    font-family: "JetBrains Mono", monospace;
}

.reward-row.selected td:first-child::before {
    content: '●';
}
