:root {
    --primary-color: #3F516D;
    --accent-color: #f4c430;
    --bg-color: #f4f7f9;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --input-bg: #f8fafc;
    --border-color: #e2e8f0;
}

/* ===== MAIN WRAPPER ===== */
.peminjaman-wrapper {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
    padding: 50px 60px;
    margin: 60px auto;
    border-top: 8px solid var(--accent-color);
}

/* ===== HEADER ===== */
.form-header {
    text-align: center;
    margin-bottom: 45px;
}

.form-header h2 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 22px !important;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 12px !important;
}

/* ===== SECTION LABELS & INPUTS ===== */
.section-title {
    font-size: 14px !important;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.form-label {
    font-weight: 500;
    font-size: 12px !important;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.form-text {
    font-size: 11px !important;
}

.input-icon-wrapper {
    position: relative;
    z-index: 1;
}

.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 10;
}

.input-icon-wrapper:has(.is-open) {
    z-index: 999;
}

.custom-input {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 15px 14px 45px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    transition: all 0.3s ease;
    width: 100%;
}

.custom-input.no-icon {
    padding-left: 15px;
}

.custom-input:focus {
    background-color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.15);
    outline: none;
}

.input-icon-wrapper:focus-within i {
    color: var(--accent-color);
}

.input-icon-wrapper:has(.is-focused) i,
.input-icon-wrapper:has(.is-open) i {
    color: var(--accent-color);
}

/* ===== BARANG SECTION (CART AREA) ===== */
.barang-section {
    background-color: #fafbfc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    font-size: 15px !important;
    padding: 30px;
    margin-top: 40px;
    margin-bottom: 30px;
}

.barang-section p.text-muted {
    font-size: 11.5px !important;
}

.add-item-bar {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    margin-bottom: 25px;
}

/* ===== MODERN TABLE ===== */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table-custom th {
    background-color: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 16px 20px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

.badge-kategori {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.3px;
}

/* ===== BUTTONS ===== */
.btn-submit {
    background-color: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 14px 35px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-submit:hover:not(:disabled) {
    background-color: #2c394f;
    color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(63, 81, 109, 0.2);
}

.btn-submit:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.btn-tambah {
    background-color: #edf2f7;
    color: var(--primary-color);
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-tambah:hover:not(:disabled) {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-kembali {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.btn-kembali:hover {
    color: var(--primary-color);
}

/* ===== MODERN DROPDOWN (CHOICES.JS) KUSTOMISASI ===== */
.choices {
    margin-bottom: 0;
    width: 100%;
}

.choices__inner {
    background-color: var(--input-bg, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 6.5px 15px 6.5px 45px !important;
    font-size: 14px;
    color: var(--text-dark, #2d3748);
    min-height: 48px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.is-focused .choices__inner,
.is-open .choices__inner {
    background-color: #ffffff;
    border-color: var(--accent-color, #f4c430);
    box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.15);
    border-radius: 12px;
}

.choices__list--dropdown .choices__item {
    color: var(--text-dark, #2d3748) !important;
    font-weight: 500;
    font-size: 12px !important;
    padding: 8px 15px !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--primary-color, #3F516D) !important;
    color: #ffffff !important;
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: #f1f5f9 !important;
    color: var(--primary-color, #3F516D) !important;
    font-weight: 700;
}

.choices__input--cloned {
    border-radius: 8px;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    margin-bottom: 5px;
}

/* ANIMATION */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-terpilih {
    animation: slideInUp 0.4s ease forwards;
}

/* ========================================================= */
/* ===== FIX INPUT JUMLAH (HAPUS SPINNER SECARA PAKSA) ===== */
/* ========================================================= */
input[type="number"]#inputJumlah::-webkit-inner-spin-button,
input[type="number"]#inputJumlah::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

input[type="number"]#inputJumlah {
    -moz-appearance: textfield !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    text-align: center !important;
}

/* ===== RESPONSIVE MOBILE (UPDATED) ===== */
@media (max-width: 768px) {

    /* 1. MENGATASI KESAN SEMPIT: Lebarkan area utama secara maksimal */
    .peminjaman-wrapper {
        padding: 20px 12px;
        margin: 10px -10px;
        border-radius: 16px;
    }

    .barang-section {
        padding: 15px 10px;
        margin-top: 25px;
    }

    .add-item-panel {
        padding: 12px 10px !important;
    }

    /* 2. FIX TEKS KEPOTONG: Menyelaraskan Tinggi (Height) dan Jarak Dalam (Padding) */
    .custom-input {
        height: auto !important;
        min-height: 45px;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* Khusus input teks agar tidak auto-zoom di iPhone */
    input[type="text"].custom-input,
    input[type="number"].custom-input {
        font-size: 16px !important;
    }

    /* 3. FIX DROPDOWN ICON & PANAH */
    .input-icon-wrapper select.custom-input {
        padding-left: 40px !important;
        padding-right: 30px !important;
    }

    .position-relative select.custom-input {
        padding-left: 12px !important;
        padding-right: 30px !important;
    }

    /* 4. MERAPIKAN STOK INFO */
    #infoStokWrapper {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    #infoStokWrapper .text-end {
        text-align: left !important;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px dashed var(--border-color);
        padding-top: 10px;
    }

    /* 5. INPUT JUMLAH & TAMBAH */
    #inputJumlah {
        width: 65px !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    /* 6. FIX TABEL: Pastikan bisa di-scroll ke samping dan tidak memaksakan lebar */
    .cart-area .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        margin-bottom: 0;
        border: 1px solid var(--border-color);
    }

    .cart-area h6 {
        font-size: 13px !important;
    }

    .cart-area .table th,
    .cart-area .table td {
        padding: 12px 10px !important;
        font-size: 12.5px !important;
        white-space: nowrap !important;
    }

    /* 7. TOMBOL BAWAH */
    .btn-kembali,
    .btn-submit {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
}