/**
 * PostBan Frontend Widgets Style
 * Ultra-lightweight, Zero External Dependencies
 * Embedded Vazirmatn Font
 */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

.pb-call-hub,
.pb-call-hub *,
.pb-chat-widget,
.pb-chat-widget *,
#postban-call-widget,
#postban-call-widget *,
#postban-chat-widget,
#postban-chat-widget * {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    direction: rtl !important;
    box-sizing: border-box;
}

/* Quick Call Hub */
.pb-call-hub {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
}

.pb-hub-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pb-hub-btn:hover {
    transform: scale(1.1);
}

.pb-hub-menu {
    position: absolute;
    bottom: 74px;
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.16);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 230px;
    max-width: calc(100vw - 32px);
    border: 1px solid #e2e8f0;
}

/* Docking & Screen Boundary Protection */
.pb-call-hub.pb-dock-left .pb-hub-menu,
.pb-chat-widget.pb-dock-left .pb-chat-window {
    left: 0 !important;
    right: auto !important;
}

.pb-call-hub.pb-dock-right .pb-hub-menu,
.pb-chat-widget.pb-dock-right .pb-chat-window {
    right: 0 !important;
    left: auto !important;
}

@media (max-width: 480px) {
    .pb-chat-window {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: 74px !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
    }
    .pb-hub-menu {
        position: fixed !important;
        bottom: 84px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
    }
}

.pb-hub-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.pb-hub-item:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    transform: translateX(-3px);
}

.pb-hub-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pb-hub-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
}

.pb-hub-item.pb-hub-mode-icon_only {
    justify-content: center;
    padding: 8px;
}

.pb-hub-item.pb-hub-mode-text_only {
    justify-content: center;
    padding: 10px 14px;
}

.pb-hub-item.pb-tel .pb-hub-icon {
    background: #ecfdf5;
    color: #10b981;
}

.pb-hub-item.pb-wa .pb-hub-icon {
    background: #e7f9ee;
    color: #25D366;
}

.pb-hub-item.pb-tg .pb-hub-icon {
    background: #e8f5fb;
    color: #229ED9;
}

.pb-hub-item.pb-eitaa .pb-hub-icon {
    background: #fdf2e9;
    color: #E67E22;
}

/* Chat Widget */
.pb-chat-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99990;
}

.pb-chat-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), var(--pb-primary-hover, #1d4ed8));
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 14px 22px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 42, 85, 0.35);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pb-chat-trigger:hover {
    transform: scale(1.06);
}

.pb-chat-window {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 490px;
    max-height: calc(100vh - 90px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.pb-chat-header {
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), var(--pb-primary-hover, #1d4ed8));
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pb-header-title strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

.pb-status-indicator {
    font-size: 11.5px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pb-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.pb-chat-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.pb-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
}

.pb-visitor-msg {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(255, 42, 85, 0.25);
}

.pb-agent-msg {
    align-self: flex-end;
    background: #ffffff;
    color: #0f172a;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.pb-system-msg {
    align-self: center;
    background: #ffffff;
    color: #64748b;
    font-size: 12.5px;
    border: 1px solid #e2e8f0;
    text-align: center;
    border-radius: 20px;
    padding: 6px 16px;
}

.pb-chat-input-bar {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    gap: 10px;
}

.pb-chat-input-bar input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    outline: none;
}

.pb-chat-input-bar input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(255, 42, 85, 0.15);
}

.pb-chat-input-bar button {
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pb-chat-input-bar button:hover {
    background: linear-gradient(135deg, var(--pb-primary-hover, #e11d48), #c2410c);
}

/* Pre-Chat Lead Capture Form */
.pb-chat-active-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.pb-preform-box {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    flex: 1;
}

.pb-preform-head {
    text-align: center;
    margin-bottom: 20px;
}

.pb-preform-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.pb-preform-head h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.pb-preform-head p {
    margin: 0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.5;
}

.pb-preform-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pb-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pb-form-field label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}

.pb-form-field input {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.pb-form-field input:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(255, 42, 85, 0.15);
}

.pb-btn-start-chat {
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), var(--pb-primary-hover, #1d4ed8));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 42, 85, 0.3);
    transition: transform 0.2s ease;
    margin-top: 6px;
}

.pb-btn-start-chat:hover {
    transform: translateY(-2px);
}

/* Frontend Chat Tools: Emojis, Attachments, Safe Links (آیتم ۴ و ۵) */
.pb-frontend-chat-footer {
    border-top: 1px solid #f1f5f9;
    background: #fbfcfe;
    position: relative;
}

.pb-frontend-chat-tools {
    display: flex;
    gap: 8px;
    padding: 8px 12px 0 12px;
}

.pb-tool-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.pb-tool-btn:hover {
    background: #fff1f2;
    border-color: var(--pb-primary, #2563eb);
}

.pb-emoji-palette {
    position: absolute;
    bottom: 56px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    max-width: 260px;
    z-index: 99999;
}

.pb-emoji-palette span {
    font-size: 19px;
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    transition: transform 0.15s ease;
}

.pb-emoji-palette span:hover {
    background: #f1f5f9;
    transform: scale(1.25);
}

.pb-chat-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 12px;
    margin: 4px 0;
    font-size: 12.5px;
}

.pb-att-dl {
    color: var(--pb-primary, #2563eb);
    text-decoration: none;
    font-weight: 700;
    margin-right: 6px;
}

.pb-secure-link-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 2px 8px;
    margin: 0 2px;
    font-size: 12px;
}

.pb-safe-url {
    color: #166534;
    text-decoration: none;
    font-weight: 600;
}

/* Customer Portal Shortcode (آیتم ۷) */
.pb-portal-wrap,
.pb-portal-wrap * {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    direction: rtl !important;
    box-sizing: border-box;
}

.pb-portal-wrap {
    max-width: 1000px;
    margin: 30px auto;
}

.pb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pb-btn-primary {
    background: linear-gradient(135deg, var(--pb-primary, #2563eb), #1d4ed8);
    color: #ffffff;
}

.pb-btn-primary:hover {
    background: linear-gradient(135deg, var(--pb-primary-hover, #e11d48), #c2410c);
}

.pb-btn-outline {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.pb-btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.pb-table {
    width: 100%;
    border-collapse: collapse;
}

.pb-table th,
.pb-table td {
    padding: 14px 18px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13.5px;
}

.pb-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
}

.pb-hidden {
    display: none !important;
}

/* Bubble Wrappers & Metadata */
.pb-bubble-wrapper.pb-bubble-visitor-wrap {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 82%;
}

.pb-bubble-visitor {
    background: var(--pb-chat-visitor-bubble, #f1f5f9) !important;
    color: var(--pb-chat-visitor-text, #0f172a) !important;
    border-radius: 16px 16px 16px 4px !important;
    padding: 10px 14px !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    word-break: break-word;
}

.pb-bubble-wrapper.pb-bubble-admin-wrap {
    align-self: flex-end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 82%;
}

.pb-bubble-admin {
    background: var(--pb-chat-admin-bubble, #2563eb) !important;
    color: var(--pb-chat-admin-text, #ffffff) !important;
    border-radius: 16px 16px 4px 16px !important;
    padding: 10px 14px !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    word-break: break-word;
}

.pb-bubble-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1;
}

.pb-bubble-meta .pb-bubble-time {
    direction: ltr;
    display: inline-block;
}
