html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #1a202c;
    color: #e2e8f0;
}

.container {
    background-color: #2d3748;
    padding: 2.5rem;
    width: 100%;
    min-height: 100vh;
    text-align: center;
    box-sizing: border-box;
}

input[type="text"],
input[type="number"],
button {
    font-size: 1.05rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group .item-name-wrapper {
    flex-grow: 1;
    position: relative;
}

.input-group #itemQuantity {
    width: 120px;
    flex-shrink: 0;
}

#calculateBtn {
    width: 150px;
    flex-shrink: 0;
}

button {
    background-color: #4299e1;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    padding: 0.85rem 1.75rem;
    border-radius: 0.75rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #3182ce;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #4a5568;
    cursor: not-allowed;
    transform: none;
}

.controls-row {
    margin-top: 1.5rem;
}

#tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.tab {
    background-color: #3a4252;
    color: #a0aec0;
    padding: 0.6rem 1.2rem;
    border-radius: 9999px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease-in-out;
    border: 1px solid #4a5568;
    font-weight: 500;
}

.tab:hover {
    background-color: #4a5568;
    color: #e2e8f0;
    transform: translateY(-2px);
    border-color: #63b3ed;
}

.tab.active {
    background-color: #4299e1;
    border-color: #4299e1;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.2);
    transform: translateY(-2px);
}

.tab.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.tab.drag-over-before {
    border-left: 2px solid #68d391;
}

.tab.drag-over-after {
    border-right: 2px solid #68d391;
}


.tab-close-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-weight: bold;
    padding: 0 0.25rem;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease-in-out;
}

.tab.active .tab-close-btn {
    color: white;
}

.tab-close-btn:hover {
    color: #1a202c;
    background-color: #e2e8f0;
}


#results {
    background-color: #2c313a;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.75rem;
    text-align: left;
    border: 1px solid #4a5568;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-height: 5rem;
}

#results ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

#results li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

#results li:hover {
    background-color: rgba(74, 85, 104, 0.2);
    border-radius: 0.25rem;
}

#results li:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: bold;
    color: #90cdf4;
    font-size: 1.05rem;
    flex-grow: 1;
    text-align: left;
}

.error-message {
    color: #fc8181;
    font-weight: bold;
    margin-top: 0;
    text-align: center;
    width: 100%;
}

#initialMessage {
    text-align: center;
    margin: 0.5rem 0;
}

#results .text-sm {
    text-align: center;
    margin: 0.5rem 0;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#craftTreeDisplay {
    background-color: #2c313a;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.75rem;
    text-align: left;
    border: 1px solid #4a5568;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#craftTreeDisplay ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#craftTreeDisplay ul ul {
    padding-left: 1.5rem;
    border-left: 2px solid #5a6270;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
}

#craftTreeDisplay li {
    background-color: #3a4252;
    border-radius: 0.5rem;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    padding-right: 0rem;
    border: 1px solid #4a5568;
    border-right: 0px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease-in-out;
}

#craftTreeDisplay li:last-child {
    margin-bottom: 0;
}

.craft-step-header {
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 0;
}

.main-content-flex {
    display: flex;
    align-items: flex-start;
    flex-grow: 1;
    justify-content: space-between;
    padding-right: 1rem;
    flex-wrap: nowrap;
}

.item-text-content {
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    min-width: 0;
}

.craft-step {
    font-weight: bold;
    color: #63b3ed;
    font-size: 1rem;
}

.craft-step-details {
    font-size: 0.95em;
    color: #a0aec0;
    margin-top: 0.2rem;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: none;
}

#autocomplete-list {
    position: absolute;
    border: 1px solid #4a5568;
    border-top: none;
    z-index: 99;
    background-color: #2d3748;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

#autocomplete-list div {
    padding: 10px;
    cursor: pointer;
    background-color: #2d3748;
    border-bottom: 1px solid #4a5568;
    text-align: left;
    transition: background-color 0.2s;
}

#autocomplete-list div:hover,
#autocomplete-list div.selected {
    background-color: #4a5568;
}

#autocomplete-list div:last-child {
    border-bottom: none;
}

#autocomplete-list::-webkit-scrollbar {
    width: 8px;
}

#autocomplete-list::-webkit-scrollbar-track {
    background: #2c313a;
    border-radius: 10px;
}

