/* =========================================== */
/* Global Resets & Typography Enhancements */
/* =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================== */
/* Spinner Input Fields */
/* =========================================== */
#weight::-webkit-inner-spin-button,
#weight::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#weight {
	text-align: left !important;
    -moz-appearance: textfield;
}

/* =========================================== */
/* Loader Spinner Enhancements */
/* =========================================== */
.loader {
    display: block;
    width: 50px;
    height: 50px;
    border: 5px solid #d1d5db;
    border-top-color: #034078;
    border-radius: 50%;
    -webkit-animation: spin 0.8s linear infinite;
            animation: spin 0.8s linear infinite;
    margin: 60px auto;
    position: relative;
    -webkit-box-shadow: 0 0 10px rgba(3, 64, 120, 0.1);
            box-shadow: 0 0 10px rgba(3, 64, 120, 0.1);
}

@-webkit-keyframes spin {
    to {
        -webkit-transform: rotate(360deg);
                transform: rotate(360deg);
    }
}

@keyframes spin {
    to {
        -webkit-transform: rotate(360deg);
                transform: rotate(360deg);
    }
}

/* =========================================== */
/* #cek-tarif-form: Default Styling (Stacked & Responsive) */
/* =========================================== */
#cek-tarif-form {
    max-width: 450px; /* Lebar maksimum default */
    margin: 30px auto;
    background-color: #ffffff;
    padding: 30px 35px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    -webkit-box-shadow: 0 8px 25px rgba(3, 64, 120, 0.15);
            box-shadow: 0 8px 25px rgba(3, 64, 120, 0.15);
    font-family: 'Inter', sans-serif, system-ui;
    color: #1e293b;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: -webkit-transform 0.3s ease;
    -o-transition: transform 0.3s ease;
    transition: transform 0.3s ease;
    transition: transform 0.3s ease, -webkit-transform 0.3s ease;
    
    /* Default Flexbox untuk menumpuk elemen secara vertikal */
    display: flex;
    flex-direction: column;
    gap: 22px; /* Jarak antar grup form */
}

#cek-tarif-form:hover {
    -webkit-transform: translateY(-3px);
        -ms-transform: translateY(-3px);
            transform: translateY(-3px);
}

/* Styling default untuk form-group di dalam #cek-tarif-form */
#cek-tarif-form .form-group {
    display: flex;
    flex-direction: column; /* Label di atas input secara default */
    width: 100%; /* Lebar penuh secara default */
}

/* Styling default untuk label */
#cek-tarif-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    font-family: inherit;
    text-transform: capitalize;
    white-space: normal; /* Label diizinkan wrap secara default */
}

/* Styling default untuk input & select */
#cek-tarif-form input[type="text"],
#cek-tarif-form input[type="number"],
#cek-tarif-form select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 0; /* Jarak ditangani oleh gap form-group */
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    -webkit-transition: border-color 0.3s ease, background-color 0.3s ease, -webkit-box-shadow 0.3s ease;
    transition: border-color 0.3s ease, background-color 0.3s ease, -webkit-box-shadow 0.3s ease;
    -o-transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, -webkit-box-shadow 0.3s ease;
    font-family: inherit;
    color: #1e293b;
    background-color: #f8fafc;
}

#cek-tarif-form input[type="text"]:focus,
#cek-tarif-form input[type="number"]:focus,
#cek-tarif-form select:focus {
    border-color: #0369a1;
    outline: none;
    background-color: #ffffff;
    -webkit-box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
            box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
}

/* Styling default untuk tombol submit */
#cek-tarif-form button[type="submit"] {
    background-color: #0371a1;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 17px;
    cursor: pointer;
    color: #ffffff;
    -webkit-transition: background-color 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    transition: background-color 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    -o-transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    width: 100%; /* Lebar penuh secara default */
    font-weight: 600;
    font-family: inherit;
    -webkit-box-shadow: 0 4px 10px rgba(3, 113, 161, 0.2);
            box-shadow: 0 4px 10px rgba(3, 113, 161, 0.2);
    margin-top: 0; /* Tidak ada margin-top khusus untuk layout default */
}

