@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

.ptw-butWidget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    cursor: pointer;
    z-index: 10000;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.ptw-butWidget:hover { transform: scale(1.05); }

.ptw-butWidget.ptw--hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
    visibility: hidden;
}

#prog-time-widget {
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 420px;
    height: 680px;
    max-height: calc(100vh - 40px);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    z-index: 10001;
    background: #fff;
    opacity: 0;
    transform: translateY(16px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

#prog-time-widget.ptw--open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#prog-time-widget * { box-sizing: border-box; }

#prog-time-widget header.ptw_header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#prog-time-widget .ptw_header_avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

#prog-time-widget .ptw_header_avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#prog-time-widget .ptw_header_info { flex: 1; min-width: 0; }

#prog-time-widget .ptw_header_title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

#prog-time-widget .ptw_header_subtitle {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

#prog-time-widget .ptw_header_actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#prog-time-widget .ptw_header_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #999;
    transition: background 0.15s, color 0.15s;
}

#prog-time-widget .ptw_header_btn:hover {
    background: #f5f5f5;
    color: #333;
}

#prog-time-widget .ptw_header_btn svg { width: 18px; height: 18px; }

#prog-time-widget .ptw_view_history {
    font-size: 12px;
    color: #888;
    cursor: pointer;
    text-align: center;
    padding: 2px 0 0;
}

#prog-time-widget .ptw_view_history:hover { color: #555; }

#prog-time-widget main.ptw_content_block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    overflow-y: auto;
    background: #fff;
}

#prog-time-widget .ptw_message_block {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-line;
    animation: ptw_msgIn 0.2s ease;
}

@keyframes ptw_msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

#prog-time-widget .ptw_manager_message_block {
    align-self: flex-start;
    background: #f5f5f5;
    color: #1a1a1a;
    border-radius: 4px 8px 8px 8px;
    margin-right: auto;
}

#prog-time-widget .ptw_client_message_block {
    align-self: flex-end;
    background: #E0EEFE;
    color: #1a1a1a;
    border-radius: 8px 8px 4px 8px;
    margin-left: auto;
}

#prog-time-widget .ptw_message_block .contentBlock {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#prog-time-widget .ptw_message_block .ptw_message_date {
    font-size: 11px;
    margin-top: 4px;
    text-align: right;
}

#prog-time-widget .ptw_manager_message_block .ptw_message_date {
    text-align: left;
    color: #aaa;
}

#prog-time-widget .ptw_client_message_block .ptw_message_date {
    color: #888;
}

#prog-time-widget .ptw_message_block .imageMessage {
    width: 100%;
    max-width: 200px;
    border-radius: 10px;
    cursor: pointer;
}

#prog-time-widget .ptw_message_block .imageMessage:hover { opacity: 0.9; }

#prog-time-widget .ptw_file_card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

#prog-time-widget .ptw_client_message_block .ptw_file_card {
    background: rgba(0,0,0,0.04);
}

#prog-time-widget .ptw_file_card:hover { background: rgba(0,0,0,0.08); }

#prog-time-widget .ptw_file_card_icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#prog-time-widget .ptw_client_message_block .ptw_file_card_icon {
    background: #1a1a1a;
}

#prog-time-widget .ptw_file_card_name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#prog-time-widget footer.ptw_footer {
    border-top: 1px solid #eee;
    padding: 12px 20px 16px;
    background: #fff;
    flex-shrink: 0;
}

#prog-time-widget .ptw_end_chat_bar {
    display: flex;
    justify-content: center;
    padding-bottom: 10px;
}

#prog-time-widget .ptw_end_chat_btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

#prog-time-widget .ptw_end_chat_btn:hover {
    border-color: #ccc;
    color: #555;
}

#prog-time-widget .ptw_end_chat_btn svg { width: 14px; height: 14px; }

#prog-time-widget .ptw_input_row {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 4px 4px 4px 12px;
    min-height: 44px;
}

#prog-time-widget .ptw_attach_but {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
    color: #bbb;
    transition: color 0.15s;
    margin-right: 6px;
}

#prog-time-widget .ptw_attach_but:hover { color: #666; }

#prog-time-widget .ptw_attach_but svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
}

#prog-time-widget .ptw_text_field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

#prog-time-widget #ptw_text_field {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 36px;
    color: #1a1a1a;
    resize: none;
    max-height: 100px;
    padding: 0;
    margin: 0;
    height: 36px;
    overflow: hidden;
}

