* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f2f4f7;
    color: #222;
}

.dashboard {
    min-height: calc(100vh - 60px);
    padding: 25px;

    background-image: url("../images/backinvarm.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* LOGIN */

.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 350px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.12);
    text-align: center;
}

.login-box h1 {
    margin-bottom: 5px;
}

.login-box p {
    margin-top: 0;
    color: #777;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

#loginMessage {
    margin-top: 12px;
}

/* DASHBOARD */

.topbar {
    min-height: 60px;
    padding: 10px 20px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.topbar strong {
    font-size: 20px;
}

.topbar span {
    margin-left: 10px;
    color: #777;
}

#logoutBtn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.dashboard {
    padding: 25px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 25px;
}

.menu-card {
    background: white;
    padding: 25px;
    min-height: 130px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.menu-card h3 {
    margin-top: 0;
}

.menu-card p {
    color: #777;
}

/* HP */

@media (max-width: 700px) {

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .dashboard {
        padding: 15px;
    }

    .topbar span {
        display: none;
    }

}

.menu-card {
    cursor: pointer;
}

.menu-card:hover {
    transform: translateY(-3px);
}

/* =========================================================
   PEMBELIAN / PENERIMAAN BARANG
   ========================================================= */

#pagePembelian {
    width: 100%;
    box-sizing: border-box;
}

.pembelian-container {
    width: 100%;
    padding: 24px;
    box-sizing: border-box;
    background: #f5f7fa;
    min-height: calc(100vh - 80px);
}

/* ================= HEADER ================= */

.pembelian-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    background: #ffffff;
    border: 1px solid #e1e5ea;
    border-radius: 10px;

    padding: 20px 24px;
    margin-bottom: 18px;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.pembelian-header h2 {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
    color: #263238;
}

.pembelian-subtitle {
    margin-top: 5px;
    font-size: 13px;
    color: #78909c;
}

.pembelian-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================= BUTTON ================= */

.pembelian-container .btn {
    border: none;
    border-radius: 6px;

    padding: 9px 15px;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
    transition: 0.15s ease;
}

.pembelian-container .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.12);
}

.pembelian-container .btn-primary {
    background: #1976d2;
    color: #ffffff;
}

.pembelian-container .btn-secondary {
    background: #607d8b;
    color: #ffffff;
}

.pembelian-container .btn-danger {
    background: #d32f2f;
    color: #ffffff;
}

/* ================= FILTER ================= */

.pembelian-filter {
    display: flex;
    align-items: flex-end;
    gap: 14px;

    background: #ffffff;

    border: 1px solid #e1e5ea;
    border-radius: 10px;

    padding: 18px 20px;
    margin-bottom: 18px;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
}

.filter-item input,
.filter-item select {
    height: 38px;

    padding: 0 10px;

    border: 1px solid #cfd8dc;
    border-radius: 6px;

    background: #ffffff;

    font-size: 13px;
    color: #263238;

    box-sizing: border-box;
}

.filter-item input:focus,
.filter-item select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.filter-item input[type="date"] {
    width: 145px;
}

.filter-item select {
    width: 210px;
}

.filter-do input {
    width: 180px;
}

.filter-button {
    margin-left: auto;
}

.filter-button .btn {
    height: 38px;
}

/* ================= TABLE ================= */

