/* ═══════════════════════════════════════════════════════════════════════════
   RMA Manager — Frontend Styles
   Flexbox-first layout; no Bootstrap grid dependency (PS9 compat).
═══════════════════════════════════════════════════════════════════════════ */

/* ── Shared card shell ──────────────────────────────────────────────────── */
.rma-create .card,
.rma-detail  .card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}

.rma-create .card-header,
.rma-detail  .card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 13px 20px;
}

.rma-create .card-header h3,
.rma-detail  .card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 7px;
}

.rma-create .card-body,
.rma-detail  .card-body {
    padding: 20px 24px;
}

/* ══════════════════════════════════════════════════════════════════════════
   CREATE PAGE
══════════════════════════════════════════════════════════════════════════ */
.rma-create {
    max-width: 820px;
    margin: 24px auto;
}

/* ── Alert inside card ──────────────────────────────────────────────────── */
.rma-create .rma-alert-info {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 4px;
    color: #084298;
    padding: 10px 14px;
    font-size: 13.5px;
    margin-bottom: 18px;
    line-height: 1.5;
}

/* ── Form rows & labels ─────────────────────────────────────────────────── */
.rma-form-row {
    margin-bottom: 16px;
}

.rma-form-row:last-child {
    margin-bottom: 0;
}

.rma-form-row label,
.rma-create label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}

.rma-create .form-control,
.rma-create select,
.rma-create textarea,
.rma-create input[type="text"],
.rma-create input[type="date"],
.rma-create input[type="number"],
.rma-create input[type="email"] {
    display: block;
    width: 100%;
    padding: 8px 11px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}

.rma-create select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M0 0l6 7 6-7z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.rma-create .form-control:focus,
.rma-create select:focus,
.rma-create textarea:focus,
.rma-create input[type="text"]:focus,
.rma-create input[type="date"]:focus,
.rma-create input[type="number"]:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74,144,217,.18);
}

.rma-create textarea {
    resize: vertical;
    min-height: 100px;
}

.rma-form-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    display: block;
}

/* Two-column form layout (for bank fields) */
.rma-form-cols {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.rma-form-cols .rma-form-col {
    flex: 1;
    min-width: 180px;
}

.rma-form-cols .rma-form-col-wide {
    flex: 2;
    min-width: 220px;
}

.rma-form-cols .rma-form-col-narrow {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
}

/* ── Product list — pure flexbox, no Bootstrap grid ────────────────────── */
.rma-product-list {
    margin: 0 -24px;       /* bleed to card edges */
}

.rma-product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid #f2f2f2;
    transition: background .15s;
}

.rma-product-row:last-child {
    border-bottom: none;
}

.rma-product-row:hover {
    background: #fafafa;
}

.rma-product-row.is-disabled {
    opacity: .5;
    pointer-events: none;
    background: #fafafa;
}

/* Checkbox */
.rma-product-check {
    flex: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rma-product-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    margin: 0;
}

/* Thumbnail */
.rma-product-thumb {
    flex: 0 0 60px;
}

.rma-product-thumb img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 4px;
    display: block;
}

/* Name + ref */
.rma-product-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.rma-product-info strong {
    display: block;
    font-size: 14px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rma-product-info small {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    display: block;
}

/* Quantity */
.rma-product-qty {
    flex: 0 0 100px;
}

.rma-product-qty label {
    font-size: 11px;
    color: #888;
    margin-bottom: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.rma-product-qty input[type="number"] {
    width: 90px;
    padding: 6px 8px;
    font-size: 14px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    box-sizing: border-box;
}

.rma-product-qty input:disabled {
    background: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}

/* Price */
.rma-product-price {
    flex: 0 0 80px;
    text-align: right;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

/* Already returned badge */
.rma-badge-returned {
    display: inline-block;
    background: #e9ecef;
    color: #666;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* ── Bank details card ──────────────────────────────────────────────────── */
#bank-details-section .card-header {
    background: #ebf3fc;
    border-color: #b8daff;
}

#bank-details-section .card-header h3 {
    color: #0a4880;
}

#bank-details-section {
    border-color: #b8daff;
}

/* ── Withdrawal Declaration card ────────────────────────────────────────── */
#withdrawal-section {
    border-color: #f0c040;
}

#withdrawal-section .card-header {
    background: #fff8d6;
    border-color: #f0c040;
}

#withdrawal-section .card-header h3 {
    color: #7a5800;
}

#withdrawal-section .card-body {
    background: #fffdf0;
}

.rma-withdrawal-text {
    font-size: 14px;
    line-height: 1.65;
    color: #444;
    background: #fff;
    border-left: 4px solid #f0c040;
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    margin-bottom: 16px;
}

.rma-withdrawal-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 2px solid #f0c040;
    border-radius: 5px;
    cursor: pointer;
}

.rma-withdrawal-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.rma-withdrawal-check label {
    font-size: 14px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    margin: 0;
    line-height: 1.5;
}

/* ── Upload photos ──────────────────────────────────────────────────────── */
.rma-create input[type="file"] {
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    cursor: pointer;
}

.rma-create input[type="file"]:hover {
    border-color: #4a90d9;
    background: #eef5ff;
}

/* ── Submit buttons ─────────────────────────────────────────────────────── */
.rma-form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 28px 0 10px;
}