#prog-time-widget #ptw_text_field::placeholder {
    color: #aaa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 36px;
}

#prog-time-widget #ptw_file_field { display: none; }

#prog-time-widget .ptw_send_but {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E0EEFE;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
    margin-left: 6px;
}

#prog-time-widget .ptw_send_but:hover { background: #c8dffc; }

#prog-time-widget .ptw_send_but:disabled {
    background: #eee;
    cursor: default;
}

#prog-time-widget .ptw_send_but svg {
    width: 18px;
    height: 18px;
    stroke: #4a90d9;
}

#prog-time-widget .ptw_send_but:disabled svg { stroke: #ccc; }

#prog-time-widget #ptw_attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
}

#prog-time-widget #ptw_attachments:not(:empty) { padding: 8px 0 0; }

#prog-time-widget .ptw_attachment_chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #eee;
    border-radius: 12px;
    font-size: 12px;
    color: #555;
    max-width: 160px;
}

#prog-time-widget .ptw_attachment_chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#prog-time-widget .ptw_attachment_remove {
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.15s;
}

#prog-time-widget .ptw_attachment_remove:hover { opacity: 1; }

#prog-time-widget .ptw_lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    cursor: pointer;
}

#prog-time-widget .ptw_lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.date-line {
    text-align: center;
    padding: 8px 0;
}

.date-line hr.line { display: none; }

.date-text {
    font-size: 12px;
    color: #aaa;
    background: #f0f0f0;
    padding: 3px 12px;
    border-radius: 10px;
    display: inline-block;
    font-weight: 400;
}

#prog-time-widget .ptw_closed_banner {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    text-align: center;
}

#prog-time-widget .ptw_closed_banner.active { display: flex; }

#prog-time-widget .ptw_closed_text {
    font-size: 13px;
    color: #888;
}

#prog-time-widget .ptw_new_chat_btn {
    padding: 8px 20px;
    border-radius: 10px;
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

#prog-time-widget .ptw_new_chat_btn:hover { background: #333; }

#prog-time-widget ::-webkit-scrollbar { width: 4px; }
#prog-time-widget ::-webkit-scrollbar-track { background: transparent; }
#prog-time-widget ::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

@media (max-width: 500px) {
    .ptw-butWidget {
        bottom: 16px;
        right: 16px;
    }

    .ptw-butWidget svg {
        width: 36px;
        height: 36px;
    }

    #prog-time-widget.ptw--open {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        transform: none;
    }

    #prog-time-widget.ptw--open header.ptw_header {
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top));
        flex-shrink: 0;
    }

    #prog-time-widget.ptw--open main.ptw_content_block {
        padding: 12px 16px;
        flex: 1 1 0%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    #prog-time-widget.ptw--open footer.ptw_footer {
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        flex-shrink: 0;
    }

    #prog-time-widget .ptw_message_block {
        max-width: 85%;
    }

    #prog-time-widget .ptw_modal_overlay {
        padding: 24px 20px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}

#prog-time-widget .ptw_end_chat_bar { display: none !important; }

#prog-time-widget .ptw_modal_overlay {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
    padding: 28px 24px 24px;
    z-index: 10;
    text-align: center;
    animation: ptw_slideUp 0.25s ease;
}

@keyframes ptw_slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

#prog-time-widget .ptw_modal_title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

#prog-time-widget .ptw_modal_desc {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    margin-bottom: 20px;
}

#prog-time-widget .ptw_modal_btn_end {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    background: #1a1a1a;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    margin-bottom: 8px;
}

#prog-time-widget .ptw_modal_btn_end:hover { background: #333; }

#prog-time-widget .ptw_modal_btn_return {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    background: #fff;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

#prog-time-widget .ptw_modal_btn_return:hover { border-color: #999; }

#prog-time-widget .ptw_lang_dropdown {
    position: absolute;
    top: 56px;
    right: 16px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 20;
    overflow: hidden;
    min-width: 140px;
    animation: ptw_fadeIn 0.15s ease;
}

@keyframes ptw_fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

#prog-time-widget .ptw_lang_item {
    padding: 10px 16px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background 0.12s;
}

#prog-time-widget .ptw_lang_item:hover {
    background: #f5f5f5;
}

#prog-time-widget .ptw_lang_item--active {
    color: #1a1a1a;
    font-weight: 600;
    background: #E0EEFE;
}

#prog-time-widget .ptw_lang_item--active:hover {
    background: #d0e2fd;
}
