*,
*::before,
*::after {
    box-sizing: border-box;
    /* border: 1px solid orange; */
}

* {
    margin: 0;
    padding: 0;
}

:root {
    --background-color: #f6f6fa;
    --accent-color: #592e6d;
    --accent-color-opacity-10: rgba(89, 46, 109, 0.1);
    --hover-color-opacity-10: rgba(89, 46, 109, 0.05);
    --sidebar-width: 85px;
    --input-focus-border-color: #9b568e;
    --form-placeholder-text-color: #6e6e73;
    --neutral-500: #6e6e73;
    --gray-color-50: #494949;
    --green-color: #2e6d4b;
    --warning-color: #bf680b;
    --blue-color: steelblue;
    --button-focus-color: violet;
    --error-color: rgb(210, 38, 38);
}

:focus {
    outline: 2px solid var(--input-focus-border-color);
}

body {
    background-color: var(--background-color);
    font-family: 'Noto Sans Thai', sans-serif;
    color: var(--gray-color-50)
}

main {
    width: 100%;
    height: 100%;
    margin-block: 2rem;
    margin-left: var(--sidebar-width);
    padding: 0 30px;
}

h1, h2, h3, h4 {
    letter-spacing: -0.03rem;
    color: black;
}

input, select, button, a {
    font: inherit;
}

a {
    text-decoration: none;
    color: var(--accent-color)
}

a:hover {
    color: var(--input-focus-border-color)
}
table {
    border-spacing: 0;
}

th {
    font-weight: 500 !important;
    font-size: 1.17rem;
}

select {
    box-sizing: border-box;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    text-align: center;
}

select:hover {
    border-color: var(--accent-color);
    cursor: pointer;
}

select:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--input-focus-border-color);
    /* border: 2px solid var(--input-focus-border-color) */
}

.wrapper {
    position: relative
}

.login-background {
    background-image: url("/images/mangostana-login-bg.jpg");
    background-size: cover;
    background-repeat: no-repeat;
}

.login-container {
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100vh;
    position: relative;
    align-items: center;
    backdrop-filter: blur(0.2rem);
}

.login-box {
    display: flex;
    flex-direction: column;
    width: 700px;
    height: 570px;
    position: relative;
    padding: 6rem;
    border-radius: 30px;
    align-items: center;
    background-color: #fff;
    fill: var(--accent-color);
    filter: 
        drop-shadow(.5px 1px 1px hsl(285deg 40% 40% / .20)) 
        drop-shadow(1px 2px 2px hsl(285deg 40% 40% / .20)) 
        drop-shadow(2px 4px 4px hsl(285deg 40% 40% / .20)) 
        drop-shadow(4px 8px 8px hsl(285deg 40% 40% / .20)) 
        drop-shadow(8px 16px 16px hsl(285deg 40% 40% / .20));
}

.slow-clockwise-rotation {
    animation: 
      rotate-clockwise linear infinite 30s,
      rotate-clockwise linear infinite 3s paused;
    animation-composition: add;
}

.slow-clockwise-rotation:hover {
    animation-play-state: running;
}

@keyframes rotate-clockwise {
    to {rotate: 1turn}
}

.login-box__intro {
    line-height: 1.3rem;
    max-width: 64ch;
    color: var(--gray-color-50);
}

.login-form {
    width: 360px;
    height: 100%;
    padding-top: 2rem;
    text-align: center;
}

.form__input {
    position: relative;
    width: 100%;
    height: 3rem;
    color: var(--gray-color-50);
    font-size: 1rem;
    padding: 1rem;
    padding-bottom: 0rem;
    margin-bottom: 1rem;
    border: 1px solid #86868b;
    border-radius: 12px;
    outline: none;
}

.form__order-input {
    position: relative;
    height: 1rem;
    color: var(--gray-color-50);
    font-size: 1rem;
    padding: 1rem;
    border: 1px solid #86868b;
    border-radius: 12px;
    outline: none;
}

.form__order-input:valid {
    border: 1px solid #86868b;
}

.form__input:hover,
.form__order-input:hover {
    border-color: var(--accent-color)
}

.form__input:focus,
.form__order-input:focus {
    border: 2px solid var(--input-focus-border-color)
}

