.crafting-page {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--zinc-900);
    border-bottom: 1px solid var(--zinc-700);
    width: 100%;
    box-sizing: border-box;
}

.back-link {
    font-family: 'Cinzel', serif;
    color: var(--amber-400);
    text-decoration: none;
}

.back-link:hover {
    color: #fbbf24;
}

.page-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--amber-400);
    flex: 1;
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-left-actions {
    display: flex;
    gap: 0.5rem;
    min-width: 150px;
}

.profession-levels {
    padding: 0.75rem 1.5rem;
    background: var(--zinc-900);
    border-bottom: 1px solid var(--zinc-700);
    width: 100%;
    box-sizing: border-box;
}

#professionInputs {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.profession-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.profession-input label {
    font-family: 'Cinzel', serif;
    color: var(--amber-400);
    font-size: 0.75rem;
    white-space: nowrap;
}

.profession-input input {
    width: 3rem;
    padding: 0.25rem;
    text-align: center;
    background: var(--zinc-800);
    border: 1px solid var(--zinc-700);
    border-radius: 0.25rem;
    color: var(--amber-100);
    font-size: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.top-section {
    display: flex;
    gap: 0.5rem;
    height: 60%;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.recipe-list,
.recipe-details,
.panel-group {
    flex: 1;
    min-width: 0;
}

.bottom-section {
    display: flex;
    gap: 0.5rem;
    height: 40%;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.craftable-panel,
.queue-panel {
    flex: 1;
    min-width: 0;
}

.resize-handle-vertical {
    width: 4px;
    background: var(--zinc-700);
    cursor: col-resize;
    transition: background 0.2s;
    flex-shrink: 0;
    z-index: 10;
}

.resize-handle-vertical:hover {
    background: var(--amber-600);
}

.resize-handle-horizontal {
    height: 4px;
    background: var(--zinc-700);
    cursor: row-resize;
    transition: background 0.2s;
    flex-shrink: 0;
    z-index: 10;
}

.resize-handle-horizontal:hover {
    background: var(--amber-600);
}

.panel {
    background: var(--zinc-900);
    border: 1px solid var(--zinc-700);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inventory-panel,
.shopping-panel {
    flex: 1;
}

.panel-title {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    color: var(--amber-400);
    margin-bottom: 1rem;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.table-container {
    flex: 1;
    overflow: auto;
}

table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    background: var(--zinc-900);
    border-bottom: 1px solid var(--zinc-700);
}

th {
    padding: 0.5rem;
    text-align: left;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
}

th:hover {
    color: var(--amber-400);
}

td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--zinc-800);
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: var(--zinc-800);
}

tbody tr.selected {
    background: var(--amber-600);
}

.details-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.recipe-output {
    background: var(--zinc-800);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.recipe-output-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.recipe-icon {
    width: 60px;
    height: 60px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
}

.recipe-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.recipe-info h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--amber-100);
    margin-bottom: 0.25rem;
}

.recipe-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.materials-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.material-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--zinc-800);
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.material-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.material-icon {
    width: 30px;
    height: 30px;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.material-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.queue-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    justify-content: flex-end;
}

.queue-actions-row input {
    width: 5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

.queue-actions-row .btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-family: 'Cinzel', serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.queue-actions-row .btn-green {
    background: #16a34a;
    color: white;
}

.queue-actions-row .btn-green:hover {
    background: #15803d;
}

.inventory-inputs {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--zinc-800);
    border: 1px solid var(--zinc-700);
    border-radius: 0.375rem;
    max-height: 12rem;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 0.5rem;
    cursor: pointer;
    color: var(--amber-100);
    font-size: 0.875rem;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: var(--zinc-700);
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.inventory-actions {
    display: flex;
    gap: 0.5rem;
}

.inventory-list,
.shopping-list,
.craftable-list,
.queue-list {
    flex: 1;
    overflow-y: auto;
}

.craftable-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.craftable-table thead {
    position: sticky;
    top: 0;
    background: var(--zinc-900);
    border-bottom: 1px solid var(--zinc-700);
}

.craftable-table th {
    padding: 0.5rem;
    text-align: left;
    color: #9ca3af;
    font-weight: 400;
}

.craftable-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--zinc-800);
}

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

.craftable-row:hover {
    background: var(--zinc-800);
}

.inventory-item,
.shopping-item,
.craftable-item,
.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--zinc-800);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.inventory-item .material-info,
.shopping-item .material-info,
.queue-item .material-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.queue-actions {
    display: flex;
    gap: 0.5rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--zinc-900);
    border: 2px solid var(--amber-600);
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--amber-400);
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--amber-100);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-amber {
    background: var(--amber-600);
}

.btn-amber:hover {
    background: #b45309;
}

.text-green {
    color: #4ade80;
}

.text-red {
    color: #f87171;
}

@media (max-width: 1024px) {
    .top-section {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .bottom-section {
        grid-template-columns: 1fr;
        height: auto;
    }
}


.inventory-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inventory-qty-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.inventory-qty-input {
    width: 5rem;
    padding: 0.25rem 0.5rem;
    background: var(--zinc-700);
    border: 1px solid #52525b;
    border-radius: 0.25rem;
    color: var(--amber-400);
    font-weight: 600;
    font-size: 0.875rem;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

.inventory-qty-input::-webkit-outer-spin-button,
.inventory-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.inventory-qty-input[type=number] {
    -moz-appearance: textfield;
}

.reserved-qty {
    font-size: 0.75rem;
    color: #fb923c;
}

.remove-btn {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #f87171;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.remove-btn:hover {
    color: #fca5a5;
}

.queue-buttons {
    display: flex;
    gap: 0.25rem;
}

.queue-btn {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.queue-btn-complete {
    background: #16a34a;
    color: white;
}

.queue-btn-complete:hover {
    background: #15803d;
}

.queue-btn-disabled {
    background: #4b5563;
    color: #9ca3af;
    cursor: not-allowed;
}

.queue-btn-remove {
    background: #dc2626;
    color: white;
}

.queue-btn-remove:hover {
    background: #b91c1c;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--zinc-800);
    border: 1px solid var(--zinc-700);
    border-radius: 0.25rem;
    margin-top: 0.25rem;
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--amber-100);
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: 'Cinzel', serif;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--zinc-700);
}

.profession-group-content {
    display: block;
    transition: all 0.2s ease;
}

.profession-group-header:hover {
    background: var(--zinc-700) !important;
}