.pembelian-table-wrapper {
    background: #ffffff;

    border: 1px solid #e1e5ea;
    border-radius: 10px;

    overflow-x: auto;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.pembelian-table {
    width: 100%;
    border-collapse: collapse;

    font-size: 13px;

    min-width: 1050px;
}

.pembelian-table thead th {
    background: #eceff1;

    color: #37474f;

    font-weight: 700;

    padding: 12px 10px;

    text-align: left;

    border-bottom: 2px solid #cfd8dc;

    white-space: nowrap;
}

.pembelian-table tbody td {
    padding: 11px 10px;

    border-bottom: 1px solid #eceff1;

    color: #455a64;

    vertical-align: middle;
}

.pembelian-table tbody tr:hover {
    background: #f8fafc;
}

.pembelian-table tbody tr:last-child td {
    border-bottom: none;
}

/* ================= EMPTY DATA ================= */

.pembelian-empty {
    text-align: center !important;

    padding: 45px 20px !important;

    color: #90a4ae !important;

    font-size: 14px;
}

/* ================= STATUS ================= */

.status-badge {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 75px;

    padding: 5px 9px;

    border-radius: 20px;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
}

.status-entry {
    background: #fff3cd;
    color: #856404;
}

.status-closed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ================= AKSI ================= */

.pembelian-action {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.btn-aksi {
    border: 1px solid #cfd8dc;

    background: #ffffff;

    color: #455a64;

    border-radius: 5px;

    padding: 6px 9px;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;
}

.btn-aksi:hover {
    background: #f5f7f8;
}

.btn-aksi-edit {
    color: #1565c0;
    border-color: #90caf9;
}

.btn-aksi-cetak {
    color: #455a64;
}

.btn-aksi-batal {
    color: #c62828;
    border-color: #ef9a9a;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 900px) {

    .pembelian-container {
        padding: 15px;
    }

    .pembelian-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pembelian-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .pembelian-filter {
        flex-wrap: wrap;
    }

    .filter-button {
        margin-left: 0;
    }
}

/* =========================================================
   FORM PENERIMAAN BARANG
   ========================================================= */

.pembelian-form-container {
    width: 100%;
    min-height: calc(100vh - 80px);
    padding: 24px;
    box-sizing: border-box;
    background: #f5f7fa;
}

/* HEADER FORM */

.pembelian-form-container .pembelian-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #ffffff;
    border: 1px solid #e1e5ea;
    border-radius: 10px;

    padding: 20px 24px;
    margin-bottom: 18px;

    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.pembelian-form-container .pembelian-header h2 {
    margin: 0;
    font-size: 22px;
    color: #263238;
}

.pembelian-form-container .pembelian-subtitle {
    margin-top: 5px;
    font-size: 13px;
    color: #78909c;
}

/* FORM CARD */

.pembelian-form {
    background: #ffffff;

    border: 1px solid #e1e5ea;
    border-radius: 10px;

    padding: 22px;

    box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

/* INFORMASI */

.pembelian-form::before {
    content: "INFORMASI PENERIMAAN";

    display: block;

    font-size: 13px;
    font-weight: 700;

    color: #455a64;

    padding-bottom: 12px;
    margin-bottom: 18px;

    border-bottom: 1px solid #eceff1;
}

/* ROW */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 18px;

    margin-bottom: 16px;
}

/* FORM GROUP */

.form-group {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;

    color: #546e7a;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 40px;

    padding: 0 11px;

    box-sizing: border-box;

    border: 1px solid #cfd8dc;
    border-radius: 6px;

    background: #ffffff;

    color: #263238;

    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;

    border-color: #1976d2;

    box-shadow:
        0 0 0 2px rgba(25,118,210,.10);
}

.form-group input[readonly] {
    background: #f5f7f8;
    color: #78909c;
}

/* DETAIL BARANG */

.pembelian-detail {
    margin-top: 26px;

    border: 1px solid #e1e5ea;
    border-radius: 8px;

    overflow: hidden;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 14px 16px;

    background: #f7f9fa;

    border-bottom: 1px solid #e1e5ea;
}

.detail-header h3 {
    margin: 0;

    font-size: 15px;

    color: #37474f;
}

/* DETAIL TABLE */

.pembelian-detail-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 12px;
}

.pembelian-detail-table th {
    padding: 11px 9px;

    background: #eceff1;

    color: #455a64;

    font-weight: 700;

    text-align: left;

    white-space: nowrap;
}

.pembelian-detail-table td {
    padding: 10px 9px;

    border-top: 1px solid #eceff1;

    color: #455a64;
}

.pembelian-detail-table tbody tr:hover {
    background: #fafafa;
}

/* EMPTY */

.pembelian-detail-table .pembelian-empty {
    text-align: center;

    padding: 35px 10px;

    color: #90a4ae;
}

/* TOTAL */

.pembelian-total {
    display: flex;
    justify-content: flex-end;

    margin-top: 20px;

    padding: 16px 20px;

    background: #f7f9fa;

    border: 1px solid #e1e5ea;
    border-radius: 8px;

    gap: 35px;
}

.pembelian-total > div {
    display: flex;
    flex-direction: column;

    align-items: flex-end;

    gap: 5px;
}

.pembelian-total span {
    font-size: 12px;

    color: #78909c;
}

.pembelian-total strong {
    font-size: 15px;

    color: #455a64;
}

.pembelian-total .grand-total {
    padding-left: 30px;

    border-left: 1px solid #cfd8dc;
}

.pembelian-total .grand-total strong {
    font-size: 19px;

    color: #1565c0;
}

/* FORM ACTION */

.pembelian-form-actions {
    display: flex;

    justify-content: flex-end;

    gap: 9px;

    margin-top: 20px;

    padding-top: 18px;

    border-top: 1px solid #eceff1;
}

/* BUTTON */

.pembelian-form-container .btn {
    border: none;

    border-radius: 6px;

    padding: 9px 16px;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;

    transition: .15s ease;
}

.pembelian-form-container .btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 3px 7px rgba(0,0,0,.12);
}