#cek-tarif-form button[type="submit"]:hover {
    background-color: #025f8e;
    -webkit-transform: translateY(-2px);
        -ms-transform: translateY(-2px);
            transform: translateY(-2px);
    -webkit-box-shadow: 0 6px 15px rgba(3, 113, 161, 0.3);
            box-shadow: 0 6px 15px rgba(3, 113, 161, 0.3);
}

#cek-tarif-form button[type="submit"]:active {
    -webkit-transform: translateY(0);
        -ms-transform: translateY(0);
            transform: translateY(0);
    -webkit-box-shadow: 0 2px 5px rgba(3, 113, 161, 0.15);
            box-shadow: 0 2px 5px rgba(3, 113, 161, 0.15);
}

/* =========================================== */
/* Responsive Adjustments (Default untuk #cek-tarif-form) */
/* =========================================== */
@media (max-width: 600px) {
    #cek-tarif-form {
        margin: 15px auto;
        padding: 20px 20px;
        border-radius: 8px;
    }

    #cek-tarif-form label {
        font-size: 14px;
    }

    #cek-tarif-form input[type="text"],
    #cek-tarif-form input[type="number"],
    #cek-tarif-form select {
        padding: 10px 12px;
        font-size: 13px;
    }

    #cek-tarif-form button[type="submit"] {
        padding: 12px 15px;
        font-size: 15px;
    }
}

/* =========================================== */
/* #cek-tarif-form.one-line-form: Mode Satu Baris (Desktop) */
/* =========================================== */
#cek-tarif-form.one-line-form {
    flex-direction: row; /* Atur ke baris */
    flex-wrap: wrap; /* Izinkan wrapping di mobile, tapi defaultnya tetap satu baris di desktop */
    align-items: flex-end; /* Sejajarkan item ke bawah */
    max-width: none; /* Hilangkan max-width default */
    padding: 20px; /* Padding untuk layout satu baris */
    gap: 20px; /* Jarak antar field */
    /* Remove default margin: 30px auto; as max-width: none would make it off-center */
    margin: 0 auto; /* Center the form in one-line mode if it doesn't take full width */
	min-width: max-content;
}

/* Aturan untuk .form-group saat .one-line-form aktif */
#cek-tarif-form.one-line-form .form-group {
    flex-shrink: 1; /* Izinkan menyusut */
    flex-grow: 1; /* Izinkan tumbuh */
    width: auto; /* Lebar otomatis */
    min-width: 150px; /* Lebar minimum */
    flex-basis: auto; /* Ukuran natural */
    justify-content: flex-start; /* Sejajarkan label ke atas */
}

/* Aturan untuk label saat .one-line-form aktif */
#cek-tarif-form.one-line-form label {
    margin-bottom: 5px;
    font-size: 14px;
    white-space: nowrap; /* Cegah label wrap di desktop one-line */
}

/* Aturan untuk input & select saat .one-line-form aktif */
#cek-tarif-form.one-line-form input[type="text"],
#cek-tarif-form.one-line-form input[type="number"],
#cek-tarif-form.one-line-form select {
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 0;
}

/* Aturan untuk tombol submit saat .one-line-form aktif */
#cek-tarif-form.one-line-form button[type="submit"] {
    width: auto;
    padding: 12px 25px;
    font-size: 16px;
    margin-top: 25px; /* Sesuaikan secara manual */
    flex-shrink: 0; /* Cegah penyusutan */
}