.rma-form-actions .btn {
    padding: 11px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

/* ── Required star ──────────────────────────────────────────────────────── */
.rma-req {
    color: #dc3545;
    margin-left: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   DETAIL PAGE (front-end customer view)
══════════════════════════════════════════════════════════════════════════ */
.rma-detail {
    max-width: 820px;
    margin: 24px auto;
}

.rma-detail .card-body {
    padding: 20px 24px;
}

/* Status badge */
.rma-status-center {
    text-align: center;
    padding: 16px 0;
}

.rma-status-pill {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    padding: 9px 24px;
    border-radius: 20px;
    color: #fff;
    letter-spacing: .3px;
}

/* Info grid (2-col label+value layout) */
.rma-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
    margin-bottom: 14px;
}

.rma-info-item label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #888;
    margin-bottom: 3px;
    display: block;
}

.rma-info-item .rma-info-value {
    font-size: 14px;
    color: #222;
    font-weight: 500;
}

.rma-info-item .rma-info-value a {
    color: #1a73e8;
    text-decoration: none;
}

/* Customer message block */
.rma-customer-msg {
    background: #f8f9fa;
    border-left: 3px solid #dee2e6;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    color: #444;
    line-height: 1.6;
    margin-top: 14px;
}

/* Withdrawal confirmation in detail */
.rma-withdrawal-confirmed {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 5px;
    padding: 12px 16px;
    margin-top: 14px;
    font-size: 13.5px;
    color: #084298;
}

.rma-withdrawal-confirmed strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.rma-withdrawal-quote {
    font-style: italic;
    color: #444;
    font-size: 13px;
    margin: 8px 0 0;
    line-height: 1.6;
}

/* Bank details table */
.rma-bank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    max-width: 480px;
    margin-top: 8px;
}

.rma-bank-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.rma-bank-table tr:last-child {
    border-bottom: none;
}

.rma-bank-table th {
    width: 160px;
    padding: 8px 0;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    vertical-align: top;
}

.rma-bank-table td {
    padding: 8px 0 8px 12px;
    color: #222;
}

.rma-bank-table code {
    font-family: monospace;
    font-size: 13.5px;
    background: #f4f4f4;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: .8px;
}

.rma-bank-note {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

/* Products table */
.rma-detail .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rma-detail .table th {
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #666;
    font-weight: 700;
}

.rma-detail .table td {
    padding: 10px;
    border-bottom: 1px solid #f2f2f2;
    color: #333;
    vertical-align: middle;
}

.rma-detail .table small {
    color: #888;
    font-size: 12px;
}

/* Messages */
.rma-messages-list {
    margin-bottom: 20px;
}

.rma-msg-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f2f2f2;
}

.rma-msg-item:last-child {
    border-bottom: none;
}

.rma-msg-avatar {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.rma-msg-avatar.is-admin    { background: #28a745; }
.rma-msg-avatar.is-customer { background: #007bff; }

.rma-msg-body {
    flex: 1;
}

.rma-msg-meta {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 4px;
}

.rma-msg-author {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

.rma-msg-date {
    font-size: 11px;
    color: #aaa;
}

.rma-msg-text {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
}

/* Message form */
.rma-msg-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.rma-msg-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    min-height: 90px;
    box-sizing: border-box;
    line-height: 1.5;
    transition: border-color .15s;
}

.rma-msg-form textarea:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74,144,217,.15);
}

/* Documents grid */
.rma-docs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.rma-doc-item {
    width: 120px;
    text-align: center;
}

.rma-doc-item img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: block;
    transition: box-shadow .15s;
}

.rma-doc-item img:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.rma-doc-name {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Timeline */
.rma-timeline {
    position: relative;
    padding: 4px 0 4px 32px;
}

.rma-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
    border-radius: 1px;
}

.rma-timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.rma-timeline-item:last-child {
    padding-bottom: 0;
}

.rma-timeline-dot {
    position: absolute;
    left: -29px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #dee2e6;
}

.rma-timeline-content {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 10px 14px;
}

.rma-timeline-action {
    font-weight: 700;
    font-size: 13px;
    color: #333;
}

.rma-timeline-desc {
    font-size: 13px;
    color: #666;
    margin: 3px 0 0;
}

.rma-timeline-time {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

/* Back button */
.rma-back {
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════════════════════
   LIST PAGE
══════════════════════════════════════════════════════════════════════════ */
.rma-list {
    max-width: 820px;
    margin: 24px auto;
}

.rma-list .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 16px;
}

.rma-list .table th {
    padding: 9px 12px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #666;
}

.rma-list .table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f2f2f2;
    vertical-align: middle;
}

.rma-list .badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* ── Order Detail Button ────────────────────────────────────────────────── */
.rma-order-button {
    margin: 20px 0;
    text-align: center;
}

.rma-order-button .btn {
    padding: 11px 28px;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* ── Material Icons ─────────────────────────────────────────────────────── */
.material-icons {
    vertical-align: middle;
    font-size: 18px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .rma-create,
    .rma-detail  { margin: 12px 0; }

    .rma-create .card-body,
    .rma-detail  .card-body { padding: 14px 16px; }

    .rma-product-list { margin: 0 -16px; }
    .rma-product-row  { padding: 12px 16px; gap: 8px; }
    .rma-product-thumb{ display: none; }
    .rma-product-price{ font-size: 13px; }

    .rma-form-cols    { flex-direction: column; gap: 0; }
    .rma-form-cols .rma-form-col-narrow { max-width: 100%; }

    .rma-info-grid    { grid-template-columns: 1fr; }

    .rma-form-actions { flex-direction: column; }
    .rma-form-actions .btn { width: 100%; justify-content: center; }
}
