/* ============================================================
   JButton System — Classic GIF-style buttons
   ============================================================ */

/* ============================================================
   CSS Custom Properties
   Override any of these on :root or a scoped selector to
   restyle all buttons. Size and color cascade automatically.
   ============================================================ */
:root {
    --btn-color: #771E23; /* classic text color from general.css */
    --btn-bg: linear-gradient(to bottom, #DDD29E 0%, #D0C38A 45%, #BCA963 100%);
    --btn-border: #967E35; /* dark amber — sampled GIF edge row */
    --btn-hover-bg: linear-gradient(to bottom, #EAE0AE 0%, #DACB96 45%, #C6B36D 100%);
    --btn-active-bg: linear-gradient(to bottom, #BCA963 0%, #D0C38A 55%, #DDD29E 100%);
    --btn-radius: 5px; /* matches GIF rounded corners */
    --btn-icon-size: 18px;
    --btn-pad-v: 6px;
    --btn-pad-h: 12px;
    --btn-gap: 6px;
    --btn-font-size: 14px;
    --btn-font-weight: normal;
    --tip-bg: #2a2a2a;
    --tip-color: #ffffff;
    --tip-font-size: 14px;
    --tip-font-weight: normal;
    --tip-radius: 5px;
    --tip-pad: 8px 16px;
}

/* ============================================================
   Base button  .jbtn
   Works as <button>, <a>, or <input type="button">
   ============================================================ */
.jbtn {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: var(--btn-gap);
    padding: var(--btn-pad-v) var(--btn-pad-h);
    font-size: var(--btn-font-size);
    font-family: Arial, sans-serif;
    color: var(--btn-color);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--btn-radius);
    cursor: pointer;
    text-decoration: none !important;
    user-select: none;
    line-height: 1.3;
    font-weight: var(--btn-font-weight);
    box-shadow: 0 1px 2px rgba(80, 55, 0, 0.18);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    position: relative;
    vertical-align: middle;
}

    .jbtn:hover {
        background: var(--btn-hover-bg);
        box-shadow: 0 2px 5px rgba(80, 55, 0, 0.22);
        text-decoration: none;
        color: var(--btn-color);
    }

    .jbtn:active {
        background: var(--btn-active-bg);
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18);
    }

    .jbtn svg {
        width: var(--btn-icon-size);
        height: var(--btn-icon-size);
        fill: currentColor;
        flex-shrink: 0;
        display: block;
    }

/* ============================================================
   Icon-only variant  .jbtn-icon
   Square button — the label lives solely in the tooltip.
   ============================================================ */
.jbtn-icon {
    padding: var(--btn-pad-v);
    gap: 0;
}

    /* --- Tooltip bubble (::after) --- */
    .jbtn-icon::after {
        content: attr(data-tip);
        position: absolute;
        bottom: calc(100% + 11px);
        left: 50%;
        transform: translateX(-50%) translateY(7px);
        opacity: 0;
        pointer-events: none;
        z-index: 100;
        background: var(--tip-bg);
        color: var(--tip-color);
        font-size: var(--tip-font-size);
        font-weight: var(--tip-font-weight);
        font-family: Arial, sans-serif;
        padding: var(--tip-pad);
        border-radius: var(--tip-radius);
        white-space: nowrap;
        box-shadow: 0 4px 16px rgba(0,0,0,0.3);
        letter-spacing: 0.02em;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    /* --- Tooltip caret (::before) --- */
    .jbtn-icon::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 1px);
        left: 50%;
        transform: translateX(-50%) translateY(7px);
        opacity: 0;
        pointer-events: none;
        z-index: 101;
        border: 6px solid transparent;
        border-top-color: var(--tip-bg);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .jbtn-icon:hover::after,
    .jbtn-icon:hover::before {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

/* ============================================================
   Size modifiers — compose alongside .jbtn
   ============================================================ */
.jbtn-sm {
    --btn-icon-size: 14px;
    --btn-pad-v: 4px;
    --btn-pad-h: 9px;
    --btn-gap: 4px;
    --btn-font-size: 12px;
}

.jbtn-lg {
    --btn-icon-size: 24px;
    --btn-pad-v: 10px;
    --btn-pad-h: 20px;
    --btn-gap: 8px;
    --btn-font-size: 16px;
}
