/**
 * Prime RMA - Public Frontend Styles
 * Final Consolidated Version
 */

/* =========================================================
 * 1. LAYOUT & TYPOGRAPHY
 * ========================================================= */
.prime-rma-form-wrapper {
    max-width: 800px;
    margin: 0 auto 30px auto;
    padding-bottom: 40px;
    font-family: inherit;
    color: var(--prime-text-main);
}

.prime-rma-form-wrapper h2,
.prime-rma-main-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--prime-text-main);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.prime-rma-form-wrapper p,
.prime-rma-intro-text {
    margin-bottom: 25px;
    color: var(--prime-text-main);
    opacity: 0.8;
    font-size: 15px;
}

/* =========================================================
 * 2. FORM COMPONENTS
 * ========================================================= */
.prime-rma-form {
    background: #fff;
    border: 1px solid var(--prime-border);
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

/* Grid System */
.rma-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .rma-row.two-col { grid-template-columns: 1fr; gap: 0; }
}

/* Fields */
.rma-field { margin-bottom: 20px; }

.rma-field label,
.prime-rma-highlight-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--prime-text-main);
    font-size: 14px;
}

/* Inputs (Normalized) */
.rma-field input[type="text"],
.rma-field input[type="date"],
.rma-field input[type="number"],
.rma-field input[type="email"],
.rma-field select,
.rma-field textarea,
.prime-rma-input-full {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    color: var(--prime-text-main);
    box-sizing: border-box;
    height: auto;
    line-height: 1.5;
    background-color: #fff;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.rma-field input:focus,
.rma-field select:focus,
.rma-field textarea:focus {
    border-color: var(--prime-accent);
    outline: none;
    box-shadow: 0 0 0 1px var(--prime-accent);
}

/* Read-only / Disabled */
.rma-field input[readonly],
.rma-field input[disabled],
.prime-rma-readonly {
    background-color: #f9f9f9;
    color: #777;
    border-color: #e5e5e5;
    cursor: not-allowed;
    opacity: 0.8;
}

.rma-field textarea { min-height: 120px; resize: vertical; }

/* Highlighted Product Select */
.prime-rma-product-box {
    background: #f0f7ff; 
    padding: 20px;
    border: 1px solid #cce5ff;
    border-radius: 4px;
    margin-bottom: 30px;
}

.prime-rma-input-highlight { border-color: var(--prime-accent) !important; }

/* File Upload */
.rma-field input[type="file"] {
    border: 1px dashed #ccc; padding: 20px; background: #fafafa; width: 100%;
}

/* Divider */
hr, .prime-rma-divider { margin: 30px 0; border: 0; border-top: 1px solid #eee; }

/* =========================================================
 * 3. ALERTS & MESSAGES
 * ========================================================= */
.prime-rma-msg-success {
    margin-bottom: 30px;
    border-top: 3px solid var(--prime-success);
    background: #fff;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.prime-rma-msg-title {
    margin: 0 0 10px; color: var(--prime-success) !important; font-size: 1.1em; font-weight: bold;
}

.prime-rma-item-list {
    margin: 15px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid #eee; border-radius: 4px;
}

.prime-rma-list-item {
    padding: 10px 15px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center;
}
.prime-rma-list-item:last-child { border-bottom: none; }

.prime-rma-policy-alert {
    margin-top: 15px; padding: 15px; background: #fff5f5; border-left: 4px solid var(--prime-error); color: var(--prime-error);
}

.required-mark, 
.prime-rma-error-text { color: var(--prime-error); }

/* =========================================================
 * 4. BUTTONS
 * ========================================================= */
.rma-actions, 
.prime-rma-button-group {
    margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; display: flex; flex-wrap: wrap; gap: 15px; align-items: center;
}

/* Primary Button */
.button.primary {
    background-color: var(--prime-accent);
    color: #fff;
    border: 1px solid var(--prime-accent);
    padding: 12px 24px;
    font-weight: 600;
    transition: filter 0.2s;
}
.button.primary:hover {
    filter: brightness(90%);
    background-color: var(--prime-accent);
    color: #fff;
}

/* Secondary Button */
.button.prime-btn-secondary {
    background: transparent !important;
    border: 1px solid var(--prime-accent) !important;
    color: var(--prime-accent) !important;
}
.button.prime-btn-secondary:hover { background: rgba(0,0,0,0.03) !important; }

/* Cancel Button */
.button.prime-btn-cancel {
    margin-left: auto !important; background: transparent !important; color: #666 !important; border: none !important; text-decoration: underline;
}

/* =========================================================
 * 5. DASHBOARD TABLE (Fixed Alignment)
 * ========================================================= */
.prime-rma-dashboard { margin-bottom: 40px; }

.prime-rma-header {
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #eee;
}

.prime-rma-dashboard table.shop_table {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    border-collapse: separate; 
    border-spacing: 0;
    width: 100%;
    margin-bottom: 0;
}

.prime-rma-dashboard table.shop_table th {
    background-color: #f8f8f8;
    color: var(--prime-text-main)!important;
    font-weight: 600;
    /* Force exact padding match with TD */
    padding: 16px 10px !important;
    border-bottom: 1px solid #e5e5e5;
    text-transform: uppercase;
    font-size: 0.85em;
    vertical-align: middle;
}

.prime-rma-dashboard table.shop_table td {
    /* Match TH padding exactly */
    padding: 16px 10px !important;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    color: var(--prime-text-main);
    line-height: 1.4;
}

.prime-rma-dashboard table.shop_table tr:last-child td { border-bottom: none; }

/* Column Specifics */
.prime-rma-dashboard td[data-title="ID"] {
    white-space: nowrap; 
}

.prime-rma-dashboard td[data-title="ID"] a {
    font-weight: bold; color: var(--prime-accent); text-decoration: none;
    display: inline-block; vertical-align: middle; margin-right: 8px;
}

/* FIX: Align HEADERS for Status/Outcome to Center */
.prime-rma-dashboard th:nth-child(5), 
.prime-rma-dashboard th:nth-child(6) {
    text-align: center !important;
}

.prime-rma-dashboard td[data-title="Status"],
.prime-rma-dashboard td[data-title="Outcome"] { 
    text-align: center; 
}

/* Fix Badge Centering inside Cell */
.prime-rma-dashboard td[data-title="Status"] .prime-rma-badge,
.prime-rma-dashboard td[data-title="Outcome"] .prime-rma-badge {
    display: inline-flex; vertical-align: middle; margin: 0 auto;
}

/* =========================================================
 * 6. BADGES (Refined & Minimalist)
 * ========================================================= */

/* Status Badge */
.prime-rma-badge {
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 4px 10px; 
    border-radius: 4px; 
    font-size: 10px; 
    font-weight: 700; 
    text-transform: uppercase; 
    white-space: nowrap; 
    background: #eee; 
    color: #555;
    line-height: 1; /* Reset line height for perfect vertical centering */
    min-height: 20px; /* Consistent height */
}

/* New Message Badge (Minimalist) */
.prime-msg-badge {
    display: inline-flex;
    align-items: center;
    
    /* Remove Bulky Background - Use Outline */
    background: transparent; 
    border: 1px solid var(--prime-accent);
    color: var(--prime-accent);
    
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px; /* Slightly more space */
    vertical-align: middle;
    line-height: 1;
    white-space: nowrap;
}

.prime-msg-badge::before {
    content: '\2709'; /* Envelope */
    font-size: 12px;
    margin-right: 4px;
    display: inline-block;
}

/* Mobile Table */
@media (max-width: 992px) {
    .prime-rma-dashboard table.shop_table { border: 0; background: transparent; }
    .prime-rma-dashboard table.shop_table thead { display: none; }
    .prime-rma-dashboard table.shop_table tr {
        display: block; background: #fff; border: 1px solid #e5e5e5; margin-bottom: 20px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    }
    .prime-rma-dashboard table.shop_table td {
        display: flex !important; flex-direction: column !important; align-items: flex-start !important; text-align: left !important; padding: 12px 20px !important; border-bottom: 1px solid #f6f6f6; width: 100% !important;
    }
    .prime-rma-dashboard table.shop_table td:before {
        content: attr(data-title); display: block !important; font-size: 0.75em; text-transform: uppercase; font-weight: 700; color: #999; margin-bottom: 6px !important;
    }
}

/* =========================================================
 * 7. COUPON CARDS 
 * ========================================================= */
.rma-coupon-card {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 600px; /* Reduced width to prevent banner look */
    margin: 25px auto; /* Centered */
    border-radius: 8px;
    overflow: hidden;
    
    /* Flex fallback */
    display: flex;
    align-items: center;
    justify-content: space-between;

    /* Variables specific to coupon */
    --rma-c-bg: #fff;
    --rma-c-text: var(--prime-text-main);
    --rma-c-accent: var(--prime-accent);
    --rma-c-bg-right: #f7f7f7;
    --rma-c-text-right: var(--prime-text-main);
}

.rma-coupon-card .coupon-content { flex: 1; padding: 25px; z-index: 2; text-align: left; }
.rma-coupon-card .coupon-action { padding: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; min-width: 180px; }

.rma-coupon-card .coupon-value { font-size: 2.4em; font-weight: 800; line-height: 1; margin-bottom: 8px; display: block; color: inherit; }
.rma-coupon-card .coupon-label { text-transform: uppercase; font-size: 0.85em; font-weight: 700; letter-spacing: 1px; opacity: 0.8; color: inherit; }
.rma-coupon-card .coupon-desc { font-size: 0.9em; margin-top: 5px; opacity: 0.7; color: inherit; }

.rma-coupon-card .the-code {
    font-size: 1.1em; font-weight: bold; padding: 10px 15px; border-radius: 4px; letter-spacing: 1px; display: block; width: 100%; text-align: center;
    font-family: monospace; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); word-break: break-all;
}

/* Styles (Classic, Modern, Ticket) */
.rma-coupon-card.style-classic { background: var(--rma-c-bg); border: 2px dashed var(--rma-c-accent); color: var(--rma-c-text); }
.rma-coupon-card.style-classic .coupon-action { border-left: 2px dashed var(--rma-c-accent); }
.rma-coupon-card.style-classic .coupon-value { color: var(--rma-c-accent); }
.rma-coupon-card.style-classic .the-code { background: rgba(0,0,0,0.05); color: var(--rma-c-accent); box-shadow: none; }

.rma-coupon-card.style-modern {
    background: var(--rma-c-bg); color: var(--rma-c-text);
    --mask: radial-gradient(circle at 0 50%, transparent 12px, black 12.5px), radial-gradient(circle at 100% 50%, transparent 12px, black 12.5px);
    -webkit-mask-image: var(--mask); mask-image: var(--mask);
    --rma-c-text-right: var(--rma-c-text);
}
.rma-coupon-card.style-modern .the-code { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); color: inherit; }

.rma-coupon-card.style-ticket {
    background: transparent !important; border: none !important; box-shadow: none !important; overflow: visible !important;
    display: grid !important; grid-template-columns: 1fr 220px !important; align-items: stretch;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
    
    /* Ensure Ticket also obeys max-width */
    max-width: 600px !important;
    margin: 25px auto !important;
}
.rma-coupon-card.style-ticket .coupon-content {
    background: var(--rma-c-bg); color: var(--rma-c-text); border-radius: 8px 0 0 8px; position: relative;
    -webkit-mask-image: radial-gradient(circle at right center, transparent 10px, black 10.5px); mask-image: radial-gradient(circle at right center, transparent 10px, black 10.5px);
}
.rma-coupon-card.style-ticket .coupon-action {
    background: var(--rma-c-bg-right); color: var(--rma-c-text-right); border-radius: 0 8px 8px 0; position: relative;
    -webkit-mask-image: radial-gradient(circle at left center, transparent 10px, black 10.5px); mask-image: radial-gradient(circle at left center, transparent 10px, black 10.5px);
}
.rma-coupon-card.style-ticket .coupon-action::before {
    content: ''; position: absolute; left: 0; top: 15px; bottom: 15px; border-left: 2px dashed rgba(0,0,0,0.15);
}
.rma-coupon-card.style-ticket .the-code { background: rgba(255,255,255,0.15); border: 1px solid rgba(0,0,0,0.1); color: inherit; }

@media (max-width: 600px) {
    .rma-coupon-card.style-ticket { grid-template-columns: 1fr !important; }
    .rma-coupon-card.style-ticket .coupon-content { border-radius: 8px 8px 0 0; mask-image: radial-gradient(circle at bottom center, transparent 10px, black 10.5px); -webkit-mask-image: radial-gradient(circle at bottom center, transparent 10px, black 10.5px); }
    .rma-coupon-card.style-ticket .coupon-action { border-radius: 0 0 8px 8px; mask-image: radial-gradient(circle at top center, transparent 10px, black 10.5px); -webkit-mask-image: radial-gradient(circle at top center, transparent 10px, black 10.5px); min-height: 140px; }
    .rma-coupon-card.style-ticket .coupon-action::before { border-left: none; border-top: 2px dashed rgba(0,0,0,0.15); top: 0; left: 15px; right: 15px; height: 0; bottom: auto; }
}

/* =========================================================
 * 8. CHAT LOG
 * ========================================================= */
.rma-conversation-log {
    background: var(--prime-bg-light, #f7f7f7); 
    border: 1px solid var(--prime-border, #e5e5e5); 
    border-radius: 8px; 
    padding: 25px; 
    max-height: 500px; 
    overflow-y: auto; 
    margin-bottom: 25px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px;
}

.prime-chat-row { display: flex; flex-direction: column; max-width: 85%; }

/* Support (Incoming) */
.prime-chat-row.is-support { align-self: flex-start; }
.prime-chat-row.is-support .prime-chat-bubble {
    background-color: #ffffff; color: var(--prime-text-main); border: 1px solid #e5e5e5; border-bottom-left-radius: 2px;
}

/* Customer (Outgoing) */
.prime-chat-row.is-me { align-self: flex-end; }
.prime-chat-row.is-me .prime-chat-bubble {
    background-color: var(--prime-accent); color: #ffffff; border: 1px solid var(--prime-accent); border-bottom-right-radius: 2px;
}

.prime-chat-bubble { padding: 12px 18px; border-radius: 18px; font-size: 14px; line-height: 1.5; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.prime-chat-meta { font-size: 11px; color: #999; margin-top: 5px; padding: 0 5px; }

/* =========================================================
 * 9. NOTIFICATION BANNERS
 * ========================================================= */
.prime-notification-banner {
    background: #fff;
    border-left: 5px solid #2271b1; /* Default Info */
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    line-height: 1.5;
}

/* Color Variants */
.prime-notice-success { border-left-color: #28a745 !important; }
.prime-notice-error   { border-left-color: #d63638 !important; }
.prime-notice-warning { border-left-color: #dba617 !important; }
.prime-notice-dark    { border-left-color: #333333 !important; }
.prime-notice-info    { border-left-color: #2271b1 !important; }

.prime-banner-content strong {
    font-size: 1.1em; display: block; margin-bottom: 4px; color: inherit;
}
.prime-notice-success strong { color: #28a745; }
.prime-notice-error strong   { color: #d63638; }
.prime-notice-info strong    { color: #2271b1; }
.prime-notice-dark strong    { color: #333; }

.prime-icon { font-size: 1.2em; vertical-align: middle; margin-right: 5px; }
.prime-banner-action { margin-left: 20px; flex-shrink: 0; }