/**
 * Sameday AWB Module — Modal & UI Styles
 * Dolibarr ERP — organicsfood.ro
 */

/* ── Modal Overlay ── */
.sameday-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

/* ── Modal Container ── */
.sameday-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 780px;
    max-width: 96vw;
    max-height: 96vh;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Modal Header ── */
.sameday-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #263c5c;
    color: #fff;
    border-bottom: 2px solid #1a2d45;
}

.sameday-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.sameday-modal-header h3 .fas {
    margin-right: 8px;
    opacity: 0.85;
}

.sameday-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.sameday-modal-close:hover {
    opacity: 1;
}

/* ── Modal Body ── */
.sameday-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(96vh - 130px);
}

/* ── Loading Spinner ── */
.sameday-loading {
    text-align: center;
    padding: 40px 20px;
    color: #555;
    font-size: 14px;
}

.sameday-loading .fas {
    margin-right: 8px;
    color: #263c5c;
}

/* ── Modal Footer ── */
.sameday-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #ddd;
    background: #f7f7f7;
}

/* ── Form Table ── */
.sameday-form-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sameday-form-table td {
    padding: 5px 6px;
    vertical-align: top;
}

.sameday-form-table td:first-child {
    width: 160px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    padding-top: 8px;
}

.sameday-form-table input[type="text"],
.sameday-form-table input[type="number"],
.sameday-form-table input[type="email"],
.sameday-form-table select,
.sameday-form-table textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.sameday-form-table input:focus,
.sameday-form-table select:focus,
.sameday-form-table textarea:focus {
    border-color: #263c5c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(38, 60, 92, 0.15);
}

.sameday-form-table textarea {
    min-height: 50px;
    resize: vertical;
}

/* ── Section Headers ── */
.sameday-section-header td {
    padding: 10px 6px 4px;
    border-bottom: 2px solid #263c5c;
    font-size: 13px;
    font-weight: 700;
    color: #263c5c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sameday-section-header td .fas {
    margin-right: 6px;
    opacity: 0.7;
}

/* ── Parcel Rows ── */
.sameday-parcel-row td {
    background: #f9fbfd;
}

.sameday-parcel-row:nth-child(even) td {
    background: #f2f5f9;
}

.sameday-parcel-dimensions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sameday-parcel-dimensions input {
    width: 70px !important;
    text-align: center;
}

.sameday-parcel-dimensions span {
    color: #888;
    font-size: 12px;
}

/* ── Buttons ── */
.sameday-modal .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.sameday-modal .button:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.sameday-modal .button-primary {
    background: #263c5c;
    border-color: #1a2d45;
    color: #fff;
}

.sameday-modal .button-primary:hover {
    background: #1e3250;
}

.sameday-modal .button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sameday-btn-add-parcel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid #4a9d4a;
    border-radius: 3px;
    background: #e8f5e8;
    color: #2d7a2d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.sameday-btn-add-parcel:hover {
    background: #d4ecd4;
}

.sameday-btn-remove-parcel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid #d44;
    border-radius: 3px;
    background: #fee;
    color: #d44;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
}

.sameday-btn-remove-parcel:hover {
    background: #fdd;
}

/* ── Success Message ── */
.sameday-success {
    text-align: center;
    padding: 20px;
}

.sameday-success .fas.fa-check-circle {
    font-size: 48px;
    color: #28a745;
    margin-bottom: 12px;
}

.sameday-success h4 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #28a745;
}

.sameday-success-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}

.sameday-success-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
}

.sameday-success-table td:first-child {
    font-weight: 600;
    color: #555;
    width: 140px;
}

/* ── Error Message ── */
.sameday-error {
    background: #fef0f0;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px 16px;
    color: #721c24;
    font-size: 13px;
    margin: 10px 0;
}

.sameday-error .fas {
    margin-right: 6px;
}

/* ── Existing AWB Warning ── */
.sameday-existing-awb {
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 4px;
    padding: 12px 16px;
    color: #856404;
    font-size: 13px;
    margin-bottom: 12px;
}

.sameday-existing-awb .fas {
    margin-right: 6px;
}

/* ── Inline helpers ── */
.sameday-hint {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.sameday-readonly {
    background: #f5f5f5 !important;
    color: #666;
}

/* ── Checkbox row ── */
.sameday-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

.sameday-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sameday-modal {
        width: 98vw;
        max-height: 95vh;
    }

    .sameday-modal-body {
        max-height: calc(95vh - 130px);
    }

    .sameday-form-table td:first-child {
        width: 120px;
        font-size: 12px;
    }

    .sameday-parcel-dimensions {
        flex-wrap: wrap;
    }

    .sameday-parcel-dimensions input {
        width: 55px !important;
    }
}