/* =========================================== */
/* Responsive Adjustments untuk #cek-tarif-form.one-line-form (Kembali ke Stack di Mobile) */
/* =========================================== */
@media (max-width: 768px) { /* Anda bisa sesuaikan breakpoint ini */
    #cek-tarif-form.one-line-form {
        flex-direction: column; /* Kembali menumpuk di mobile */
        flex-wrap: nowrap; /* Pastikan tidak ada wrapping tak terduga */
        gap: 15px; /* Jarak antar field saat bertumpuk */
        padding: 15px; /* Padding lebih kecil di mobile */
        max-width: none; /* Izinkan form mengambil lebar penuh */
        margin: 15px auto; /* Margin di mobile */
    }

    #cek-tarif-form.one-line-form .form-group {
        width: 100%; /* Lebar penuh di mobile */
        min-width: unset; /* Hilangkan min-width */
    }

    #cek-tarif-form.one-line-form label {
        white-space: normal; /* Izinkan label wrap lagi di mobile */
        font-size: 14px; /* Sesuaikan ukuran font */
        margin-bottom: 8px; /* Kembalikan margin standar */
    }

    #cek-tarif-form.one-line-form input[type="text"],
    #cek-tarif-form.one-line-form input[type="number"],
    #cek-tarif-form.one-line-form select {
        padding: 10px;
        font-size: 13px;
    }

    #cek-tarif-form.one-line-form button[type="submit"] {
        width: 100%; /* Tombol lebar penuh di mobile */
        margin-top: 10px; /* Sesuaikan margin-top */
        padding: 12px 15px;
        font-size: 15px;
    }
}


/* =========================================== */
/* jQuery UI Autocomplete Enhancements (No changes here) */
/* =========================================== */
.ui-autocomplete {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px 0;
    margin: 5px 0 0 0;
    list-style: none;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    -webkit-box-shadow: 0 6px 18px rgba(3,64,120,0.18);
            box-shadow: 0 6px 18px rgba(3,64,120,0.18);
    font-size: 15px;
    font-family: inherit;
    color: #1e293b;
    z-index: 1000;
}

.ui-menu-item-wrapper {
    padding: 10px 15px;
    cursor: pointer;
    -webkit-transition: background-color 0.2s ease, color 0.2s ease;
    -o-transition: background-color 0.2s ease, color 0.2s ease;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 4px;
}

.ui-menu-item.ui-state-active .ui-menu-item-wrapper {
    background-color: #e0f2fe;
    color: #025f8e;
}

/* =========================================== */
/* jQuery UI Dialog Overrides & Result Display (No changes here) */
/* =========================================== */
#cek-tarif-result.ui-dialog-content {
    font-size: 15px;
    color: #1e293b;
    font-family: inherit;
}

#cek-tarif-result h3 {
    margin-top: 0;
    font-weight: 700;
    font-size: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 15px;
    color: #0f172a;
}

#cek-tarif-result ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

#cek-tarif-result li {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: justify;
        -ms-flex-pack: justify;
            justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    -webkit-transition: background-color 0.2s ease;
    -o-transition: background-color 0.2s ease;
    transition: background-color 0.2s ease;
}

#cek-tarif-result li:last-child {
    border-bottom: none;
}

#cek-tarif-result li:hover {
    background-color: #f8fafc;
}

#cek-tarif-result li img {
    width: 90px;
    height: 90px;
    -o-object-fit: cover;
       object-fit: cover;
    margin-right: 20px;
    border-radius: 8px;
    -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    -webkit-transition: -webkit-transform 0.2s ease;
    transition: -webkit-transform 0.2s ease;
    -o-transition: transform 0.2s ease;
    transition: transform 0.2s ease, -webkit-transform 0.2s ease;
}

#cek-tarif-result li img:hover {
    -webkit-transform: scale(1.05);
        -ms-transform: scale(1.05);
            transform: scale(1.05);
}

#cek-tarif-result li > div {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #334155;
}

#cek-tarif-result li strong {
    font-size: 1.3em;
    color: #1e293b;
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    text-align: left;
    width: 100%;
}
.service-details span {
    display: block;
    font-size: 0.95em;
    color: #64748b;
    line-height: 1.4;
}

#cek-tarif-result li div span {
    display: block;
    font-size: 0.95em;
    color: #64748b;
    margin-top: 4px;
}

