/* Send Mail widget, tooltip, and modal styles */

.send-mail-widget {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content:flex-end;
    gap: 8px;
}

.send-mail-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: var(--blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.send-mail-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.24);
    background: var(--green-dark) !important;
}

.send-mail-button img {
    width: 22px;
    height: 22px;
}

.send-tooltip {
    position: relative;
    white-space: nowrap;
    background: var(--blue);
    color: #fff;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    user-select: none;
    transform: translateX(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 240ms ease, opacity 240ms ease;
}

.send-tooltip.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.send-tooltip::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 0px 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent var(--blue) transparent;
}

/* Modal */
.send-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
}

.send-modal.open {
    display: block;
}

.send-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 200ms ease;
}

.send-modal.open .send-modal-backdrop {
    opacity: 1;
}

.send-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    background: #ffffff;
    color: #111827;
    width: 92vw;
    max-width: 420px;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
    opacity: 0;
    transition: transform 220ms ease, opacity 220ms ease;
    overflow: hidden;
}

.send-modal.open .send-modal-content {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.send-modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;

    background: #3333335e;
    border-bottom: 1px solid #3333335e;
}

.send-modal-title {
    color: var(--gray);
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.send-modal-close {
background: transparent;
    border: none;
    font-size: 30px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray);
    position: absolute;
    top: 0px;
    right: 10px;
    left: auto;
}

.send-modal-body {
    padding: 16px;
    display: grid;
    gap: 3px;
}

.send-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--gray);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.send-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(var(--green), 0.15);
}

.send-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.send-btn-primary {
  width: 100%;
  border-radius: 10px;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.send-btn-primary:hover {
    background: var(--green-dark);
}

.send-btn-primary:active {
    transform: translateY(1px);
}

.send-helper {
    font-size: 12px;
    color: var(--gray);
}

.send-error {
    color: #b91c1c;
}

.send-success {
    color: var(--green);
}

@media (max-width: 640px) {
    .send-mail-widget {
        top: 12px;
        right: 12px;
    }
    .send-mail-button {
        width: 40px;
        height: 40px;
    }
}


/* Positioning the widget over the grant preview image */
.grant-preview-wrapper {
    position: relative;
    display: inline-block;
}

.grant-preview-wrapper .send-mail-widget {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10;
}

/* Keep tooltip hidden on hover unless explicitly opened */
.send-mail-widget:hover .send-tooltip:not(.open),
.send-tooltip:hover:not(.open) {
    opacity: 0 !important;
    transform: translateX(12px) !important;
    pointer-events: none !important;
}


