/* ============================================================
   Site Toolkit — Frontend Styles
   ============================================================ */

/* ── Quotes ──────────────────────────────────────────────────────────────── */

/* Target the Atahualpa widget wrapper AND our inner wrap by attribute pattern.
   Atahualpa styles div descendants inside #right — we outspecify it here. */
div#wrapper div#container td#right div.stk-quote-widget,
div#wrapper div#container td#right div.stk-quote-widget *,
div#wrapper div#container td#left div.stk-quote-widget,
div#wrapper div#container td#left div.stk-quote-widget *,
[id^="stk_quote_widget"] {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
}

/* Belt-and-suspenders: target the exact ID prefix Atahualpa sees */
[id^="stk-quote-wrap"] {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-left: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    border-radius: 0 !important;
}
[id^="stk-quote-wrap"]::before,
[id^="stk-quote-wrap"]::after { display: none !important; content: none !important; }

.stk-quote-text  { display: inline !important; margin: 0 !important; padding: 0 !important; background: transparent !important; border: none !important; font-style: inherit !important; font-size: inherit !important; color: inherit !important; }
.stk-quote-author { display: inline !important; margin: 0 !important; padding: 0 !important; font-style: inherit !important; color: inherit !important; }
.stk-quote-btn   { display: inline !important; background: transparent !important; border: none !important; padding: 0 !important; margin-left: .4em !important; font-size: inherit !important; color: inherit !important; cursor: pointer !important; text-decoration: underline !important; opacity: .5 !important; box-shadow: none !important; }
.stk-quote-btn:hover { opacity: 1 !important; }

/* ── PageNavi ────────────────────────────────────────────────────────────── */
.stk-pagenavi {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35em;
    margin: 2em 0;
    font-size: .9em;
}

.stk-pagenavi a,
.stk-pagenavi .stk-page-current,
.stk-pagenavi .stk-page-gap,
.stk-pagenavi .stk-page-prev,
.stk-pagenavi .stk-page-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1em;
    height: 2.1em;
    padding: 0 .5em;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.stk-pagenavi a {
    background: #f0f0f0;
    color: #333;
}
.stk-pagenavi a:hover {
    background: #0073aa;
    color: #fff;
}

.stk-pagenavi .stk-page-current {
    background: #0073aa;
    color: #fff;
    cursor: default;
}

.stk-pagenavi .stk-page-gap,
.stk-pagenavi .stk-page-prev,
.stk-pagenavi .stk-page-next {
    background: transparent;
    color: #555;
}

/* ── Popup ───────────────────────────────────────────────────────────────── */
.stk-popup-trigger {
    cursor: pointer;
}

.stk-popup-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    background: rgba(0,0,0,.6) !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.stk-popup-overlay.stk-popup-open {
    display: flex !important;
}

/* Default size: ~5 × 5 inches at 96dpi = 480 × 500px.
   !important guards against Atahualpa or other theme overrides. */
.stk-popup-container {
    position: relative !important;
    width: 480px !important;
    height: 500px !important;
    min-width: 280px !important;
    min-height: 300px !important;
    max-width: 98vw !important;
    max-height: 96vh !important;
    background: #fff !important;
    border-radius: 5px !important;
    box-shadow: 0 8px 40px rgba(0,0,0,.45) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Reader-resizable via CSS resize */
.stk-popup-resizable {
    resize: both !important;
    overflow: auto !important;
}

/* Title bar */
.stk-popup-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45em .75em .45em 1em;
    background: #f6f7f7;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    user-select: none;
}

.stk-popup-label {
    font-size: .8em;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stk-popup-close {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0 0 0 .5em;
    flex-shrink: 0;
    transition: color .15s;
}
.stk-popup-close:hover { color: #c00; }
.stk-popup-close:focus { outline: 2px solid #0073aa; outline-offset: 2px; }

/* Iframe fills remaining height */
.stk-popup-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

.stk-popup-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Resize hint in bottom-right corner */
.stk-popup-resize-hint {
    position: absolute;
    bottom: 2px;
    right: 6px;
    font-size: 10px;
    color: #bbb;
    pointer-events: none;
    user-select: none;
}

/* ── Mobile bar ──────────────────────────────────────────────────────────── */
#stk-mobile-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.8);
    text-align: center;
    padding: .6em;
    z-index: 9999;
}

#stk-fullsite-link {
    color: #fff;
    font-size: .8em;
    text-decoration: underline;
}

/* ── Mobile body overrides (.stk-mobile class) ───────────────────────────── */
@media (max-width: 768px) {
    body.stk-mobile {
        font-size: 16px;
        line-height: 1.7;
    }
    body.stk-mobile img {
        max-width: 100%;
        height: auto;
    }
    body.stk-mobile .stk-popup-container {
        width: 98%;
    }
}