/* =========================================== */
/* Dialog & Buttons (No changes here) */
/* =========================================== */
.ui-dialog {
    border-radius: 12px;
    -webkit-box-shadow: 0 10px 30px rgba(3,64,120,0.15);
            box-shadow: 0 10px 30px rgba(3,64,120,0.15);
    background-color: #f9fafb;
    color: #1e293b;
    font-family: 'Inter', sans-serif, system-ui;
    width: 90% !important;
    max-width: 750px !important;
    outline: none;
}

.ui-dialog-titlebar.ui-corner-all.ui-widget-header.ui-helper-clearfix.ui-draggable-handle {
    background-color: white;
    border: none;
}

.ui-dialog-titlebar {
    background-color: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    padding: 15px 25px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    font-weight: 700;
    font-size: 18px;
    color: #0f172a;
    font-family: inherit;
}

.ui-dialog-titlebar-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    -webkit-transition: color 0.25s ease, -webkit-transform 0.2s ease;
    transition: color 0.25s ease, -webkit-transform 0.2s ease;
    -o-transition: color 0.25s ease, transform 0.2s ease;
    transition: color 0.25s ease, transform 0.2s ease;
    transition: color 0.25s ease, transform 0.2s ease, -webkit-transform 0.2s ease;
    font-family: inherit;
}

.ui-dialog-titlebar-close:hover {
    color: #1e293b;
    -webkit-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
            transform: rotate(90deg);
}

.ui-dialog-content {
    font-size: 16px;
    line-height: 1.6;
    color: #334155;
    background-color: #ffffff;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    font-family: inherit;
}

.ui-dialog-buttonpane {
    background-color: #f1f5f9;
    border-top: 1px solid #cbd5e1;
    padding: 15px 25px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    font-family: inherit;
    text-align: right;
}

.ui-dialog .ui-dialog-buttonpane {
    display: none !important;
}

.ui-dialog-buttonset button {

    background-color: #0371a1;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 15px;
    color: #ffffff;
    cursor: pointer;
    -webkit-transition: background-color 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    transition: background-color 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    -o-transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.3s ease;
    font-family: inherit;
    font-weight: 600;
    margin-left: 10px;
    -webkit-box-shadow: 0 2px 6px rgba(3, 113, 161, 0.15);
            box-shadow: 0 2px 6px rgba(3, 113, 161, 0.15);
}

.ui-dialog-buttonset button:hover {
    background-color: #025f8e;
    -webkit-transform: translateY(-1px);
        -ms-transform: translateY(-1px);
            transform: translateY(-1px);
    -webkit-box-shadow: 0 4px 10px rgba(3, 113, 161, 0.25);
            box-shadow: 0 4px 10px rgba(3, 113, 161, 0.25);
}

.ui-dialog-buttonset button:active {
    -webkit-transform: translateY(0);
        -ms-transform: translateY(0);
            transform: translateY(0);
    -webkit-box-shadow: 0 1px 3px rgba(3, 113, 161, 0.1);
            box-shadow: 0 1px 3px rgba(3, 113, 161, 0.1);
}

/* =========================================== */
/* Responsive Adjustments (Default untuk #cek-tarif-result sections) */
/* =========================================== */
@media (max-width: 600px) {
    .ui-dialog {
        border-radius: 8px;
    }

    .ui-dialog-titlebar {
        padding: 10px 15px;
        font-size: 16px;
    }

    .ui-dialog-content {
        padding: 20px 25px !important;
        font-size: 14px;
    }

    .ui-dialog-buttonpane {
        padding: 10px 15px;
    }

    .ui-dialog-buttonset button {
        padding: 8px 12px;
        font-size: 13px;
        margin-left: 5px;
    }

    #cek-tarif-result li img {
        width: 70px;
        height: 70px;
        margin-right: 10px;
    }

    #cek-tarif-result li strong {
        font-size: 1.1em;
    }

    #cek-tarif-result li div span {
        font-size: 0.85em;
    }
}


/* =========================================== */
/* Custom Shipping Table (No changes here) */
/* =========================================== */
.custom-shipping-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    color: #333;
}

.custom-shipping-table thead .table-header {
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
}