.form__label {
    position: absolute;
    color: var(--form-placeholder-text-color);
    font-size: 1rem;
    top: 0.7rem;
    left: 1rem;
    cursor: text;
    pointer-events: none;
    transition: font-size 150ms ease-in-out,
                top 150ms ease-in-out,
                left 150ms ease-in-out;
}

.form__input:focus ~ .form__label,
.form__input:not(:placeholder-shown) ~ .form__label {
    font-size: 0.7rem;
    top: 0.2rem;
    left: 1.1rem;
}

.primary-btn {
    color: white;
    width: fit-content;
    height: fit-content;
    font-family: inherit;
    font-size: inherit;
    line-height: 0.5rem;
    background-color: var(--accent-color);
    padding: 0.8rem 1rem;
    border-radius: 1.5rem;
    border: none;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

.primary-btn:hover {
    background-color: var(--input-focus-border-color); 
}

.primary-btn:focus,
.secondary-btn:focus {
    box-shadow: 0 0 0 2px var(--button-focus-color);
}

.primary-btn--login {
    width: 50%;
    line-height: default;
    position: relative;
}

.primary-btn--login::before {
    position: absolute;
    content: "Login";
    padding: 0.8rem 1rem;
    border-radius: 1.5rem;
    inset: 0;
    background: linear-gradient(135deg, #5E48B5, #DF84ED, #B4EDFF);
    z-index: 1; 
    opacity: 0;
    transition: opacity 0.5s linear;
}

.primary-btn--login:hover::before {
    opacity: 1;
    transition: opacity 0.15s linear;
}

.secondary-btn {
    color: var(--accent-color);
    width: fit-content;
    height: fit-content;
    font-family: inherit;
    font-size: inherit;
    line-height: 0.5rem;
    background-color: var(--accent-color-opacity-10);
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 1.5rem;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

.secondary-btn:hover {
    background-color: var(--input-focus-border-color);
    color: white;
}

.primary-btn:disabled,
.secondary-btn:disabled {
    color: gray;
    border: none;
    background-color: lightgray;
    cursor: default;
}
/* Main Application*/

.container {
    display: flex;
    flex-wrap: nowrap;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    max-width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid #ecf1f7;
    align-items: center;
    padding-top: 30px;
    justify-content: flex-start;
    stroke: var(--accent-color);
    fill: var(--accent-color);
    z-index: 1;
}

.sidebar__logo {
    width: 48px;
}

.sidebar__menu {
    margin-top: 30px;
}

.sidebar__menu__tab {
    width: 100%;
    height: 68px;
    display: flex;
    position: relative;
    align-items: center;
    margin-bottom: 10px;
    padding: 0px 4px;
    border-radius: 8px;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.3s ease-in;     
    color: black;
}

.sidebar__menu__tab--active {
    color: var(--accent-color);
    background-color: var(--accent-color-opacity-10);
    stroke-width: 1.5px;
    transform: scale(1.05);
}

.sidebar__menu__tab__icon {
    margin-top: 8px;
    margin-bottom: 5px;
    height: 30px;
    width: 30px;
}

.sidebar__menu__tab:hover {
    background-color: var(--hover-color-opacity-10);
}

.sidebar__menu__tab--active:hover {
    background-color: var(--accent-color-opacity-10);
}

.sidebar__menu__tab__title {
    font-size: 0.75rem;
    padding-bottom: 5px;
    text-align: center;
}

.mangostana-version {
    margin-top: auto;
    margin-bottom: 1rem;
    padding: 1rem;
    font-size: 0.8rem;
    text-align: center;
    color: var(--gray-color-50)
}

.list-wrapper {
    display: grid;
    min-width: 700px;
    max-width: 1200px;
    margin: 0rem auto;
    padding: 3rem 4rem;
    background-color: white;
    border-radius: 12px;
}

.list-wrapper > * {
    align-content: center;
    padding: 0.7rem;
    /* border: 1px solid purple; */
}

.table-loading-white-overlay {
    position: absolute;
    top: 0px;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 1;
    z-index: 2;
    border-radius: 12px;

    display: flex;
    align-items: flex-start;
    padding: 4rem 4rem;
    margin: 0rem auto;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal .modal__content {
    background: white;
    margin: 4rem auto;
    padding: 2rem;
    padding-inline: 4rem;
    max-width: 800px;
    border-radius: 12px;
    overflow-y: auto;
    height: 80vh;
}

#stock-request-form label,
#order-edit-form label {
    margin-right: 0.2rem;
    font-weight: 600;
}

#stock-request-form input,
#order-edit-form input,
#stock-request-form select,
#order-edit-form select {
    /* color: var(--accent-color); */
    margin-right: 1rem;
}

.close-btn {
    cursor: pointer;
    float: right;
    font-size: 2rem;
}

#product-search-list {
    margin-block: 1rem;
}

#product-search-list img {
    border-radius: 6px;
    margin-inline: 0.5rem;
}

