:root {
    --pbl-chat-color:          #2563eb;
    --pbl-chat-color-dark:     color-mix(in srgb, var(--pbl-chat-color) 82%, black);
    --pbl-chat-color-disabled: color-mix(in srgb, var(--pbl-chat-color) 55%, white);
    --pbl-chat-color-pale:     color-mix(in srgb, var(--pbl-chat-color)  8%, white);
    --pbl-chat-color-light:    color-mix(in srgb, var(--pbl-chat-color) 16%, white);
    --pbl-chat-color-border:   color-mix(in srgb, var(--pbl-chat-color) 28%, white);
}

#pbl-chatbot {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#pbl-chatbot.pbl-chatbot-left {
    right: auto;
    left: 25px;
}

#pbl-chatbot-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pbl-chat-color, #2563eb);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: auto;
}

#pbl-chatbot.pbl-chatbot-left #pbl-chatbot-btn {
    margin-left: 0;
    margin-right: auto;
}

#pbl-chatbot.pbl-chatbot-left #pbl-chatbot-window {
    right: auto;
    left: 0;
}

#pbl-chatbot-btn:hover,
#pbl-chatbot-btn.active {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

#pbl-chatbot-window {
    position: absolute;
    bottom: 68px;
    right: 0;
    left: auto;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#pbl-chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

#pbl-chatbot-header {
    background: var(--pbl-chat-color, #2563eb);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#pbl-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#pbl-chatbot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

#pbl-chatbot-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

#pbl-chatbot-status {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}

#pbl-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    line-height: 1;
}

#pbl-chatbot-close:hover {
    opacity: 1;
}

#pbl-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 360px;
}

#pbl-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

#pbl-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#pbl-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.pbl-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.pbl-msg-bot {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.pbl-msg-user {
    background: var(--pbl-chat-color, #2563eb);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.pbl-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 12px 16px;
}

.pbl-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: pbl-bounce 1.2s infinite ease-in-out;
}

.pbl-typing span:nth-child(2) { animation-delay: 0.2s; }
.pbl-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pbl-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

#pbl-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

#pbl-chatbot-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color 0.15s;
}

#pbl-chatbot-input:focus {
    border-color: var(--pbl-chat-color, #2563eb);
    background: #fff;
}

#pbl-chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--pbl-chat-color, #2563eb);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

#pbl-chatbot-send:hover {
    background: var(--pbl-chat-color-dark);
}

#pbl-chatbot-send:disabled {
    background: var(--pbl-chat-color-disabled);
    cursor: not-allowed;
}

.pbl-product-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.pbl-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    text-decoration: none;
    color: #1e293b;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pbl-product-card:hover {
    border-color: var(--pbl-chat-color, #2563eb);
    box-shadow: 0 2px 8px rgba(37,99,235,0.1);
    text-decoration: none;
    color: #1e293b;
}

.pbl-product-card-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
}

.pbl-product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pbl-product-card-no-img {
    width: 100%;
    height: 100%;
    background: #e2e8f0;
}

.pbl-product-card-info {
    flex: 1;
    min-width: 0;
}

.pbl-product-card-name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pbl-product-card-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--pbl-chat-color, #2563eb);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pbl-product-card-out {
    font-size: 10px;
    font-weight: 400;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 4px;
    padding: 1px 5px;
}

.pbl-cat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
}

.pbl-cat-btn {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    color: #1e293b;
    transition: border-color 0.15s, background 0.15s;
    line-height: 1.4;
}

.pbl-cat-btn:hover {
    border-color: var(--pbl-chat-color, #2563eb);
    background: var(--pbl-chat-color-pale);
    color: var(--pbl-chat-color, #2563eb);
}

.pbl-cat-btn:active,
.pbl-cat-btn:focus {
    border-color: var(--pbl-chat-color, #2563eb);
    background: var(--pbl-chat-color-light);
    color: var(--pbl-chat-color, #2563eb);
    outline: none;
}

.pbl-nav-btns {
    display: flex;
    gap: 6px;
    align-self: stretch;
    flex-wrap: wrap;
    margin-top: 2px;
}

.pbl-nav-btn {
    flex: 1;
    min-width: 80px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #475569;
    transition: background 0.15s, color 0.15s;
}

.pbl-nav-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.pbl-nav-btn:active,
.pbl-nav-btn:focus {
    outline: none;
    background: #cbd5e1;
    color: #1e293b;
}

.pbl-nav-ai {
    background: var(--pbl-chat-color-pale);
    border-color: var(--pbl-chat-color-border);
    color: var(--pbl-chat-color, #2563eb);
}

.pbl-nav-ai:hover {
    background: var(--pbl-chat-color-light);
}

.pbl-redirect-wrap {
    align-self: flex-start;
}

.pbl-redirect-btn {
    display: inline-block;
    background: var(--pbl-chat-color, #2563eb);
    color: #fff;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.15s;
}

.pbl-redirect-btn:hover {
    background: var(--pbl-chat-color-dark);
    color: #fff;
    text-decoration: none;
}

.pbl-ai-notice {
    align-self: stretch;
    background: var(--pbl-chat-color-pale);
    border: 1px dashed var(--pbl-chat-color-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--pbl-chat-color, #2563eb);
    text-align: center;
}

.pbl-order-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.pbl-order-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pbl-order-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pbl-order-card-code {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.pbl-order-status-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid;
    white-space: nowrap;
}

.pbl-order-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
}

.pbl-order-card-price {
    font-weight: 700;
    color: #1e293b;
}

.pbl-order-cargo-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pbl-order-cargo-company {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border-radius: 5px;
    padding: 2px 7px;
}

.pbl-order-cargo-code {
    font-size: 11px;
    color: #64748b;
    font-family: monospace;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
}

.pbl-order-track-btn,
.pbl-order-detail-btn {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    align-self: flex-start;
}

.pbl-order-track-btn {
    background: var(--pbl-chat-color-pale);
    color: var(--pbl-chat-color, #2563eb);
    border: 1px solid var(--pbl-chat-color-border);
}

.pbl-order-track-btn:hover {
    background: var(--pbl-chat-color-light);
    color: var(--pbl-chat-color-dark);
    text-decoration: none;
}

.pbl-order-detail-btn {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.pbl-order-detail-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    text-decoration: none;
}

/* KVKK onay ekranı */
#pbl-kvkk-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px 16px;
    text-align: center;
}

#pbl-kvkk-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

#pbl-kvkk-body p {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

#pbl-kvkk-link {
    background: none;
    border: none;
    color: var(--pbl-chat-color, #2563eb);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

#pbl-kvkk-accept {
    background: var(--pbl-chat-color, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

#pbl-kvkk-accept:hover {
    background: var(--pbl-chat-color-dark);
}

/* KVKK modal */
#pbl-kvkk-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

#pbl-kvkk-modal.open {
    display: flex;
}

#pbl-kvkk-modal-inner {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

#pbl-kvkk-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
}

#pbl-kvkk-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
    padding: 0 2px;
}

#pbl-kvkk-modal-close:hover {
    color: #1e293b;
}

#pbl-kvkk-modal-content {
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.7;
    color: #475569;
    overflow-y: auto;
}

@media (max-width: 480px) {
    #pbl-chatbot-window {
        width: calc(100vw - 32px);
        right: -8px;
    }

    #pbl-chatbot {
        bottom: 25px;
        right: 25px;
    }
}