.custom-shipping-table th, 
.custom-shipping-table td {
    padding: 10px 12px;
    vertical-align: top;
}

.th-service {
    text-align: left;
    width: 25%;
}

.th-route {
   text-align: left;
    width: 30%;
}

.th-weight {
   text-align: left;
    width: 10%;
}

.th-price {
    text-align: left;
    width: 20%;
}

.th-estimate {
    text-align: left;
    width: 15%;
}

.table-row {
    border-bottom: 1px solid #eee;
}

.service-image {
    width: 80px;
    height: auto;
    display: block;
    margin-bottom: 5px;
}

.service-subtitle {
    color: #888;
    font-size: 0.85em;
    font-style: italic;
}

.price-note {
    color: #888;
    font-size: 0.8em;
    display: block;
    margin-top: 3px;
}

/* === Responsive Style (Default for custom-shipping-table) === */
@media screen and (max-width: 768px) {
    .custom-shipping-table,
    .custom-shipping-table thead,
    .custom-shipping-table tbody,
    .custom-shipping-table th,
    .custom-shipping-table td,
    .custom-shipping-table tr {
        display: block;
        width: 100%;
    }

    .custom-shipping-table thead tr {
        display: none;
    }

    .table-row {
        margin-bottom: 15px;
        padding: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 6px;
    }

    .custom-shipping-table td {
        padding: 8px 10px;
        border: none;
        position: relative;
        text-align: left;
        border-bottom: 1px solid #eee;
    }

    .custom-shipping-table td:nth-of-type(1)::before { content: "Layanan"; font-weight: bold; }
    .custom-shipping-table td:nth-of-type(2)::before { content: "Asal - Tujuan"; font-weight: bold; }
    .custom-shipping-table td:nth-of-type(3)::before { content: "Berat"; font-weight: bold; }
    .custom-shipping-table td:nth-of-type(4)::before { content: "Harga"; font-weight: bold; }
    .custom-shipping-table td:nth-of-type(5)::before { content: "Estimasi"; font-weight: bold; }

    .custom-shipping-table td::before {
        display: inline-block;
        width: 100%;
        font-weight: 600;
        color: #555;
        vertical-align: top;
    }

    .service-image {
        width: 60px;
    }
}



/* =========================================== */
/* Form Validation Styling */
/* =========================================== */

/* Style untuk input yang tidak valid (border merah) */
#cek-tarif-form input.invalid,
#cek-tarif-form select.invalid {
    border-color: #dc3545; /* Merah */
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25); /* Shadow merah */
}

/* Style untuk pesan error */
#cek-tarif-form .error-message {
    color: #dc3545; /* Teks merah */
    font-size: 0.85em; /* Ukuran font lebih kecil */
    margin-top: 5px; /* Jarak dari input */
    display: block; /* Pastikan di baris baru */
    height: 1.2em; /* Alokasikan ruang agar tidak ada layout shift */
    line-height: 1.2em;
}

/* Sembunyikan pesan error secara default */
#cek-tarif-form .error-message:empty {
    display: none;
}


/* =========================================== */
/* No Results Found Styling */
/* =========================================== */
.no-results-message {
    text-align: center;
    padding: 30px 20px;
    font-family: 'Inter', sans-serif, system-ui;
    color: #4a5568;
}

.no-results-message .icon-placeholder {
    font-size: 60px; /* Ukuran ikon yang cukup besar */
    color: #a0aec0; /* Warna abu-abu yang soft */
    margin-bottom: 20px;
    display: block; /* Pastikan ikon di baris sendiri */
}

.no-results-message h3 {
    font-size: 24px;
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 700;
}

.no-results-message p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 0;
    color: #64748b;
}

/* Responsiveness untuk tampilan no-results */
@media (max-width: 600px) {
    .no-results-message {
        padding: 20px 15px;
    }
    .no-results-message .icon-placeholder {
        font-size: 50px;
        margin-bottom: 15px;
    }
    .no-results-message h3 {
        font-size: 20px;
    }
    .no-results-message p {
        font-size: 14px;
    }
}