*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    font-family: 'Rubik', sans-serif;
    color: #555555;
    font-size: 14px;
    line-height: 1.65;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    line-height: 1.5;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    -webkit-appearance: button;
    appearance: button;
}

input,
select,
textarea {
    min-width: 0;
}

img {
    max-width: 100%;
}

.rma-page-wrap {
    max-width: 100% !important;
    margin: 0 auto;
    padding: 20px 15px 60px;
    width: 100%;
}

.rma-page-title {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 25px;
    line-height: 1.2;
}
@media (max-width: 575px) {
    .rma-page-wrap {
        padding: 14px 12px 40px;
    }
    .rma-page-title {
        font-size: 24px;
        margin: 6px 0 18px;
    }
}

.required {
    color: #FF0000;
}

/* Alerts */
.rma-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid transparent;
}
.rma-alert i {
    font-size: 20px;
    margin-top: 2px;
}
.rma-alert strong {
    display: block;
    margin-bottom: 2px;
}
.rma-alert p {
    margin: 0;
    font-size: 14px;
}
.rma-alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.rma-alert-success i { color: #16a34a; }
.rma-alert-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.rma-alert-error i { color: #dc2626; }
.rma-alert-top {
    margin-top: 0;
    margin-bottom: 24px;
}

/* Sections */
.rma-section {
    margin-bottom: 0;
}
.rma-section-header {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background-color: #1D62B2;
    padding: 10px 16px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rma-section-body {
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 20px;
    background: #fff;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.rma-section-body-flush {
    padding: 0;
    overflow: hidden;
}
@media (max-width: 575px) {
    .rma-section-header {
        font-size: 13px;
        padding: 9px 12px;
    }
    .rma-section-body {
        padding: 14px;
        margin-bottom: 18px;
    }
}

.rma-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}
.rma-grid-2 {
    grid-template-columns: minmax(0, 1fr);
}
.rma-grid-3 {
    grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 576px) {
    .rma-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rma-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .rma-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.rma-col-span-2 {
    grid-column: 1 / -1;
}
.rma-grid > .form-group {
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-group .form-control {
    width: 100% !important;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    color: #1f2937;
    background: #fff;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
@media (max-width: 575px) {
    /* 16px prevents iOS Safari from auto-zooming the page on focus */
    .form-group .form-control {
        font-size: 16px;
    }
}
.form-group .form-control:focus {
    outline: none;
    border-color: #1D62B2;
    box-shadow: 0 0 0 2px rgba(82,160,242,0.25);
}
.form-control.is-invalid,
select.form-control.is-invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
    background-image: none !important;
    padding-right: 12px !important;
}
.rma-readonly {
    background-color: #f9fafb;
    cursor: not-allowed;
    color: #4b5563;
}

/* Select2 (country / state pickers) styled to match .form-control */
.rma-select2 {
    width: 100%;
}
.select2-container--default .select2-selection--single {
    width: 100%;
    height: auto;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 32px 10px 12px;
    background: #fff;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.4;
    font-size: 14px;
    color: #1f2937;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 0;
    right: 8px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    outline: none;
    border-color: #1D62B2;
    box-shadow: 0 0 0 2px rgba(82,160,242,0.25);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #1D62B2;
}
.select2-dropdown {
    border-color: #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}
@media (max-width: 575px) {
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 16px;
    }
}
.rma-select2-invalid .select2-selection--single {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

.rma-error-msg {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
    min-height: 0;
}
.rma-error-msg:empty {
    display: none;
}

.rma-notice {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    background-color: #f9fafb;
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.rma-items-error-top {
    padding: 14px 16px 0;
}
.rma-items-error-top:empty {
    padding: 0;
}

/* Product table */
.rma-table-scroll {
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.rma-item-table {
    width: 100% !important;
    border-collapse: collapse;
    table-layout: fixed;
}
.rma-item-table thead tr {
    background-color: rgba(249,250,251,0.8);
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
.rma-item-table th {
    padding: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
}
.rma-col-num { width: 48px; text-align: center; }
.rma-col-sku { width: 18%; }
.rma-col-qty { width: 80px; text-align: left; }
.rma-col-reason { width: 26%; }
.rma-col-other { width: 34%; }
.rma-col-remove { width: 40px; text-align: center; }
.rma-item-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
}
.rma-item-table tbody tr:hover {
    background-color: rgba(249,250,251,0.5);
}
.rma-item-table td {
    padding: 12px;
    vertical-align: top;
    overflow-wrap: anywhere;
}
.rma-item-table .rma-col-num {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    padding-top: 20px;
}
.rma-qty-input {
    text-align: center;
}

.rma-btn-remove {
    color: #ef4444;
    background-color: transparent;
    border: none;
    padding: 8px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s ease-in-out;
}
.rma-btn-remove:hover {
    color: #dc2626;
    background-color: #fee2e2;
}

.rma-items-footer {
    padding: 14px 16px;
    background-color: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.rma-btn-add {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.rma-btn-add:hover {
    background-color: #f3f4f6;
}

.rma-section-body,
.rma-alert,
.rma-notice,
.rma-signature-preview {
    overflow-wrap: anywhere;
}

.rma-signature-preview,
.rma-certify-check,
.rma-items-footer {
    max-width: 100% !important;
}

/* Responsive: stack the item table into cards on small screens */
@media (max-width: 767px) {
    .rma-item-table thead {
        display: none;
    }
    .rma-item-table, .rma-item-table tbody, .rma-item-table tr, .rma-item-table td {
        display: block;
        width: 100% !important;
    }
    .rma-item-table tr {
        padding: 14px;
        position: relative;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        margin-bottom: 12px;
        background: #fff;
    }
    .rma-item-table td {
        padding: 7px 0;
    }
    .rma-item-table td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: #6b7280;
        margin-bottom: 4px;
    }
    .rma-col-num {
        display: none !important;
    }
    .rma-col-remove {
        position: static;
        display: flex;
        justify-content: flex-end;
        width: 100%;
        padding: 4px 0 0 !important;
    }
    .rma-col-remove .rma-btn-remove {
        margin-left: auto;
        padding: 6px;
    }
    .rma-item-table .form-control {
        width: 100%;
    }
    .rma-table-scroll {
        overflow-x: visible;
    }
}

/* Signature preview */
.rma-signature-preview {
    margin: 20px 0;
    padding: 16px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background-color: rgba(249,250,251,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    text-align: center;
}
.rma-signature-preview-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.rma-signature-preview-text {
    font-size: 24px;
    color: #9ca3af;
    font-style: italic;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}
.rma-signature-preview-text.has-value {
    font-family: 'Brush Script MT', 'Dancing Script', cursive, sans-serif;
    font-size: 30px;
    font-style: normal;
    color: #1a365d;
    font-weight: 600;
}
@media (max-width: 575px) {
    .rma-signature-preview-text {
        font-size: 20px;
    }
    .rma-signature-preview-text.has-value {
        font-size: 24px;
    }
}

/* Certification checkbox */
.rma-certify-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.rma-certify-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: #1D62B2;
    flex-shrink: 0;
}
.rma-certify-check label {
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
    margin: 0;
    cursor: pointer;
}
.rma-certify-check .rma-error-msg {
    flex-basis: 100%;
    margin-left: 26px;
}

.recaptcha {
    padding: 20px 0;
    max-width: 100%;
    overflow: hidden;
}
@media (max-width: 450px) {
    .recaptcha .g-recaptcha {
        transform: scale(0.92);
        transform-origin: 0 0;
    }
}
@media (max-width: 340px) {
    .recaptcha .g-recaptcha {
        transform: scale(0.85);
        transform-origin: 0 0;
    }
}

.rma-btn-submit {
    background-color: #1D62B2;
    color: #fff;
    border: none;
    font-weight: 700;
    padding: 14px 32px;
    border-radius: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color .15s ease-in-out;
}
.rma-btn-submit:hover {
    background-color: #1575d0;
}
.rma-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
@media (max-width: 480px) {
    .rma-btn-submit,
    .rma-btn-add {
        width: 100%;
    }
    .rma-items-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .rma-certify-check label {
        width: 100%;
    }
}