.hide {
    max-height: 0;
    opacity: 0; 
    transition: max-height 0.3s ease-in, opacity 0.3s ease-in;  
}

.show {
    opacity: 1; 
    max-height: 300px; 
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 12px;
    transition: max-height 0.1s ease-in, opacity 0.1s ease-in;  
}

.filtered-product {
    display: flex;
    padding: 5px;
    cursor: pointer;
    place-items: center;
}

.filtered-product:hover, .selected {
    background-color: var(--hover-color-opacity-10);
}

.order-product-list__item {
    display: flex;
    align-items: center;
}

.order-product-list__item > *:not(img) {
    padding-inline: 0.5rem;
}

.delete-icon {
    display: flex;
    align-items: center;
    stroke: darkred;
}

.widget-bar {
    display: flex;
    padding-block: 0; 
    margin-bottom: -1rem; 
    z-index: 1;
}

.status-filter {
    margin-left: auto;
    align-content: center;
    z-index: 1;
}

input.search-box {
    min-width: 15ch;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-block: 0.2rem;
    border-radius: 12px;
    border: 1px solid #767676;
}

/* Order List */

#orderList th {
    white-space: nowrap;
}

#orderList .dt-search {
    display: none;
}

.order-item > * {
    white-space: nowrap;
}

.order-status > * {
    border: none;
    outline: none;
    border-radius: 12px;
    padding-inline: 0.6rem;
    padding-block: 0.3rem;
}

.order-status .order-id {
    color: var(--accent-color);
    background-color: rgb(251, 244, 255);
}

.order-status .processing {
    color: #4689ee;
    background-color: #ecf0fe;
}

.order-status .closed {
    color: #089049;
    background-color: #effdf6;
}

.order-status .draft {
    color: var(--warning-color);
    background-color: rgb(255, 242, 236) 
}

.order-detail {
    width: 100%;
    margin-top: 0.5rem;
}

.order-detail th {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1rem !important;
}


.order-detail .order-detail__number {
    width: 3ch;
}

.order-detail .order-detail__image {
    width: 80px;
}

.order-detail .order-detail__id {
    width: 10ch;
}

.order-detail .order-detail__name {
    width: 40ch;
}

.order-detail .order-detail__remark {
    cursor: pointer;
    width: 20ch;
    /* border: 1px solid red; */
}

.order-detail__remark svg {
    display: none;
}

.order-detail__remark:hover svg {
    display: inline-block;
}

.order-detail__widget {
    display: flex;
    margin-inline: 3rem;
    margin-bottom: 1rem;
}

#edit-order_id:read-only {
    margin-right: 0;
    padding-right: 0;
    border: none;
    background-color: var(--hover-color-opacity-10);
    width: 9ch;
}

#confirm-order-box,
#change-status-box {
    display: none;
}

#confirm-order-box > .modal__content,
#change-status-box > .modal__content {
    position: relative;
    max-width: 300px;
    min-width: 300px;
    max-height: fit-content;
    margin: 4rem 0 0 70%;
    padding-inline: 2rem;
    place-items: center;
}

div.dt-container.dt-empty-footer tbody > tr > td > table tbody > tr:last-child > td {
    border: none; 
}
div.dt-container.dt-empty-footer tbody > tr > td > table tbody > tr:first-child > td {
  padding-top: 1rem;
}
div.dt-container.dt-empty-footer tbody > tr > td > table tbody > tr:last-child > td {
  padding-bottom: 1rem;
}
div.dt-container.dt-empty-footer tbody > tr[data-dt-row]:hover > * {
  box-shadow: none;
}
div.dt-container.dt-empty-footer {
  cursor: pointer;
}
table.dataTable tr[data-dt-row] > td {
  cursor: default;
  border: 1px solid rgba(var(--dt-row-selected), 0.2);
  border-radius: 0 0 1rem 1rem;
}