.pembelian-form-container .btn-primary {
    background: #1976d2;
    color: #ffffff;
}

.pembelian-form-container .btn-danger {
    background: #d32f2f;
    color: #ffffff;
}

/* RESPONSIVE */

@media (max-width: 800px) {

    .pembelian-form-container {
        padding: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pembelian-total {
        flex-direction: column;
        align-items: flex-end;

        gap: 12px;
    }

    .pembelian-total .grand-total {
        border-left: none;

        border-top: 1px solid #cfd8dc;

        padding-left: 0;
        padding-top: 12px;
    }
}

/* =========================================================
   MODAL TAMBAH DETAIL PEMBELIAN
   ========================================================= */

.modal-detail-pembelian {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;

    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.45);

    padding: 20px;

    box-sizing: border-box;
}

.modal-detail-box {
    width: 100%;
    max-width: 520px;

    background: #ffffff;

    border-radius: 12px;

    box-shadow:
        0 15px 45px rgba(0,0,0,.25);

    overflow: hidden;
}

.modal-detail-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    padding: 18px 20px;

    border-bottom: 1px solid #e1e5ea;
}

.modal-detail-header h3 {
    margin: 0;

    font-size: 17px;

    color: #263238;
}

.modal-detail-subtitle {
    margin-top: 4px;

    font-size: 12px;

    color: #90a4ae;
}

.modal-detail-close {
    border: none;

    background: transparent;

    font-size: 27px;

    line-height: 1;

    color: #78909c;

    cursor: pointer;
}

.modal-detail-body {
    padding: 20px;
}

.detail-form-group {
    display: flex;

    flex-direction: column;

    gap: 6px;

    margin-bottom: 15px;
}

.detail-form-group label {
    font-size: 12px;

    font-weight: 600;

    color: #546e7a;
}

.detail-form-group input,
.detail-form-group select {
    width: 100%;

    height: 40px;

    box-sizing: border-box;

    padding: 0 11px;

    border: 1px solid #cfd8dc;

    border-radius: 6px;

    font-size: 13px;
}

.detail-form-group input:focus,
.detail-form-group select:focus {
    outline: none;

    border-color: #1976d2;

    box-shadow:
        0 0 0 2px rgba(25,118,210,.10);
}

.detail-form-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 14px;
}

.detail-subtotal {
    display: flex;

    justify-content: space-between;
    align-items: center;

    padding: 14px 15px;

    margin-top: 5px;

    background: #f5f7fa;

    border-radius: 7px;
}

.detail-subtotal span {
    font-size: 12px;

    color: #607d8b;
}

