/*
 * CSIR-IHBT Joomla Template
 * What's New ticker + search bar (loaded on all pages).
 *
 * Relies on the design tokens (:root variables) defined in the main
 * template stylesheet, which is always loaded.
 */

/* =========================================================
   FULL-WIDTH CONTAINERS INSIDE THE TICKER
   ========================================================= */

.whatsnew-wrap .container,
.whatsnew-ticker .container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}


/* =========================================================
   WHAT'S NEW BAR + SEARCH
   ========================================================= */

.whatsnew-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.whatsnew-bar .whatsnew-wrap {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.whatsnew-wrap {
    display: flex;
    align-items: center;
    width: 100%;
    height: var(--ticker-h);
    padding: 0 5%;
    background: var(--blue-dark);

    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.whatsnew-wrap .moduletable {
    margin: 0;
    padding: 0;
}

.whatsnew-label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;

    height: var(--ticker-h);
    padding: 0 28px;

    color: var(--ink);
    background: var(--green);
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.whatsnew-ticker {
    flex: 1;
    min-width: 0;
    height: var(--ticker-h);
    overflow: hidden;
    background: var(--blue-dark);
}

.whatsnew-ticker .container {
    height: var(--ticker-h);
}


/* =========================================================
   SCROLLING NEWS TICKER
   ========================================================= */

.ihbt-ticker {
    width: 100%;
    height: var(--ticker-h);
    overflow: hidden;
}

/* The track holds two identical groups side by side */
.ihbt-ticker-track {
    display: flex;
    flex-wrap: nowrap;

    width: max-content;
    height: var(--ticker-h);

    animation-name: ihbt-ticker-scroll;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* Each group is at least one screen wide, so a single news item
   is never shown twice at the same time */
.ihbt-ticker-group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 60px;

    box-sizing: border-box;
    min-width: 100vw;
    height: var(--ticker-h);
    margin: 0;
    padding: 0 30px;
    list-style: none;
}

.ihbt-ticker-group li {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: nowrap;
    line-height: var(--ticker-h);
}

.ihbt-ticker-group li::before {
    content: "\2022";
    margin-right: 12px;
    color: var(--green);
}

.ihbt-ticker-group a,
.ihbt-ticker-group a:visited {
    color: #ffffff;
    font-size: 16px;
    text-decoration: none;
}

.ihbt-ticker-group a:hover,
.ihbt-ticker-group a:focus {
    text-decoration: underline;
}

/* Pause when the visitor points at or tabs into the ticker */
.ihbt-ticker:hover .ihbt-ticker-track,
.ihbt-ticker:focus-within .ihbt-ticker-track {
    animation-play-state: paused;
}

@keyframes ihbt-ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}


/* =========================================================
   SEARCH BOX (kept commented out, as in the original)
   ========================================================= */

/*.whatsnew-search {
    display: flex;
    align-items: center;
    flex: 0 0 250px;
    width: 250px;
    margin-left: auto;
}

.whatsnew-search form,
.whatsnew-search .mod-search {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
}

.whatsnew-search input[type="search"],
.whatsnew-search input[type="text"],
.whatsnew-search .form-control {
    flex: 1;
    min-width: 0;
    height: var(--control-h);
    padding: 0 14px;

    color: #26324a;
    background: var(--white);
    font-size: 14px;

    border: 1px solid #d5dbea;
    border-radius: var(--radius-sm);
    outline: none;

    transition: border-color .2s ease, box-shadow .2s ease;
}

.whatsnew-search input::placeholder {
    color: #7b8498;
    opacity: 1;
}

.whatsnew-search input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(var(--blue-rgb), .12);
}

.whatsnew-search button,
.whatsnew-search input[type="submit"] {
    height: var(--control-h);
    padding: 0 16px;

    color: var(--white);
    background: var(--blue);
    font-size: 14px;

    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;

    transition: background .2s ease;
}

.whatsnew-search button:hover,
.whatsnew-search input[type="submit"]:hover {
    background: var(--blue-dark);
}
*/


/* =========================================================
   RESPONSIVE
   ========================================================= */

/* ---------- Tablet (<= 900px) ---------- */
@media (max-width: 900px) {

    .whatsnew-wrap {
        padding: 0 3%;
    }

    .whatsnew-label {
        padding: 0 18px;
        font-size: 15px;
    }
}


/* ---------- Phone (<= 600px) ---------- */
@media (max-width: 600px) {

    /* One variable keeps the label, ticker and bar the same height */
    .whatsnew-bar {
        --ticker-h: 40px;

        flex-direction: column;
        align-items: stretch;
    }

    /* Search sits on its own row above the ticker */
    .whatsnew-search {
        flex: none;
        width: 100%;
        margin: 0;
    }

    .whatsnew-search form,
    .whatsnew-search .mod-search {
        width: 100%;
        margin: 0;
    }

    .whatsnew-search input[type="search"],
    .whatsnew-search input[type="text"],
    .whatsnew-search .form-control {
        width: 100%;
        min-width: 0;
        font-size: 16px;      /* stops iPhones zooming in on focus */
    }

    /* Label + ticker stay on ONE row, edge to edge */
    .whatsnew-bar .whatsnew-wrap,
    .whatsnew-wrap {
        flex-wrap: nowrap;
        width: 100%;
        height: var(--ticker-h);
        padding: 0;
    }

    .whatsnew-label {
        padding: 0 12px;
        font-size: 14px;
    }

    .whatsnew-ticker {
        flex: 1 1 auto;
        min-width: 0;
    }

    .ihbt-ticker-group a {
        font-size: 14px;
    }
}


/* ---------- Small phone (<= 480px) ---------- */
@media (max-width: 480px) {

    .whatsnew-bar {
        --ticker-h: 38px;
    }

    .whatsnew-label {
        padding: 0 10px;
        font-size: 13px;
    }

    .ihbt-ticker-group a {
        font-size: 13px;
    }
}


/* =========================================================
   REDUCED MOTION
   Visitors who prefer less motion get a static, scrollable
   list instead of the moving ticker.
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
    }

    .ihbt-ticker {
        overflow-x: auto;
    }

    .ihbt-ticker-track {
        animation: none;
    }

    /* Hide the second (copy) group when nothing is moving */
    .ihbt-ticker-group[aria-hidden="true"] {
        display: none;
    }
}

