﻿/* The tooltip container */
.help-tooltip {
    position: absolute;
    z-index: 10000;
    max-width: 280px;
    padding: 1rem;
    background-color: var(--signature-green);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
    line-height: 1.5;
    color: white;
    font-family: var(--font-main);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

    .help-tooltip:hover {
        border-color: var(--button-hover);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    }

/* Visual indicator on elements that have help */
[data-help-key] {
    position: relative;
}

.help-mode-active [data-help-key]::after {
    content: '?';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background-color: var(--signature-blue);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Hide glyphs on touch screens when class is added */
[data-help-key].help-glyph-hidden::after {
    display: none !important;
}

/* Hide tooltip by default */
.help-tooltip.hidden {
    display: none;
}

/* Floating help button - to the left of WhatsApp */
.help-float-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--button);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease-in-out;
    font-family: var(--font-main);
}

    .help-float-button:hover {
        background-color: var(--button-hover);
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }

    .help-float-button.active {
        background-color: var(--signature-blue);
        border-color: var(--signature-blue);
        color: white;
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    }

/* Help mode cursor for select dropdowns */
.help-mode-active .patient-selector[data-help-key] {
    cursor: help;
}

/* Disable select dropdowns in help mode */
.help-mode-active select[data-help-key],
.help-mode-active [data-help-key] select {
    pointer-events: none;
}

/* But keep the wrapper clickable for help */
.help-mode-active [data-help-key] {
    cursor: help;
}

/* Floating WhatsApp button - horizontal layout */
.whatsapp-float-button {
    position: fixed;
    bottom: 2rem;
    right: 6rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #25D366;
    border: 2px solid rgba(37, 211, 102, 0.3);
    color: white;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease-in-out;
    font-family: var(--font-main);
    padding: 0;
}

    .whatsapp-float-button:hover {
        background-color: #128C7E; /* Darker WhatsApp green */
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
    }

    .whatsapp-float-button:active {
        transform: scale(0.95);
    }

    .whatsapp-float-button svg {
        width: 26px; /* Reduced from 28px */
        height: 26px;
    }

/* Small screens: position safely with breathing room */
@media (max-width: 1024px) {
    .help-float-button {
        top: 1.5rem; /* Small margin from top */
        right: 0.5rem; /* Small margin from edge */
    }

    .whatsapp-float-button {
        top: 1.5rem;
        right: calc(56px + 1rem); /* Button width + gap */
    }
}

/* Extra safety for devices with notches/safe areas */
@supports (top: env(safe-area-inset-top)) {
    @media (max-width: 1024px) {
        .help-float-button {
            top: max(0.5rem, env(safe-area-inset-top));
            right: max(0.5rem, env(safe-area-inset-right));
        }

        .whatsapp-float-button {
            top: max(0.5rem, env(safe-area-inset-top));
            right: max(calc(56px + 1rem), calc(56px + env(safe-area-inset-right)));
        }
    }
}

/* Small screens: hide floating buttons temporarily until better treatment found */
@media (max-width: 1024px) {
    .help-float-button,
    .whatsapp-float-button {
        display: none;
    }
}
