/* Hider Dunamis - Field visibility manager
 * Copyright (C) 2026 Dunamis Group
 *
 * Granularity: TD-pair level (label + value cells), not full TR.
 */

/* ============================================================
   FLOATING EYE BUTTON
   Fixed position, bottom-right corner of every private page
   ============================================================ */
#hiderdunamis-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    background: #4a6fa5;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transition: background 0.2s ease, transform 0.15s ease;
    font-size: 18px;
    user-select: none;
}

#hiderdunamis-btn:hover {
    background: #3a5a8f;
    transform: scale(1.1);
}

/* Edit mode: red with pulsing animation */
#hiderdunamis-btn.hiderdunamis-edit-active {
    background: #c0392b;
    animation: hiderdunamis-pulse 1.5s infinite;
}

#hiderdunamis-btn.hiderdunamis-edit-active:hover {
    background: #a93226;
}

@keyframes hiderdunamis-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.6); }
    70%  { box-shadow: 0 0 0 12px rgba(192, 57, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

/* ============================================================
   HIDDEN TDs
   For non-admin users: completely invisible
   ============================================================ */
td.hiderdunamis-hidden {
    display: none !important;
}

/* ============================================================
   HIDDEN TDs — ADMIN VIEW
   Grayed out with strikethrough so admin sees what's hidden
   ============================================================ */
td.hiderdunamis-hidden-admin {
    opacity: 0.30 !important;
    background-color: #d0d0d0 !important;
    color: #666666 !important;
    text-decoration: line-through;
    outline: 1px dashed #999;
    transition: opacity 0.2s ease;
}

td.hiderdunamis-hidden-admin * {
    color: #666666 !important;
    text-decoration: line-through;
    opacity: 0.6;
}

/* ============================================================
   EDIT MODE — hoverable individual TDs
   Yellow highlight when hovering a cell in edit mode
   ============================================================ */
body.hiderdunamis-editmode td.hiderdunamis-td-hoverable {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

body.hiderdunamis-editmode td.hiderdunamis-td-hoverable:hover {
    background-color: #fff3cd !important;
    outline: 2px dashed #e6a817;
    outline-offset: -2px;
}

/* Hovering over an already-hidden TD: show it a bit more visible */
body.hiderdunamis-editmode td.hiderdunamis-hidden-admin.hiderdunamis-td-hoverable:hover {
    opacity: 0.70 !important;
    background-color: #ffeeba !important;
    outline-color: #c0392b;
}

/* Small tooltip on hover showing the action */
body.hiderdunamis-editmode td.hiderdunamis-td-hoverable[data-hider-label]:hover::after {
    content: attr(data-hider-label);
    position: absolute;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 99998;
    margin-top: -18px;
    margin-left: 4px;
}

/* ============================================================
   EDIT MODE — info bar at top of page
   ============================================================ */
body.hiderdunamis-editmode::before {
    content: "HIDER DUNAMIS — modo edición: tocá un campo para ocultarlo / tocá de nuevo para mostrarlo";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    background: #c0392b;
    color: #fff;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 0;
    letter-spacing: 0.4px;
}
