/* --- Cart Page Display --- */
.per-item-address-display {
    display: block;
    font-size: 0.85em;
    color: #4CAF50; /* Groene kleur om aan te geven dat het adres is ingesteld */
    margin-top: 5px;
    font-weight: 500;
}

.shipment-type-display {
    display: block;
    font-size: 0.85em;
    color: #4CAF50; /* kleur voor verzendtype */
    margin-top: 5px;
    font-weight: 500;
}

.per-item-shipping-link,
.split-items-link {
    font-size: 0.75em;
}

/* --- Modal Base Styles --- */
.wc-per-item-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.wc-per-item-modal-content {
    background-color: #fefefe;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px; /* Iets smaller vanwege minder velden */
    border-radius: .75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    box-sizing: border-box;
}

/* --- Close Button --- */
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.per-item-shipping-modal-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: left;
}

/* --- Form Styles (Matching WC forms) --- */
#per-item-address-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

#per-item-address-form .form-row {
    display: flex;
    flex-direction: column;
}

#per-item-address-form .form-row label {
    flex: 1;
}

#per-item-address-form .form-row-wide, #per-item-address-form .form-actions, #per-item-address-form .per-item-message {
    grid-column: span 2;
}

#per-item-address-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

#per-item-address-form label .required {
    color: red;
    text-decoration: none !important;
}

#per-item-address-form input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}


.wc-per-item-modal .form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* Specific error and success messages */
.per-item-message {
    border-radius: 4px;
    text-align: center;
    clear: both; /* Clear floats before messages */
}

.per-item-message.error {
    background-color: #fdd;
    color: #d33;
    border: 1px solid #d33;
    margin-top: 15px;
    padding: 10px;
}

.per-item-message.success {
    background-color: #dfd;
    color: #38761d;
    border: 1px solid #38761d;
    margin-top: 15px;
    padding: 10px;
}

/* Adjust button placement */
.save-address-button {
    margin-top: 10px;
    margin-right: 10px;
}

.clear-address-button {
    margin-top: 10px;
    background-color: #d33;
    color: white;
}

.clear-address-button:hover {
    background-color: #a00;
}

.wc-per-item-address-display  {
    order: 99;
}

.wc-per-item-link {
    order: 100;
}

.wc-per-item-split-link {
    order: 101;
}

.split-items-link.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Previous Addresses Section --- */
.previous-addresses-section {

    grid-column: span 2;

    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.previous-addresses-section h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1em;
}

.previous-addresses-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;


    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background-color: #fafafa;
}

.previous-address-item {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.previous-address-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.previous-address-item:last-child {
    margin-bottom: 0;
}

.previous-address-item .address-display {
    font-size: 0.9em;
    color: #333;
    line-height: 1.4;
    margin-bottom: 8px;
}

.use-address-button {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.2s ease;
}

.use-address-button:hover {
    background-color: #005a87;
}

.loading-previous-addresses {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}


@media (max-width: 600px) {
    #per-item-address-form {
        grid-template-columns: 1fr;
    }
/*  remove the two column styles to get one column  */

    #per-item-address-form .form-row-wide, #per-item-address-form .form-actions, #per-item-address-form .per-item-message {
        grid-column: span 1;
    }
}
