/* Hawk Academy Feedback & AI Help Widget */
[x-cloak] { display: none !important; }

/* ── Floating Button ── */
.hawk-feedback-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 999997 !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    background: #3DB8EA !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(61,184,234,0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    padding: 0 !important;
}
.hawk-feedback-btn:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(61,184,234,0.5) !important;
}
.hawk-feedback-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; }

/* ── Panel (shared by menu + chat) ── */
.hawk-widget-header {
    padding: 14px 16px !important;
    background: linear-gradient(135deg, #3DB8EA 0%, #2da0d0 100%) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}
.hawk-widget-header h3 {
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em !important;
}
.hawk-widget-close {
    background: rgba(255,255,255,0.15) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    font-size: 16px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s !important;
    line-height: 1 !important;
    padding: 0 !important;
}
.hawk-widget-close:hover { background: rgba(255,255,255,0.25) !important; }
.hawk-widget-back {
    background: none !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    opacity: 0.9 !important;
    transition: opacity 0.15s !important;
}
.hawk-widget-back:hover { opacity: 1 !important; }
.hawk-widget-back svg { width: 14px; height: 14px; }

/* ── Menu Options ── */
.hawk-widget-menu { padding: 16px !important; }
.hawk-widget-option {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 14px 16px !important;
    border: 1.5px solid #e5e7eb !important;
    border-radius: 12px !important;
    background: #fff !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    margin-bottom: 10px !important;
    width: 100% !important;
    text-align: left !important;
    font-family: inherit !important;
    box-shadow: none !important;
    appearance: none !important;
    color: #333 !important;
    font-size: 14px !important;
}
.hawk-widget-option:hover {
    border-color: #3DB8EA !important;
    background: #f8fcfe !important;
    box-shadow: 0 2px 8px rgba(61,184,234,0.1) !important;
}
.hawk-widget-option:last-child { margin-bottom: 0 !important; }
.hawk-widget-icon {
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}
.hawk-widget-icon--ai { background: #eff6ff !important; color: #3DB8EA !important; }
.hawk-widget-icon--bug { background: #fef3c7 !important; color: #f59e0b !important; }
.hawk-widget-icon svg { width: 20px; height: 20px; }
.hawk-widget-option-text { flex: 1 !important; min-width: 0 !important; }
.hawk-widget-option-title {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #181818 !important;
    margin-bottom: 2px !important;
}
.hawk-widget-option-desc { font-size: 12px !important; color: #9ca3af !important; line-height: 1.3 !important; }

/* ── Chat ── */
.hawk-chat-body {
    height: 340px !important;
    overflow-y: auto !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    background: #f8f9fb !important;
}
.hawk-chat-msg {
    max-width: 85% !important;
    padding: 11px 15px !important;
    border-radius: 16px !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    position: relative !important;
}
.hawk-chat-msg--user {
    align-self: flex-end !important;
    background: #3DB8EA !important;
    color: #fff !important;
    border-bottom-right-radius: 4px !important;
    margin-left: 32px !important;
}
.hawk-chat-msg--ai {
    align-self: flex-start !important;
    background: #fff !important;
    color: #333 !important;
    border: 1px solid #e5e7eb !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
    margin-right: 32px !important;
    padding: 13px 16px !important;
}
/* Markdown rendering inside AI messages */
.hawk-chat-msg--ai p { margin: 0 0 8px !important; }
.hawk-chat-msg--ai p:last-child { margin-bottom: 0 !important; }
.hawk-chat-msg--ai strong { font-weight: 700 !important; color: #181818 !important; }
.hawk-chat-msg--ai ul, .hawk-chat-msg--ai ol {
    margin: 6px 0 !important;
    padding-left: 18px !important;
}
.hawk-chat-msg--ai li { margin-bottom: 4px !important; }
.hawk-chat-msg--ai h1, .hawk-chat-msg--ai h2, .hawk-chat-msg--ai h3 {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #181818 !important;
    margin: 8px 0 4px !important;
}
.hawk-chat-msg--ai code {
    background: #f3f4f6 !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
}

.hawk-chat-msg--system {
    align-self: center !important;
    background: #eef1f5 !important;
    color: #6b7280 !important;
    font-size: 12px !important;
    text-align: center !important;
    padding: 10px 16px !important;
    max-width: 90% !important;
    border-radius: 10px !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 auto 4px !important;
    line-height: 1.5 !important;
}
.hawk-chat-typing {
    align-self: flex-start !important;
    padding: 12px 16px !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 14px !important;
    border-bottom-left-radius: 4px !important;
    display: flex !important;
    gap: 5px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
}
.hawk-chat-typing span {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #9ca3af !important;
    animation: hawk-typing 1.2s infinite !important;
}
.hawk-chat-typing span:nth-child(2) { animation-delay: 0.2s !important; }
.hawk-chat-typing span:nth-child(3) { animation-delay: 0.4s !important; }
@keyframes hawk-typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}
@keyframes hawk-spin {
    to { transform: rotate(360deg); }
}
@keyframes hawk-skeleton {
    0% { background: #f3f4f6; }
    50% { background: #e5e7eb; }
    100% { background: #f3f4f6; }
}
@keyframes hawk-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}
.hawk-chat-input {
    display: flex !important;
    gap: 8px !important;
    padding: 12px 16px !important;
    border-top: 1px solid #e5e7eb !important;
    background: #fff !important;
    align-items: center !important;
}
.hawk-chat-input input {
    flex: 1 !important;
    border: 1.5px solid #e5e7eb !important;
    border-radius: 20px !important;
    padding: 9px 16px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    outline: none !important;
    transition: border-color 0.15s !important;
    background: #f9fafb !important;
}
.hawk-chat-input input:focus { border-color: #3DB8EA !important; background: #fff !important; }
.hawk-chat-send {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: #3DB8EA !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: background 0.15s !important;
    padding: 0 !important;
}
.hawk-chat-send:hover { background: #2da0d0 !important; }
.hawk-chat-send:disabled { opacity: 0.4 !important; cursor: not-allowed !important; }
.hawk-chat-send svg { width: 16px !important; height: 16px !important; }

/* ── Selection overlay ── */
.hawk-feedback-overlay {
    position: fixed; inset: 0; z-index: 999998;
    cursor: crosshair; background: rgba(0,0,0,0.08);
}
.hawk-feedback-hint {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75); color: #fff;
    padding: 14px 28px; border-radius: 10px;
    font-size: 15px; font-weight: 600;
    pointer-events: none; white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.hawk-feedback-selection {
    position: fixed; border: 2px dashed #3DB8EA;
    background: rgba(61,184,234,0.08);
    pointer-events: none; z-index: 999998;
}

/* ── Screenshot modal ── */
.hawk-feedback-backdrop {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.hawk-feedback-modal {
    background: #fff; border-radius: 14px; padding: 24px;
    max-width: 440px; width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.hawk-feedback-modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; color: #181818; }
.hawk-feedback-preview {
    width: 100%; max-height: 200px; object-fit: contain;
    border-radius: 8px; border: 1px solid #e5e7eb;
    margin-bottom: 14px; background: #f9fafb;
}
.hawk-feedback-textarea {
    width: 100%; min-height: 80px; border: 1.5px solid #e5e7eb;
    border-radius: 10px; padding: 12px 14px; font-size: 14px;
    font-family: inherit; resize: vertical; outline: none;
    transition: border-color 0.15s; box-sizing: border-box;
    background: #f9fafb;
}
.hawk-feedback-textarea:focus { border-color: #3DB8EA; background: #fff; }
.hawk-feedback-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.hawk-feedback-cancel {
    padding: 9px 20px; border-radius: 8px; border: 1px solid #d1d5db;
    background: #f9fafb; color: #374151; font-size: 13px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: background 0.15s;
}
.hawk-feedback-cancel:hover { background: #e5e7eb; }
.hawk-feedback-submit {
    padding: 9px 20px; border-radius: 8px; border: none;
    background: #3DB8EA; color: #fff; font-size: 13px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: background 0.15s;
}
.hawk-feedback-submit:hover { background: #2da0d0; }
.hawk-feedback-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toast */
.hawk-feedback-toast {
    position: fixed; bottom: 88px; right: 24px; z-index: 999999;
    background: #22c55e; color: #fff; padding: 12px 20px;
    border-radius: 10px; font-size: 14px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(34,197,94,0.3);
    animation: hawk-toast-in 0.3s ease;
}
@keyframes hawk-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.hawk-feedback-page {
    font-size: 12px; color: #9ca3af; margin-bottom: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Hide on mobile */
@media (max-width: 767px) {
    .hawk-feedback-btn,
    .hawk-widget-panel,
    .hawk-feedback-overlay,
    .hawk-feedback-backdrop { display: none !important; }
}
