/**
 * Styling for the courier modals in the admin:
 *  - the waybill (товарителница) form  (#modal_content / #package_form, order_info)
 *  - the address form                  (#speedy_address_form, order_info / order_add / edit_user)
 *
 * Scoped to those containers only - field names, ids and JS-hook classes
 * (speedyAddress*, addressData, toggleOffice...) are untouched.
 */

/* ============================= modal shell ============================= */

#speedyModal .modal-dialog,
#editaddressModal .modal-dialog { max-width: 640px; }

#speedyModal .modal-body,
#editaddressModal .modal-body {
    font-size: 13px;
    color: #333;
    line-height: 1.45;
}

/* ============================ waybill form ============================= */

#modal_content h3 {
    margin: 0 0 10px;
    font-size: 20px;
}

.waybill-section {
    border: 1px solid #e2ddd3;
    border-radius: 4px;
    background: #faf9f6;
    padding: 10px 12px;
    margin: 10px 0;
}

.waybill-section > strong {
    display: block;
    margin-bottom: 6px;
    color: #5b5343;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .4px;
}

#modal_content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

#modal_content table th {
    text-align: left;
    border-bottom: 2px solid #e2ddd3;
    padding: 4px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: #8a8272;
}

#modal_content table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f0ece4;
}

#package_form { margin-top: 4px; }

#package_form .form-group {
    clear: both;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 0 0 10px;
}

#package_form label {
    font-weight: 600;
    color: #5b5343;
    margin: 0;
    cursor: pointer;
}

#package_form input[type="text"] {
    border: 1px solid #cfc8ba;
    border-radius: 3px;
    padding: 6px 8px;
    font-size: 13px;
    background: #fff;
}

#package_form input[type="text"]:focus {
    outline: none;
    border-color: #91AB00;
    box-shadow: 0 0 0 2px rgba(145, 171, 0, .15);
}

#package_form input[type="radio"],
#package_form input[type="checkbox"] {
    margin: 0 4px;
    vertical-align: middle;
}

#package_form span > label { margin-right: 14px; }

#package_form select {
    border: 1px solid #cfc8ba;
    border-radius: 3px;
    padding: 6px 8px;
    font-size: 13px;
    background: #fff;
}

#package_form .last_error,
#modal_content .error {
    background: #f2dede;
    border: 1px solid #ebccd1;
    color: #a94442;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    width: 100%;
}

/* contract clients as a tidy radio list */
#package_form .waybill-section label { font-weight: normal; }
#package_form .waybill-section br { display: none; }
#package_form .waybill-section input[type="radio"] { margin-right: 6px; }

/* ============================ address form ============================= */

#speedy_address_form { font-size: 13px; color: #333; }

#speedy_address_form .info {
    display: block;
    font-weight: 600;
    color: #5b5343;
    margin-bottom: 8px;
}

#speedy_address_form .info + br,
#speedy_address_form .info + br + br { display: none; }

/* courier choice as logo cards */
#speedy_address_form .form-group.row {
    clear: both;
    display: flex;
    gap: 12px;
    margin: 0 0 14px;
}

#speedy_address_form .image-radio {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 64px;
    border: 2px solid #d9d2c4;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    padding: 6px;
    position: relative;
}

#speedy_address_form .image-radio img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

#speedy_address_form .image-radio input[type="radio"] {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
}

#speedy_address_form .image-radio:has(input:checked) {
    border-color: #91AB00;
    box-shadow: 0 0 0 2px rgba(145, 171, 0, .2);
}

/* neutralize the unstyled bootstrap grid classes inside the form */
#speedy_address_form fieldset { border: 0; padding: 0; margin: 0; }

#speedy_address_form .form-group {
    clear: both;
    margin: 0 0 12px;
}

#speedy_address_form .form-group > label,
#speedy_address_form label.siteData,
#speedy_address_form label.divAddressFormLabelBig {
    display: block;
    font-weight: 600;
    color: #5b5343;
    margin: 0 0 3px;
    font-size: 12px;
}

#speedy_address_form input[type="text"],
#speedy_address_form input:not([type]),
#speedy_address_form .form-control {
    width: 100%;
    max-width: 320px;
    border: 1px solid #cfc8ba;
    border-radius: 3px;
    padding: 7px 9px;
    font-size: 13px;
    background: #fff;
    box-sizing: border-box;
}

