/* ============================================================
   WooCommerce After-Sales Service - Frontend CSS
   ============================================================ */

.wcas-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 860px;
    color: #1a1a1a;
}

/* ── Page Header ── */
.wcas-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.wcas-page-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}
.wcas-back-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}
.wcas-back-link:hover { text-decoration: underline; }

/* ── Status Badge ── */
.wcas-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.wcas-pending    { background: #fff3cd; color: #856404; }
.wcas-processing { background: #cce5ff; color: #004085; }
.wcas-approved   { background: #d4edda; color: #155724; }
.wcas-rejected   { background: #f8d7da; color: #721c24; }
.wcas-completed  { background: #d1ecf1; color: #0c5460; }

/* ── Order Buttons ── */

/* Submit Supplement - 綠色（與截圖保持一致） */
.wcas-btn-supplement {
    background: #28a745 !important;
    color: #fff !important;
    border-color: #28a745 !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
}
.wcas-btn-supplement:hover {
    background: #218838 !important;
    border-color: #218838 !important;
    color: #fff !important;
}

/* After-Sales - 藍紫色 */
.wcas-btn-apply {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
}
.wcas-btn-apply:hover {
    background: #5568d3 !important;
    border-color: #5568d3 !important;
    color: #fff !important;
}
.wcas-btn-view { background: #f8f9fa !important; }

/* ── Order Info Banner ── */
.wcas-order-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 14px;
}
.wcas-info-label { color: #666; }
.wcas-order-date, .wcas-order-total { color: #555; }

.wcas-order-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.wcas-order-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}
.wcas-item-img img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.wcas-item-qty { color: #999; }

/* ── Form ── */
.wcas-form { max-width: 680px; }
.wcas-field { margin-bottom: 24px; }
.wcas-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}
.wcas-label .req { color: #e53e3e; }
.wcas-optional { font-weight: 400; color: #888; font-size: 13px; }

/* Type Select */
.wcas-select-wrapper {
    position: relative;
    max-width: 400px;
}
.wcas-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.wcas-select:focus {
    outline: none;
    border-color: #667eea;
}
.wcas-select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #888;
    pointer-events: none;
}

/* Textarea */
.wcas-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}
.wcas-textarea:focus { outline: none; border-color: #667eea; }

/* Upload Zone */
.wcas-upload-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}
.wcas-upload-zone:hover { border-color: #667eea; background: #f5f5ff; }
.wcas-upload-zone.drag-over { border-color: #667eea; background: #eef1fd; }
.wcas-upload-placeholder svg { margin-bottom: 8px; }
.wcas-upload-placeholder p { margin: 4px 0; color: #555; font-size: 14px; }
.wcas-upload-hint { font-size: 12px; color: #aaa !important; }

/* Image Preview */
.wcas-image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.wcas-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}
.wcas-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.wcas-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    padding: 0;
}
.wcas-upload-spinner {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    font-size: 11px;
    color: #888;
}

/* Submit Row */
.wcas-submit-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.wcas-submit-btn {
    padding: 12px 32px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.wcas-submit-btn:hover { background: #5568d3; transform: translateY(-1px); }
.wcas-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.wcas-cancel-link { color: #888; font-size: 14px; text-decoration: none; }
.wcas-cancel-link:hover { color: #333; }

/* Message */
.wcas-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
}
.wcas-message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.wcas-message.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Request List ── */
.wcas-empty {
    text-align: center;
    padding: 48px 24px;
    color: #888;
}
.wcas-empty svg { display: block; margin: 0 auto 16px; }
.wcas-empty p { font-size: 15px; margin-bottom: 16px; }
.wcas-btn-primary {
    display: inline-block;
    padding: 10px 24px;
    background: #667eea;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.wcas-btn-primary:hover { background: #5568d3; color: #fff; }

.wcas-requests-list { display: flex; flex-direction: column; gap: 12px; }

.wcas-request-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.wcas-request-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.wcas-request-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}
.wcas-request-id  { font-weight: 700; font-size: 15px; }
.wcas-request-type { color: #555; font-size: 13px; }
.wcas-request-date { color: #aaa; font-size: 12px; margin-left: auto; }

.wcas-request-body { padding: 14px 18px; }
.wcas-request-order { font-size: 13px; color: #666; display: block; margin-bottom: 6px; }
.wcas-request-desc  { font-size: 14px; color: #333; margin: 0; line-height: 1.5; }

.wcas-admin-note {
    padding: 12px 18px;
    background: #fffbf0;
    border-top: 1px solid #fde68a;
    font-size: 13px;
    color: #555;
}

.wcas-request-footer {
    padding: 12px 18px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}
.wcas-btn-view {
    display: inline-block;
    color: #667eea;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}
.wcas-btn-view:hover { text-decoration: underline; }

/* ── Detail Page (Redesigned) ── */
.wcas-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
}
.wcas-detail-header-left { display: flex; align-items: center; gap: 16px; }
.wcas-detail-header-left h2 { margin: 0; font-size: 22px; font-weight: 700; }
.wcas-detail-header-right .wcas-status-badge { font-size: 14px; padding: 6px 16px; }

.wcas-detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 768px) { .wcas-detail-layout { grid-template-columns: 1fr; } }

/* Info Bar */
.wcas-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 24px;
}
.wcas-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
}
.wcas-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 10px;
    color: #667eea;
}
.wcas-info-content { display: flex; flex-direction: column; }
.wcas-info-label { font-size: 12px; color: #888; }
.wcas-info-value { font-size: 14px; font-weight: 600; color: #333; }
.wcas-info-value a { color: #667eea; text-decoration: none; }
.wcas-info-value a:hover { text-decoration: underline; }
.wcas-type-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}
.wcas-type-refund    { background: #fff3cd; color: #856404; }
.wcas-type-return    { background: #d1ecf1; color: #0c5460; }
.wcas-type-exchange  { background: #d4edda; color: #155724; }
.wcas-type-repair    { background: #e2e3e5; color: #383d41; }
.wcas-type-complaint { background: #f8d7da; color: #721c24; }
.wcas-type-other     { background: #f8f9fa; color: #6c757d; border: 1px solid #dee2e6; }

/* Section */
.wcas-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.wcas-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.wcas-desc-text { line-height: 1.8; color: #444; white-space: pre-wrap; margin: 0; font-size: 14px; }

/* Image Gallery */
.wcas-image-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.wcas-gallery-item { display: block; }
.wcas-gallery-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid #e0e0e0; transition: all 0.2s; }
.wcas-gallery-item:hover img { transform: scale(1.03); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Response Card */
.wcas-response-card {
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e1 100%);
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.wcas-response-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #856404;
    font-weight: 600;
    font-size: 14px;
}
.wcas-response-text { font-size: 14px; color: #444; margin: 0 0 12px; white-space: pre-wrap; line-height: 1.7; }
.wcas-response-date { font-size: 12px; color: #999; }

/* Progress Card */
.wcas-progress-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}
.wcas-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}
.wcas-progress-steps { display: flex; flex-direction: column; }
.wcas-progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #bbb;
    position: relative;
    min-height: 24px;
}
.wcas-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 24px;
    width: 2px;
    height: 14px;
    background: #e0e0e0;
}
.wcas-progress-step.done { color: #28a745; }
.wcas-progress-step.done .wcas-step-icon { background: #28a745; color: #fff; }
.wcas-progress-step.done:not(:last-child)::after { background: #28a745; }
.wcas-progress-step.active { color: #667eea; }
.wcas-progress-step.active .wcas-step-icon { background: #667eea; color: #fff; box-shadow: 0 0 0 3px #eef1fd; }
.wcas-progress-step.rejected { color: #dc3545; }
.wcas-progress-step.rejected .wcas-step-icon { background: #dc3545; color: #fff; }
.wcas-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.wcas-step-icon svg { width: 12px; height: 12px; }
.wcas-step-label { font-size: 12px; font-weight: 500; }
.wcas-progress-step.done .wcas-step-label,
.wcas-progress-step.active .wcas-step-label { font-weight: 600; }

/* Help Card */
.wcas-help-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.wcas-help-card p { font-size: 14px; color: #555; margin: 0 0 12px; }
.wcas-btn-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #667eea;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
.wcas-btn-contact:hover { background: #5568d3; color: #fff; }
.wcas-btn-contact svg { stroke: currentColor; }
