/* HRMaster Chatbot Pro v2.0 - Professional Styling */

/* === FAB Button === */
.hrmaster-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #1976D2;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 99998;
    cursor: pointer;
    font-size: 28px;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: hrmaster-blink 2s ease-in-out infinite;
}

@keyframes hrmaster-blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

.hrmaster-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0,0,0,.3);
    animation-play-state: paused;
    opacity: 1;
}

.hrmaster-fab:hover .hrmaster-fab-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.hrmaster-fab-tooltip {
    position: absolute;
    right: 80px;
    bottom: 14px;
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    opacity: 0;
    transform: translateY(6px);
    transition: all .18s ease;
    font-weight: 600;
    white-space: nowrap;
}

.hrmaster-fab-icon {
    pointer-events: none;
}

/* === Chat Window === */
.hrmaster-chat-window {
    position: fixed;
    right: 20px;
    bottom: 96px;
    width: 380px;
    max-width: calc(100% - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,.15);
    z-index: 99999;
    display: none;
    flex-direction: column;
}

/* === Chat Header === */
.hrmaster-chat-header {
    background: #1976D2;
    color: #fff;
    padding: 16px;
    font-weight: 700;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hrmaster-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hrmaster-clear-cache-btn,
.hrmaster-refresh-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
}

.hrmaster-clear-cache-btn:hover,
.hrmaster-refresh-btn:hover {
    background: rgba(255,255,255,0.1);
}

.hrmaster-refresh-btn:hover {
    transform: rotate(180deg);
}

.hrmaster-clear-cache-btn:hover {
    transform: scale(1.1);
}

.hrmaster-clear-cache-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hrmaster-refresh-btn svg,
.hrmaster-clear-cache-btn svg {
    transition: transform 0.2s;
}

.hrmaster-spinning {
    animation: hrmaster-spin 1s linear infinite;
}

@keyframes hrmaster-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hrmaster-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 28px;
    border-radius: 50%;
    transition: background 0.2s;
}

.hrmaster-close-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* === Start Screen === */
.hrmaster-start-screen {
    background: #f7f7f7;
    padding: 16px;
    height: calc(100% - 64px);
    overflow-y: auto;
}

.hrmaster-start-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hrmaster-start-single {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.hrmaster-start-single p {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* === Start Conversation Button === */
.hrmaster-start-conversation {
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    transition: all 0.2s;
}

.hrmaster-start-conversation:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.hrmaster-start-conversation svg {
    width: 18px;
    height: 18px;
}

.hrmaster-start-conversation svg path {
    stroke: #fff;
}

/* === Category Buttons === */
.hrmaster-category-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.hrmaster-category-btn {
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.hrmaster-category-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.hrmaster-category-btn:active {
    transform: translateY(0);
}

/* === Inline Category Buttons (in Chat) === */
.hrmaster-category-buttons-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.hrmaster-category-btn-inline {
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.15);
}

.hrmaster-category-btn-inline:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

.hrmaster-category-btn-inline:active {
    transform: translateY(0);
}

/* === Search Box === */
.hrmaster-search-box {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 12px;
}

.hrmaster-search-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.hrmaster-search-box input:focus {
    border-color: #25D366;
}

.hrmaster-search-submit {
    background: #25D366;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.hrmaster-search-submit:hover {
    background: #20b559;
}

.hrmaster-search-submit svg {
    width: 18px;
    height: 18px;
}

.hrmaster-search-submit svg path {
    stroke: #fff;
}

/* === Section Headers === */
.hrmaster-section-header {
    margin-bottom: 12px;
}

.hrmaster-section-header p {
    margin: 0;
    font-size: 15px;
    color: #333;
}

/* === Posts Container === */
.hrmaster-posts-container {
    max-height: 300px;
    overflow-y: auto;
}

.hrmaster-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* === Post Items === */
.hrmaster-post-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hrmaster-post-item:last-child {
    border-bottom: none;
}

.hrmaster-post-thumb {
    margin-bottom: 10px;
}

.hrmaster-post-thumb img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.hrmaster-post-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hrmaster-post-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.hrmaster-post-title a {
    color: #075E54;
    text-decoration: none;
    transition: color 0.2s;
}

.hrmaster-post-title a:hover {
    color: #25D366;
    text-decoration: underline;
}

.hrmaster-post-meta {
    font-size: 12px;
    color: #888;
}

.hrmaster-post-date {
    display: inline-block;
}

.hrmaster-post-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 4px 0 0 0;
}

/* === Chat Body === */
.hrmaster-chat-body {
    background: #f7f7f7;
    padding: 16px;
    height: calc(100% - 128px);
    overflow-y: auto;
}

/* === Chat Messages === */
.hrmaster-user-msg-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 8px 0;
    clear: both;
}