#autocomplete-list::-webkit-scrollbar-thumb {
    background-color: #4a5568;
    border-radius: 10px;
    border: 2px solid #2c313a;
}

#autocomplete-list::-webkit-scrollbar-thumb:hover {
    background-color: #63b3ed;
}

.toggle-arrow {
    cursor: pointer;
    margin-right: 0.5rem;
    font-weight: bold;
    color: #63b3ed;
    user-select: none;
    min-width: 1em;
    text-align: center;
    transition: color 0.2s;
}

.toggle-arrow:hover {
    color: #90cdf4;
}

.craft-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid #63b3ed;
    border-radius: 0.35rem;
    background-color: #2c313a;
    cursor: pointer;
    position: relative;
    margin-right: 0.6rem;
    flex-shrink: 0;
    transition: background-color 0.2s, border-color 0.2s;
}

.craft-checkbox:checked {
    background-color: #48bb78;
    border-color: #48bb78;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3e%3cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.craft-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.completed-item .craft-step,
.completed-item .craft-step-details,
.completed-item .toggle-arrow {
    color: #a0aec0;
    text-decoration: line-through;
}

.quantity-labels-row {
    display: flex;
    justify-content: flex-end;
    width: calc(4.5rem * 2 + 0.5rem);
    margin-left: auto;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    margin-right: calc(1rem + 1px);
}

.quantity-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #90cdf4;
    width: 4.5rem;
    text-align: center;
    flex-shrink: 0;
}

.quantity-inputs-row {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    width: calc(4.5rem * 2 + 0.5rem);
}

.current-quantity-input,
.packs-quantity-input {
    width: 4.5rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.35rem;
    background-color: #4a5568;
    border: 1px solid #63b3ed;
    color: #e2e8f0;
    text-align: center;
    font-size: 0.9rem;
    transition: border-color 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.current-quantity-input:focus,
.packs-quantity:focus {
    border-color: #90cdf4;
    background-color: #2d3748;
    outline: none;
}

.current-quantity-input:disabled,
.packs-quantity-input:disabled {
    background-color: #3d4654;
    border-color: #3d4654;
    color: #6b7280;
    cursor: not-allowed;
}

#craftTreeDisplay li.frozen-path-highlight {
    background-color: #4a5568;
    border-color: #63b3ed;
}

#craftTreeDisplay li.frozen-path-highlight .craft-step,
#craftTreeDisplay li.frozen-path-highlight .craft-step-details,
#craftTreeDisplay li.frozen-path-highlight .toggle-arrow {
    color: #ffffff;
}

#craftTreeDisplay li.hover-temp-highlight {
    background-color: rgba(99, 179, 237, 0.2);
    border-color: #90cdf4;
}

#craftTreeDisplay li.hover-temp-highlight .craft-step,
#craftTreeDisplay li.hover-temp-highlight .craft-step-details,
#craftTreeDisplay li.hover-temp-highlight .toggle-arrow {
    color: #e2e8f0;
}

#craftTreeDisplay li.frozen-path-highlight.hover-temp-highlight {
    background-color: rgba(99, 179, 237, 0.2);
    border-color: #90cdf4;
}

#craftTreeDisplay li.frozen-path-highlight.hover-temp-highlight .craft-step,
#craftTreeDisplay li.frozen-path-highlight.hover-temp-highlight .craft-step-details,
#craftTreeDisplay li.frozen-path-highlight.hover-temp-highlight .toggle-arrow {
    color: #e2e8f0;
}

.quantity-values {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.item-quantity,
.unit-cost,
.total-cost {
    text-align: right;
    color: #a0aec0;
    font-size: 1.05rem;
}

.results-header-wrapper {
    margin-bottom: 0.5rem;
}

.price-toggle-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #a0aec0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a5568;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: #4299e1;
}

input:focus+.slider {
    box-shadow: 0 0 1px #4299e1;
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #90cdf4;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #4a5568;
    font-size: 1.05rem;
    width: 100%;
}

.item-name-header {
    text-align: left;
    flex-grow: 1;
}

.quantity-headers {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.item-quantity-header,
.unit-cost-header,
.total-cost-header {
    text-align: right;
}

.grand-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #4a5568;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
    color: #e2e8f0;
}

.grand-total-value {
    color: #68d391;
}

.container {
    max-width: none !important;
}