/* styles.css */
section[name="Calculator"] {
    padding: 1rem;
    margin: 0 1rem;
    border-radius: 2rem;
    background: rgb(0 0 0 / 5%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
section[name="Calculator"] > img[name="head"] {
    width: 100%;
    max-width: 512px;
}
ul[name="plate_type"] {
    width: 100%;
    height: 68px;
    display: flex;
    list-style: none;
    color: #fffad3;
    padding: 0;
    margin: 0;
    border: 2px solid rgb(255 255 255 / 70%);
    border-bottom: none;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
    background: linear-gradient(180deg, #515151, rgb(108 108 108), rgb(76 76 76 / 96%), #373737);
    background-clip: padding-box;
    box-shadow: 0 0px 10px rgb(0 0 0 / 10%);
    overflow: hidden;
    position: relative;
}
ul[name="plate_type"] li {
    flex: 1;
    font-size: 1.1em;
    text-align: center;
    padding: 0.2rem 1rem;
    cursor: pointer;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    user-select: none;
}
ul[name="plate_type"] li:last-child {
    border-right: none;
}
ul[name="plate_type"] li:focus {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
ul[name="plate_type"] li.active {
    font-weight: bold;
    color: #772106;
    border-radius: 1.5rem 1.5rem 0.5rem 0.5rem;
    transition: 0.3s ease-in-out;
    -webkit-tap-highlight-color: transparent;
}
ul[name="plate_type"] li.active > span:nth-child(1) {
    color: white;
}
ul[name="plate_type"] li.active > span:nth-child(2) {
    background: white;
}
ul[name="plate_type"] li span:nth-child(2) {
    font-size: 0.9em;
    color: #782106;
    padding: 3px 10px;
    border-bottom: 2px solid #d09f4c;
    border-radius: 0.8rem;
    background: #e8c792;
}
ul[name="plate_type"] .active-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 100%;
    border-bottom: 2px solid #a5330f;
    background: linear-gradient(180deg, #ecd0a0, #d09e4a);
    transition: left 0.3s ease, width 0.3s ease;
    z-index: 0;
}
.PlatePreview {
    width: 100%;
    max-width: 300px;
    height: auto;
    padding: 0.2rem 0 0 0;
    aspect-ratio: 7/3;
    border: 3px solid black;
    border-radius: 0.5rem;
    background: url("../assets/plate_bg_white.webp") no-repeat center center;
    background-size: contain;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
}
.PlatePreview * {
    font-family: 'Tabien', sans-serif !important;
    white-space: nowrap;
    color: #040405;
    box-sizing: border-box;
    text-align: center;
}
.PlatePreview .LetterNumber {
    width: 100%;
    height: 60px;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    overflow: hidden;
    margin: 0.5rem 0 0 0;
}
.PlatePreview .LetterNumber > div {
    flex: 1;
    height: 60px;
    margin: -0.7rem 0 0 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
}
.PlatePreview .LetterNumber > div > input {
    width: 100%;
    height: 60px;
    font-size: 6.3em;
    text-align: center;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
}
.PlatePreview .LetterNumber > .col1 {
    flex: 1;
}
/* ปรับขนาดช่องป้อนให้ข้อความพอดี */
.PlatePreview .LetterNumber > .col1 > input[name="plate_leading_number"],
.PlatePreview .LetterNumber > .col1 > input[name="plate_letter"],
.PlatePreview .LetterNumber > .col2 > input[name="plate_number"] {
    text-shadow: var(--Text_Bevel);
}
.PlatePreview .LetterNumber > .col1 > input[name="plate_leading_number"] {
    width: 35%;
}
.PlatePreview .LetterNumber > .col1 > input[name="plate_letter"] {
    width: 75%;
    text-align: left;
}
.PlatePreview .LetterNumber > .col2 {
    flex: 1;
}
.PlatePreview .LetterNumber > .col2 > input[name="plate_number"] {
    
}
/* ปิดการแสดงผลปุ่มขึ้น/ลงใน input[type=number] */
.PlatePreview input[type=number]::-webkit-outer-spin-button,
.PlatePreview input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.PlatePreview input[type=number] {
    -moz-appearance: textfield;
}
.PlatePreview .Province {
    width: fit-content;
    line-height: 0.5;
    font-size: clamp(42px, 10vw, 50px);
    color: #040405;
    text-shadow: var(--Text_Bevel);
    transform: scaleX(1.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.PlatePreview[vehicle="motorcycle"] {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 1.26/1;
    font-size: 1em;
    border: 5px solid #353535;
    border-radius: 10px;
    background-image: url("../assets/plate_bg_motocycle_white.webp");
    background-size: contain;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.2rem 0 0 0;
    margin: 0 auto;
}
.PlatePreview[vehicle="motorcycle"] .LetterNumber {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    overflow: hidden;
}
.PlatePreview[vehicle="motorcycle"] .LetterNumber > div {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 3px;
}
.PlatePreview[vehicle="motorcycle"] .LetterNumber > .row_up {
    width: 85%;
}
.PlatePreview[vehicle="motorcycle"] .LetterNumber > .row_up > input[name="plate_leading_number"] {
    width: 45px;
    font-size: 7.3em;
}
.PlatePreview[vehicle="motorcycle"] .LetterNumber > .Province {
    font-size: 2em;
    height: 30px;
    margin: 0.1rem 0 0 0;
}
.input {
    margin: 15px 0;
}
span.sample_des {
    color: #616161;
    padding: 0.5rem;
}
.InputNotice {
    color: #a33c3c;
}
button {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    padding: 0.8rem 2rem;
    border: 2px solid #fee8cb;
    border-bottom: 2px solid #a5330f;
    border-radius: 1.5rem;
    transition: 0.3s ease-in-out;
    cursor: pointer;
}
button#calculate {
    background: linear-gradient(180deg, #ecd0a0, #d09e4a);
}
button#reset {
    background: linear-gradient(180deg, #ffa981, #ed714a);
}
button:hover {
    background: linear-gradient(180deg, #ffd5a2, #ffbb44);
}
button:active {
    transform: scale(0.9);
}
#result {
    margin-top: 20px;
    font-size: 18px;
    color: #333;
    padding: 1rem;
    margin: 0 1rem;
    border-radius: 2rem;
    background: rgb(0 0 0 / 3%);
    display: flex;
    flex-direction: column;
    align-items: center;
}
#result > p.prediction {
    font-size: 1.1em;
    text-indent: 3rem;
    padding: 1rem;
    border-radius: 1.5rem;
    background: #fdf2dd;
}
#plate_leading_number {
    display: none;
}

/* TableResultScore Section */
section[name="TableResultScore"] {
    padding: 1rem;
    display: flex;
    gap: 1em;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}
section[name="TableResultScore"] .ScoreGood,
section[name="TableResultScore"] .ScoreVeryGood {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 1em;
    width: 100%;
}
section[name="TableResultScore"] .ScoreGood span,
section[name="TableResultScore"] .ScoreVeryGood span {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 1em;
    text-align: center;
}
section[name="TableResultScore"] ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    justify-content: center;
}
section[name="TableResultScore"] ul li {
    background: #4caf50;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}
section[name="TableResultScore"] ul li:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
section[name="TableResultScore"] > .ScoreGood ul li {
    background: #e0a74c;
}

/* Media Queries สำหรับ Responsive Design */
@media only screen and (max-width: 480px) {
    section[name="Calculator"] {
        padding: 0.5rem;
        margin: 0 0.5rem;
    }
    ul[name="plate_type"] {
        border-radius: 1.5rem;
    }
    ul[name="plate_type"] li {
        font-size: 0.9em;
        padding: 0.2rem 0.5rem;
    }
    ul[name="plate_type"] li span:nth-child(1) {
        font-size: 0.9em;
        font-weight: normal;
    }
    .PlatePreview {
        max-width: 260px;
    }
    section[name="TableResultScore"] {
        flex-direction: column;
        align-items: center;
    }
}
@media only screen and (min-width: 481px) and (max-width: 768px) {
    section[name="Calculator"] {
        padding: 0.8rem;
        margin: 0 0.8rem;
    }
    ul[name="plate_type"] li {
        font-size: 1em;
        padding: 0.2rem 0.8rem;
    }
    .PlatePreview {
        max-width: 280px;
    }
    section[name="TableResultScore"] {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}
