/**
 * Site Guide Chatbot Styles - Menu Tree Edition v3
 * 리사이즈 가능, 페이지 자동 감지
 */

/* ======== FAB ======== */
.nsaeup-guide-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a56db;
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.nsaeup-guide-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.nsaeup-guide-fab svg { width: 28px; height: 28px; fill: currentColor; }
.nsaeup-guide-fab--hidden { display: none; }

/* ======== Panel (리사이즈 가능) ======== */
.nsaeup-guide-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 420px;
    height: 75vh;
    min-height: 350px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 99991;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    resize: vertical;
}
.nsaeup-guide-panel--open {
    display: flex;
}

/* Resize handle (상단 드래그) */
.nsaeup-guide-resize-handle {
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nsaeup-guide-resize-handle::after {
    content: '';
    width: 36px;
    height: 3px;
    background: #d1d5db;
    border-radius: 2px;
}
.nsaeup-guide-resize-handle:hover::after {
    background: #9ca3af;
}

/* Header */
.nsaeup-guide-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #1a56db;
    color: #fff;
    flex-shrink: 0;
}
.nsaeup-guide-header-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}
.nsaeup-guide-header-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: background 0.15s;
}
.nsaeup-guide-header-btn:hover { background: rgba(255,255,255,0.2); }
.nsaeup-guide-header-btn svg { width: 18px; height: 18px; fill: currentColor; }
.nsaeup-guide-header-btn--active { background: rgba(255,255,255,0.25); }

/* ======== Page Banner (현재 페이지 안내) ======== */
.nsaeup-guide-page-banner {
    padding: 8px 14px;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    font-size: 12px;
    color: #1e40af;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.nsaeup-guide-page-banner:hover {
    background: #dbeafe;
}
.nsaeup-guide-page-banner-icon {
    font-size: 14px;
}

/* ======== Messages ======== */
.nsaeup-guide-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nsaeup-guide-messages::-webkit-scrollbar { width: 4px; }
.nsaeup-guide-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* Message Bubbles */
.nsaeup-guide-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 13px;
    flex-shrink: 0;
}
.nsaeup-guide-msg--bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}
.nsaeup-guide-msg--user {
    align-self: flex-end;
    background: #1a56db;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ======== Menu Buttons ======== */
.nsaeup-guide-menu {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 95%;
    flex-shrink: 0;
}
.nsaeup-guide-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: #1f2937;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.nsaeup-guide-menu-btn:hover {
    background: #eff6ff;
    border-color: #1a56db;
}
.nsaeup-guide-menu-num { font-size: 14px; flex-shrink: 0; }

/* ======== Detail Card ======== */
.nsaeup-guide-detail {
    align-self: flex-start;
    width: 95%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    flex-shrink: 0;
}
.nsaeup-guide-detail-title {
    padding: 12px 14px 8px;
    font-weight: 700;
    font-size: 14px;
    color: #1a56db;
}
.nsaeup-guide-detail-body {
    padding: 0 14px 8px;
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
}
.nsaeup-guide-detail-steps {
    padding: 0 14px 12px 14px;
    margin: 0;
    list-style: none;
    counter-reset: step;
}
.nsaeup-guide-detail-steps li {
    counter-increment: step;
    padding: 5px 0 5px 28px;
    position: relative;
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
}
.nsaeup-guide-detail-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: 5px;
    width: 20px; height: 20px;
    background: #1a56db;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nsaeup-guide-detail-manual {
    padding: 10px 14px;
    border-top: 1px solid #e5e7eb;
    background: #f0f7ff;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-radius: 0 0 12px 12px;
}
.nsaeup-guide-manual-link {
    display: inline-block;
    font-size: 12px;
    color: #1a56db;
    text-decoration: none;
    border: 1px solid #bfdbfe;
    background: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    transition: background 0.15s;
    cursor: pointer;
}
.nsaeup-guide-manual-link:hover {
    background: #dbeafe;
    text-decoration: underline;
}

/* ======== Navigation Buttons ======== */
.nsaeup-guide-nav {
    display: flex;
    gap: 8px;
    align-self: flex-start;
    flex-shrink: 0;
}
.nsaeup-guide-nav-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    color: #6b7280;
    transition: background 0.15s, color 0.15s;
}
.nsaeup-guide-nav-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* ======== Input Area ======== */
.nsaeup-guide-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    gap: 8px;
}
.nsaeup-guide-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    color: #1f2937;
    background: #fff;
}
.nsaeup-guide-input:focus { border-color: #1a56db; }
.nsaeup-guide-input::placeholder { color: #9ca3af; }
.nsaeup-guide-send-btn {
    width: 36px; height: 36px;
    background: #1a56db;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
}
.nsaeup-guide-send-btn:hover { background: #1e40af; }
.nsaeup-guide-send-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ======== Inspector ======== */
.nsaeup-guide-inspector-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 999998;
    cursor: crosshair;
}
.nsaeup-guide-inspector-highlight {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    border: 2px solid #1a56db;
    background: rgba(26, 86, 219, 0.08);
    border-radius: 3px;
    transition: top 0.08s, left 0.08s, width 0.08s, height 0.08s;
}
.nsaeup-guide-inspector-tooltip {
    position: fixed;
    z-index: 1000000;
    pointer-events: none;
    background: #1f2937;
    color: #f9fafb;
    font-size: 11px;
    font-family: 'Consolas', monospace;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nsaeup-guide-inspector-badge {
    position: fixed;
    bottom: 24px; right: 90px;
    z-index: 999997;
    background: #1a56db;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 6px;
    font-family: 'Pretendard', sans-serif;
    cursor: pointer;
}
.nsaeup-guide-inspector-badge--active { display: flex; }
.nsaeup-guide-inspector-badge .nsaeup-guide-pulse {
    width: 8px; height: 8px;
    background: #fbbf24;
    border-radius: 50%;
    animation: nsaeup-guide-pulse 1.5s infinite;
}
@keyframes nsaeup-guide-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ======== Responsive ======== */
@media (max-width: 480px) {
    .nsaeup-guide-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 8px;
        height: calc(100vh - 16px);
        border-radius: 12px;
    }
    .nsaeup-guide-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; }
}
