/**
 * Study Hints Styling (study-hints.css)
 * First-time user onboarding hint popups for Flashcards and Thai Consonants.
 * Inspired by Google Cloud Console / Gemini Assist feature callouts.
 * Fully responsive and mobile-friendly.
 */

.tf-hint-popover {
    position: absolute;
    z-index: 38; /* Above page content, below modal overlay (Bulma modal is z-index 40) */
    width: 320px;
    max-width: calc(100vw - 24px);
    background: linear-gradient(145deg, #698cfd 0%, #587ef8 100%);
    color: #0d2149;
    border-radius: 10px;
    box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.35), 0 4px 10px -2px rgba(15, 23, 42, 0.18);
    padding: 14px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    animation: tfHintFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

/* Directional Beak / Pointer Arrow */
.tf-hint-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #6287fa;
    transform: rotate(45deg);
    border-radius: 2px;
    pointer-events: none;
    z-index: -1;
}

/* Popover is positioned below target -> Arrow points UP */
.tf-hint-arrow-top {
    top: -6px;
}

/* Popover is positioned above target -> Arrow points DOWN */
.tf-hint-arrow-bottom {
    bottom: -6px;
    background: #587ef8;
}

/* Header */
.tf-hint-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tf-hint-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #071638;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tf-hint-title-icon {
    font-size: 16px;
}

/* Close "X" Button */
.tf-hint-close {
    background: transparent;
    border: none;
    color: #0c2048;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: -4px -4px 0 6px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.15s ease, color 0.15s ease;
    touch-action: manipulation;
}

.tf-hint-close:hover {
    background: rgba(7, 22, 56, 0.15);
    color: #040c20;
}

/* Body Text */
.tf-hint-body {
    font-size: 13.5px;
    line-height: 1.45;
    color: #102753;
    margin: 0 0 12px 0;
    font-weight: 400;
}

.tf-hint-body strong {
    color: #040d22;
    font-weight: 700;
}

/* Footer & Actions */
.tf-hint-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.tf-hint-btn-primary {
    background-color: #0c2552;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background-color 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
    min-height: 32px;
}

.tf-hint-btn-primary:hover {
    background-color: #05142e;
}

.tf-hint-btn-primary:active {
    transform: scale(0.97);
}

/* Target Button Spotlight Pulse */
.tf-hint-target-pulse {
    position: relative;
    animation: tfPulseRing 1.8s infinite !important;
}

.answer_buttons_div.tf-hint-target-pulse {
    border-radius: 8px;
}

/* Animations */
@keyframes tfHintFadeIn {
    0% {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes tfPulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 135, 251, 0.75);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(99, 135, 251, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 135, 251, 0);
    }
}

/* Mobile Adjustments (screens < 480px) */
@media screen and (max-width: 480px) {
    .tf-hint-popover {
        width: 310px;
        padding: 12px 14px;
    }

    .tf-hint-title {
        font-size: 14.5px;
    }

    .tf-hint-body {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .tf-hint-close {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .tf-hint-btn-primary {
        padding: 7px 16px;
        font-size: 13.5px;
        min-height: 36px;
    }
}