.hrmaster-user-msg-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 600;
}

.hrmaster-user-msg {
    background: #DCF8C6;
    padding: 10px 12px;
    border-radius: 12px 12px 0 12px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.4;
}

.hrmaster-bot-msg-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
    max-width: 85%;
    clear: both;
}

.hrmaster-bot-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.hrmaster-bot-name {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrmaster-bot-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #25D366, #128C7E);
    color: #fff;
    font-size: 16px;
}

.hrmaster-bot-icon img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.hrmaster-bot-msg {
    background: #fff;
    padding: 10px 12px;
    border-radius: 12px 12px 12px 0;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    flex: 1;
}

.hrmaster-bot-msg.hrmaster-welcome {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.hrmaster-bot-msg-wrapper.hrmaster-welcome-wrapper {
    margin: 0 0 8px 0;
}

.hrmaster-typing {
    font-style: italic;
    color: #666;
    padding: 6px 8px;
    font-size: 13px;
}

.hrmaster-typing .dots {
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* === Search Results in Chat === */
.hrmaster-result-item {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #f9f9f9;
    display: flex;
    gap: 10px;
}

.hrmaster-result-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.hrmaster-result-item a {
    color: #075E54;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.hrmaster-result-item a:hover {
    color: #25D366;
    text-decoration: underline;
}

.hrmaster-excerpt {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
}

.hrmaster-result-date {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.hrmaster-answer {
    font-size: 14px;
    line-height: 1.5;
}

.hrmaster-link {
    display: inline-block;
    color: #075E54;
    text-decoration: none;
    font-weight: 600;
    margin-top: 8px;
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 6px;
    transition: all 0.2s;
}

.hrmaster-link:hover {
    background: #25D366;
    color: #fff;
    transform: translateY(-1px);
}

/* === Chat Input === */
.hrmaster-chat-input {
    display: flex;
    gap: 8px;
    border-top: 1px solid #eee;
    background: #fff;
    padding: 12px;
    border-radius: 0 0 12px 12px;
}

.hrmaster-chat-input input#hrmaster-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.hrmaster-chat-input input#hrmaster-chat-input:focus {
    border-color: #2196F3;
}

.hrmaster-chat-input button#hrmaster-chat-send {
    background: #2196F3;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.hrmaster-chat-input button#hrmaster-chat-send:hover {
    background: #1976D2;
}

.hrmaster-chat-input button#hrmaster-chat-send svg path {
    stroke: #fff;
}

.hrmaster-change-service-btn {
    background: #f0f0f0;
    color: #555;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.hrmaster-change-service-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.hrmaster-change-service-btn svg {
    stroke: currentColor;
}

/* === Scrollbar Styling === */
.hrmaster-start-screen::-webkit-scrollbar,
.hrmaster-chat-body::-webkit-scrollbar,
.hrmaster-posts-container::-webkit-scrollbar {
    width: 6px;
}

.hrmaster-start-screen::-webkit-scrollbar-track,
.hrmaster-chat-body::-webkit-scrollbar-track,
.hrmaster-posts-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.hrmaster-start-screen::-webkit-scrollbar-thumb,
.hrmaster-chat-body::-webkit-scrollbar-thumb,
.hrmaster-posts-container::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

.hrmaster-start-screen::-webkit-scrollbar-thumb:hover,
.hrmaster-chat-body::-webkit-scrollbar-thumb:hover,
.hrmaster-posts-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* === Responsive === */
@media (max-width: 480px) {
    .hrmaster-chat-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 90px;
        height: calc(100vh - 110px);
    }
    
    .hrmaster-fab {
        width: 56px;
        height: 56px;
        right: 16px;
        bottom: 16px;
        font-size: 24px;
    }
}