#speedy_address_form input:focus {
    outline: none;
    border-color: #91AB00;
    box-shadow: 0 0 0 2px rgba(145, 171, 0, .15);
}

#speedy_address_form input[disabled] {
    background: #f0ece4;
    color: #8a8272;
}

/* town row: type + name + postcode inline */
#speedy_address_form #siteType { width: 52px; display: inline-block; }
#speedy_address_form #siteName { width: 150px; display: inline-block; }
#speedy_address_form #postCode { width: 80px; display: inline-block; }
#speedy_address_form label.siteData { display: inline-block; margin: 0 4px; }

/* municipality / region inline */
#speedy_address_form #municipality,
#speedy_address_form #region { width: 150px; display: inline-block; }

/* office checkbox line */
#speedy_address_form .form-check label {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
#speedy_address_form .form-check input[type="checkbox"] { margin: 0; }
#speedy_address_form #active_courier { color: #91AB00; }

/* street row: улица № бл вх ет ап on one line */
#speedy_address_form .row.addressData {
    clear: both;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin: 0 0 4px;
}
#speedy_address_form .row.addressData > div { flex: 0 0 auto; }
#speedy_address_form .row.addressData label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b5343;
    margin-bottom: 3px;
}
#speedy_address_form #streetName { width: 190px; }
#speedy_address_form #streetNo,
#speedy_address_form #blockNo,
#speedy_address_form #entranceNo,
#speedy_address_form #floorNo,
#speedy_address_form #apartmentNo { width: 52px; }

#speedy_address_form .row.addressData + br { display: none; }

/* phone (admin only) */
#speedy_address_form .addressData_ { clear: both; margin: 0 0 12px; }
#speedy_address_form .addressData_ label {
    display: block;
    font-weight: 600;
    color: #5b5343;
    font-size: 12px;
    margin-bottom: 3px;
}

/* action buttons */
#speedy_address_form .btn,
#save_address {
    border: 0;
    border-radius: 3px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}
#speedy_address_form .btn-success { background: #91AB00; color: #fff; }
#speedy_address_form .btn-danger { background: #d9534f; color: #fff; margin-left: 8px; }

#speedy_address_form #message { display: block; color: #a94442; margin: 6px 0; }

/* the standalone edit_address page wraps the same form in a bootstrap-ish
   container - keep it centered and readable there too */
#terms .container { max-width: 720px; margin: 0 auto; padding: 10px 16px; }

/* legacy admin style.css floats form elements - neutralize inside these forms */
#speedy_address_form label,
#speedy_address_form input,
#speedy_address_form .form-group,
#speedy_address_form .row,
#speedy_address_form fieldset,
#package_form label,
#package_form input,
#package_form .form-group,
#package_form span {
    float: none !important;
}
#speedy_address_form .divContainerLeft,
#speedy_address_form .divFormContent { float: none !important; width: auto !important; }

/* Econt sales-reporting section: one radio per line, inline invoice fields */
#econt_report_section label { display: block; margin: 4px 0; font-weight: normal; }
#econt_invoice_fields label { display: inline; margin: 0 6px 0 0; font-weight: 600; }
#econt_invoice_fields input { margin-right: 12px; }

/* receiver address picker inside the waybill modal */
.waybill-address-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; flex-wrap: wrap; }
.waybill-address-row select {
    flex: 1 1 260px;
    border: 1px solid #cfc8ba;
    border-radius: 3px;
    padding: 6px 8px;
    font-size: 13px;
    background: #fff;
    max-width: 100%;
}
.waybill-address-row a { white-space: nowrap; font-weight: 600; }

/* receiver type (person / company) */
#receiver_type_section label { display: block; margin: 4px 0; font-weight: normal; }
#receiver_company_fields label { display: inline; margin: 0 6px 0 0; font-weight: 600; }
#receiver_company_fields input { margin-right: 12px; }

.waybill-address-row a.waybill-danger { color: #a94442; }
.waybill-note { color: #8a8272; font-size: 11px; font-style: italic; }
#speedy_address_form #poluchatel { max-width: 320px; }