.detail-subtotal strong {
    font-size: 17px;

    color: #1565c0;
}

.modal-detail-footer {
    display: flex;

    justify-content: flex-end;

    gap: 8px;

    padding: 15px 20px;

    border-top: 1px solid #e1e5ea;

    background: #fafafa;
}

@media (max-width: 600px) {

    .detail-form-row {
        grid-template-columns: 1fr;
    }

}

/* =========================================================
   MODAL BARANG BARU
   ========================================================= */

.modal-barang-baru {

    position: fixed;

    inset: 0;

    z-index: 10000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.45);

    box-sizing: border-box;
}


.modal-barang-box {

    width: 100%;

    max-width: 600px;

    max-height: 90vh;

    background: #ffffff;

    border-radius: 12px;

    box-shadow:
        0 18px 50px rgba(0,0,0,.25);

    display: flex;

    flex-direction: column;

    overflow: hidden;
}


/* HEADER */

.modal-barang-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 18px 22px;

    border-bottom: 1px solid #e1e5e8;
}


.modal-barang-header h3 {

    margin: 0;

    font-size: 18px;

    color: #263238;
}


.modal-barang-subtitle {

    margin-top: 4px;

    font-size: 12px;

    color: #90a4ae;
}


.modal-barang-close {

    width: 34px;

    height: 34px;

    border: none;

    background: transparent;

    font-size: 28px;

    line-height: 1;

    color: #78909c;

    cursor: pointer;

    border-radius: 6px;
}


.modal-barang-close:hover {

    background: #f1f3f4;

    color: #263238;
}


/* BODY */

.modal-barang-body {

    padding: 22px;

    overflow-y: auto;
}


.modal-barang-body .form-group {

    margin-bottom: 15px;
}


.modal-barang-body label {

    display: block;

    margin-bottom: 6px;

    font-size: 13px;

    font-weight: 600;

    color: #455a64;
}


.modal-barang-body input,
.modal-barang-body select {

    width: 100%;

    height: 40px;

    padding: 0 11px;

    box-sizing: border-box;

    border: 1px solid #cfd8dc;

    border-radius: 6px;

    background: #ffffff;

    font-size: 13px;
}


.modal-barang-body input:focus,
.modal-barang-body select:focus {

    outline: none;

    border-color: #1976d2;

    box-shadow:
        0 0 0 2px rgba(25,118,210,.10);
}


.modal-barang-body small {

    display: block;

    margin-top: 5px;

    font-size: 11px;

    color: #90a4ae;
}


.modal-barang-body .form-row {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 14px;
}


.required {

    color: #d32f2f;
}


/* INFO */

.barang-baru-info {

    margin-top: 5px;

    padding: 12px 14px;

    background: #f5f8fa;

    border: 1px solid #e1e8ec;

    border-radius: 7px;

    font-size: 12px;

    color: #607d8b;
}


.barang-baru-info strong {

    display: block;

    margin-bottom: 4px;

    color: #455a64;
}


/* FOOTER */

.modal-barang-footer {

    display: flex;

    justify-content: flex-end;

    gap: 8px;

    padding: 15px 22px;

    border-top: 1px solid #e1e5e8;

    background: #fafafa;
}


/* MOBILE */

@media (max-width: 600px) {

    .modal-barang-box {

        max-height: 95vh;

    }


    .modal-barang-body .form-row {

        grid-template-columns: 1fr;

        gap: 0;

    }

}

.modal-send-to-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-send-to {
    width: 420px;
    max-width: calc(100% - 30px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-send-to-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid #ddd;
}

.modal-send-to-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-send-to-close {
    border: none;
    background: transparent;
    font-size: 25px;
    cursor: pointer;
}

.modal-send-to-body {
    padding: 18px;
}

.modal-send-to-body .form-group {
    margin-bottom: 15px;
}

.modal-send-to-body label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.modal-send-to-body input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.modal-send-to-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 18px;
    border-top: 1px solid #ddd;
}