#orderList .dt-hasChild > td:first-child {
    border-left: 1px solid rgba(var(--dt-row-selected), 0.2);
    border-top-left-radius: 1rem;
}

#orderList .dt-hasChild > td:last-child {
    border-right: 1px solid rgba(var(--dt-row-selected), 0.2);
    border-top-right-radius: 1rem;
}

#order-item-count {
    margin-right: 0rem;
}

/* Inventory List */

#inventoryList > thead > tr > th {
    white-space: nowrap;
}

#inventoryList > thead > tr:first-child > th:first-child {
    border-bottom: none;
}

#inventoryList > tbody > tr > td:not(:first-child) {
    padding: 0.7rem;
}

#inventoryList > tbody > tr > td:first-child {
    position: relative;
    padding: 0;
    min-width: 100px;
}

.row-border > tbody > tr > td:first-child {
    border-block: none !important;
}

#inventoryList img {
    z-index: 0;
    max-width: 80px;
    transition: scale 100ms ease,
        transform 100ms ease; 
}

#inventoryList > tbody > tr.selected > td:first-child,
#inventoryList > tbody > tr.selected:hover > td:first-child,
#inventoryList > tbody > tr:hover > td:first-child {
    box-shadow: none !important
}

#inventoryList > tbody > tr.selected > td:first-child > img {
    position: relative;
    scale: 2.2;
    z-index: 1;
    border-radius: 0.5rem;
    transform: translateX(-1.6rem);
}

#inventoryList > tbody > tr > td[data-value="0"] {
    font-weight: 400;
    color: black;
}

#inventoryList > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: white;
}

#inventoryList_wrapper > div:nth-child(1) > div.dt-layout-cell.dt-layout-end {
    margin-inline: auto;
}

input#dt-search-0 {
    min-width: 30ch;
    text-align: center !important;
    padding-block: 0.2rem !important;
    border-radius: 12px !important;
    margin-bottom: 1.5rem !important;
}

input#dt-search-0:hover {
    border-color: var(--accent-color) !important;
}

.dt-empty {
    padding: 1rem !important;
}

/* Utility Classes */
.grid-template-col-8 {
    grid-template-columns: repeat(8, auto);
}

.grid-col-span-3 {
    grid-column: span 3;
}

.grid-col-span-4 {
    grid-column: span 4;
}

.grid-col-span-8 {
    grid-column: span 8;
}

.column-separator {
    border-left: 1px dashed rgba(0, 0, 0, 0.3)
}

.txt-align-center {
    text-align: center;
}

.txt-align-right {
    text-align: right;
}

.font-strong {
    font-weight: 600;
}

.clr-accent {
    color: var(--accent-color);
}

.clr-green {
    color: var(--green-color);
}

.clr-blue {
    color: var(--blue-color);
}

.clr-orange {
    color: var(--warning-color);
}

.padding-left-2rem {
    padding-left: 2rem;
}

.drop-shadow {
    filter: 
    drop-shadow(.5px 1px 1px hsl(285deg 40% 40% / .03)) 
    drop-shadow(1px 2px 2px hsl(285deg 40% 40% / .03)) 
    drop-shadow(2px 4px 4px hsl(285deg 40% 40% / .03)) 
    drop-shadow(4px 8px 8px hsl(285deg 40% 40% / .03)) 
    drop-shadow(8px 16px 16px hsl(285deg 40% 40% / .03));
}

.image-dimmed {
    opacity: 0.3;
}

.cursor-default {
    cursor: default !important;
}

.input-required {
    border: 1px solid red;
}

/* jQuery Datetime Picker */
.xdsoft_datetimepicker {
    z-index: 10000
}

input#document_date, 
input#expected_date,
input#edit-document_date,
input#edit-expected_date {
    width: 13ch;
}

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

.dt-scroll-body::-webkit-scrollbar {
    border-radius: 10px;
    width: 7px;
    height: 2px;
}
.dt-scroll-body::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
}
