:root {
--wpst-primary: #4F46E5;
--wpst-primary-hover: #4338CA;
--wpst-surface: rgba(255, 255, 255, 0.95);
--wpst-text: #1E293B;
--wpst-text-muted: #64748B;
--wpst-border: #E2E8F0;
--wpst-radius: 16px;
--wpst-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
--wpst-shadow-hover: 0 20px 40px -10px rgba(79, 70, 229, 0.2);
}

.wpst-box, .wpst-modal-inner, .wpst-dashboard {
font-family: inherit;
direction: rtl;
color: var(--wpst-text);
}

.wpst-subtitle {
color: var(--wpst-text-muted);
font-size: 14px;
margin-bottom: 24px;
font-family: inherit;
}

.wpst-glass {
background: var(--wpst-surface);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.4);
}

.wpst-box {
border-radius: var(--wpst-radius);
padding: 32px;
max-width: 700px;
margin: 30px auto;
box-shadow: var(--wpst-shadow);
}

.wpst-box h3 { margin-top: 0; font-weight: 700; color: #0F172A; font-family: inherit; }

.wpst-input-group { display: flex; gap: 16px; margin-bottom: 16px; }
.wpst-input-group > input { margin-bottom: 0 !important; }

@media (max-width: 600px) {
.wpst-input-group { flex-direction: column; gap: 16px; }
}

.wpst-form input, .wpst-form textarea {
width: 100%;
padding: 14px 18px;
border: 1.5px solid var(--wpst-border);
border-radius: 12px;
font-size: 14px;
background: #F8FAFC;
transition: all 0.3s ease;
box-sizing: border-box;
outline: none;
font-family: inherit;
}

.wpst-form input:focus, .wpst-form textarea:focus {
border-color: var(--wpst-primary);
background: #FFF;
box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.wpst-btn {
background: var(--wpst-primary);
color: #fff;
border: none;
padding: 14px 28px;
border-radius: 12px;
cursor: pointer;
font-size: 15px;
font-weight: 600;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
justify-content: center;
font-family: inherit;}

.wpst-btn:hover {
background: var(--wpst-primary-hover);
box-shadow: var(--wpst-shadow-hover);
transform: translateY(-2px);
}

.wpst-btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }

.wpst-alert {
padding: 14px 20px;
border-radius: 12px;
margin-bottom: 20px;
font-size: 14px;
font-weight: 500;
font-family: inherit;
}

.wpst-alert.success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.wpst-alert.error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

.wpst-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; font-family: inherit; }
.wpst-badge.open    { background: #DBEAFE; color: #1E40AF; }
.wpst-badge.pending { background: #ECFDF5; color: #065F46; }
.wpst-badge.closed  { background: #F1F5F9; color: #475569; }

.wpst-table-responsive { overflow-x: auto; }
.wpst-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-family: inherit; }
.wpst-table th { background: #F8FAFC; font-weight: 600; color: var(--wpst-text-muted); padding: 14px; text-align: right; border-bottom: 2px solid var(--wpst-border); }
.wpst-table td { padding: 16px 14px; border-bottom: 1px solid var(--wpst-border); vertical-align: middle; }
.wpst-table tbody tr:hover td { background: #F8FAFC; }

.wpst-dashboard {
background: #fff;
border-radius: var(--wpst-radius);
padding: 24px;
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
border: 1px solid var(--wpst-border);
font-family: inherit;
}

.wpst-dash-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--wpst-border); padding-bottom: 16px; margin-bottom: 20px; }
.wpst-dash-header h3 { margin: 0; font-size: 18px; font-weight: 700; color: #0F172A; }

.wpst-empty-state {
text-align: center;
padding: 40px 20px;
color: var(--wpst-text-muted);
background: #F8FAFC;
border-radius: 12px;
border: 1px dashed #CBD5E1;
}

.wpst-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.wpst-modal-inner { background: var(--wpst-surface); border-radius: 20px; padding: 32px; max-width: 600px; width: 92%; max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); font-family: inherit; }
.wpst-modal-close { position: absolute; top: 16px; left: 16px; background: #F1F5F9; border: none; width: 36px; height: 36px; border-radius: 18px; font-size: 16px; cursor: pointer; color: #64748B; transition: background 0.2s; }
.wpst-modal-close:hover { background: #E2E8F0; color: #0F172A; }

.wpst-ticket-detail-view .wpst-thread { display: flex; flex-direction: column; gap: 12px; max-height: 45vh; overflow-y: auto; padding-right: 5px; margin-top: 15px; }
.wpst-ticket-detail-view .wpst-msg { padding: 12px 16px; border-radius: 12px; max-width: 90%; font-size: 14px; line-height: 1.6; }
.wpst-ticket-detail-view .wpst-msg-head { font-weight: 700; margin-bottom: 6px; font-size: 12px; opacity: 0.7; }
.wpst-ticket-detail-view .wpst-msg-visitor { background: #f1f5f9; color: #1e293b; align-self: flex-start; border-radius: 12px 12px 12px 4px; }
.wpst-ticket-detail-view .wpst-msg-admin { background: var(--wpst-primary); color: white; align-self: flex-end; border-radius: 12px 12px 4px 12px; }

/* === Frontend Styles Overrides for Custom Previews === */

.wpst-woo-consult-btn {
display: block;
width: 100%;
text-align: center;
padding: 12px 20px;
color: #fff !important;
border-radius: 8px;
font-weight: 600;
margin: 15px 0;
text-decoration: none !important;
transition: 0.3s;
font-size: 15px;
font-family: inherit;
}
.wpst-woo-consult-btn:hover {
opacity: 0.9;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.wpst-sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}

.wpst-hp-field {
position: absolute !important;
left: -9999px !important;
width: 1px;
height: 1px;
overflow: hidden;
}

body.wpst-modal-open { overflow: hidden; }

.wpst-msg-time { font-size: 11px; opacity: 0.6; margin-top: 6px; }

.wpst-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.wpst-btn:focus-visible,
.wpst-modal-close:focus-visible,
.wpst-form input:focus-visible,
.wpst-form textarea:focus-visible { outline: 3px solid var(--wpst-primary); outline-offset: 2px; }

.wpst-form input:invalid:not(:placeholder-shown) { border-color: #FCA5A5; }

@media (max-width: 600px) {
.wpst-table thead { display: none; }
.wpst-table, .wpst-table tbody, .wpst-table tr, .wpst-table td { display: block; width: 100%; }
.wpst-table tr { border: 1px solid var(--wpst-border); border-radius: 12px; margin-bottom: 12px; padding: 6px 0; }
.wpst-table td { border-bottom: none; display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.wpst-table td::before { content: attr(data-label); font-weight: 600; color: var(--wpst-text-muted); }
.wpst-dash-header { flex-direction: column; align-items: stretch; gap: 12px; }
.wpst-box { padding: 20px; margin: 16px auto; }
.wpst-modal-inner { padding: 20px; max-height: 90vh; }
}

@media (prefers-reduced-motion: reduce) {
.wpst-btn, .wpst-form input, .wpst-form textarea, .wpst-modal-close { transition: none !important; }
.wpst-btn:hover { transform: none; }
}

@media (prefers-color-scheme: dark) {
.wpst-dashboard { background: #0f172a; border-color: #1e293b; color: #e2e8f0; }
.wpst-dashboard h3, .wpst-dashboard h4 { color: #f8fafc; }
.wpst-table th { background: #1e293b; color: #94a3b8; border-bottom-color: #334155; }
.wpst-table td { border-bottom-color: #1e293b; }
.wpst-table tbody tr:hover td { background: #1e293b; }
.wpst-empty-state { background: #1e293b; border-color: #334155; }
}

.wpst-bot-connect {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid var(--wpst-border, #e2e8f0);
    border-radius: 14px;
    background: rgba(127,127,127,0.04);
}
.wpst-bot-connect-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.wpst-bot-connect-desc { margin: 0 0 14px; font-size: 13px; opacity: .75; line-height: 1.8; }
.wpst-bot-connect-list { display: flex; flex-direction: column; gap: 10px; }
.wpst-bot-connect-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border-radius: 10px;
    background: rgba(127,127,127,0.06);
    border: 1px solid rgba(127,127,127,0.14);
    flex-wrap: wrap;
}
.wpst-bot-connect-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wpst-bot-connect-state { font-size: 12px; }
.wpst-bot-connect-state.is-on { color: #15803d; }
.wpst-bot-connect-state.is-off { opacity: .65; }
.wpst-bot-connect .wpst-alert { margin-top: 14px; }
.wpst-bot-connect-open { display: inline-block; margin-top: 12px; }

@media (max-width: 600px) {
.wpst-bot-connect { padding: 14px; }
.wpst-bot-connect-row { flex-direction: column; align-items: stretch; gap: 10px; }
.wpst-bot-connect-actions { display: flex; }
.wpst-bot-connect-actions .wpst-btn { width: 100%; }
.wpst-bot-connect-open { width: 100%; text-align: center; }
}

@media (prefers-color-scheme: dark) {
.wpst-bot-connect { border-color: #1e293b; background: rgba(148,163,184,0.06); }
.wpst-bot-connect-row { border-color: rgba(148,163,184,0.18); }
.wpst-bot-connect-state.is-on { color: #4ade80; }
}