/* =========================================================
   WHAT'S NEW – ANNOUNCEMENT HOVER TITLE
   ========================================================= */

.whatsnew-ticker a[title] {
    position: relative;
    cursor: pointer;
}

/* Tooltip */
.whatsnew-ticker a[title]:hover::after,
.whatsnew-ticker a[title]:focus-visible::after {
    content: attr(title);

    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);

    width: max-content;
    max-width: min(420px, 85vw);

    padding: 12px 16px;

    background: #20377d;
    color: #ffffff;

    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;

    border-radius: 8px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.20);

    white-space: normal;
    overflow-wrap: anywhere;

    z-index: 9999;

    pointer-events: none;
}

/* Small tooltip arrow */
.whatsnew-ticker a[title]:hover::before,
.whatsnew-ticker a[title]:focus-visible::before {
    content: "";

    position: absolute;
    left: 20px;
    bottom: calc(100% + 4px);

    border-width: 8px;
    border-style: solid;
    border-color: #20377d transparent transparent transparent;

    z-index: 9999;
}

/* =========================================================
   WHAT'S NEW – NEW STICKER AFTER EACH ANNOUNCEMENT
   ========================================================= */

.ihbt-ticker-group li a::after {
    content: "NEW";

    display: inline-block;
    vertical-align: middle;

    margin-left: 10px;
    padding: 3px 8px;

    background: #82d83e;
    color: #20377d;

    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;

    border-radius: 4px;
    letter-spacing: 0.5px;

    animation: ihbt-new-pulse 2s ease-in-out infinite;
}

/* Subtle animation */
@keyframes ihbt-new-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Mobile sticker */
@media (max-width: 600px) {
    .ihbt-ticker-group li a::after {
        margin-left: 6px;
        padding: 2px 6px;
        font-size: 9px;
    }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .ihbt-ticker-group li a::after {
        animation: none;
    }
}
/* =========================================================
   WHAT'S NEW – PLAY / PAUSE BUTTON
   ========================================================= */

.whatsnew-bar {
    display: flex;
    align-items: center;
}

/* =========================================================
   WHAT'S NEW – PLAY / PAUSE CONTROL
   ========================================================= */

.ihbt-ticker-control {
    flex: 0 0 42px;
    width: 42px;
    height: var(--ticker-h);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: none;
    border-radius: 0;

    background: var(--blue-dark);
    color: #ffffff;

    cursor: pointer;
    z-index: 5;
}

/*.ihbt-ticker-control:hover {
    background: var(--green);
}*/

/* Pause icon */
.ticker-pause-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 18px;
}

.ticker-pause-icon::before,
.ticker-pause-icon::after {
    content: "";
    position: absolute;
    top: 0;

    width: 5px;
    height: 18px;

    background: #ffffff;
    border-radius: 2px;
}

.ticker-pause-icon::before {
    left: 1px;
}

.ticker-pause-icon::after {
    right: 1px;
}

/* Play icon */
.ihbt-ticker-control.is-playing .ticker-pause-icon {
    width: 0;
    height: 0;

    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 15px solid #ffffff;
}

/* Hide pause bars when Play is visible */
.ihbt-ticker-control.is-playing .ticker-pause-icon::before,
.ihbt-ticker-control.is-playing .ticker-pause-icon::after {
    display: none;
}

/* Manually paused */
.ihbt-ticker.is-paused .ihbt-ticker-track {
    animation-play-state: paused !important;
}

/* Manual Play overrides hover pause */
.ihbt-ticker.is-manually-playing .ihbt-ticker-track {
    animation-play-state: running !important;
}

/* Mobile */
@media (max-width: 600px) {
    .ihbt-ticker-control {
        flex-basis: 38px;
        width: 38px;
    }
}





