/*
 * Copyright (c) 2026 Handi Homepage
 * This file is part of HandiHomepage and is released under the GNU General Public License v3.0.
 * See the LICENSE file in the repository root for full details.
 */
 
/* =========================================================
   ELDERLY THEME (PURE CSS OVERRIDES)
   HIGH CONTRAST + LARGE TYPE
   Font color: off-black (#1e1e1e) for strong but softer contrast
========================================================= */

html, body {
    font-size: 20px;
    line-height: 1.8;
    background: #f6f8fc;
    color: #1e1e1e;   /* off-black, still high contrast */
    font-family: Arial, Helvetica, sans-serif;
}

/* LINKS */
a {
    color: #0047cc;
    font-weight: 700;
}

/* =========================================================
   HEADER – ENHANCED ELDERLY STYLES (flex, large touch targets)
========================================================= */
header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border-bottom: 3px solid #0047cc;
    padding: 12px 20px;
}

/* Brand / logo */
.brand {
    font-size: 2rem;
    color: #0047cc;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* Make search wrapper take full width */
.nav-links {
    flex: 1;
    min-width: 200px;
}

/* search wrapper */
.search-wrapper {
    width: 100%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 20px;
    box-sizing: border-box;
}

#searchInput {
    flex: 1;
    min-width: 0;
}

/* Mobile: stack everything vertically */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .site-branding {
        text-align: center;
    }
    
    .nav-links {
        width: 100%;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .header-weather {
        text-align: center;
    }
}

/* Small phones: wrap search inner elements */
@media (max-width: 550px) {
    .search-wrapper {
        flex-wrap: wrap;
        border-radius: 28px;
        padding: 12px;
    }
    
    #searchInput {
        flex: 1 1 100%;
        order: 1;
    }
    
    #searchEngine {
        flex: 1;
        order: 2;
    }
    
    #searchEngineLogo {
        order: 3;
    }
    
    .search-button {
        order: 4;
        width: 100%;
        border-radius: 40px;
    }
}
.search-wrapper:focus-within {
    border-color: #0047cc;
    box-shadow: 0 0 0 3px rgba(0, 71, 204, 0.2);
}

/* Search engine logo (e.g., SP) */
.search-engine-logo {
    font-weight: 700;
    font-size: 1.2rem;
    background: #eaf2ff;
    padding: 8px 12px;
    border-radius: 40px;
    color: #0047cc;
    margin-right: 8px;
    white-space: nowrap;
}

/* Select dropdown */
.search-engine-select {
    background: #ffffff;
    border: none;
    border-right: 2px solid #cbd5e1;
    padding: 10px 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #1e1e1e;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}
.search-engine-select:hover {
    background: #f8fbff;
}

/* Search input field */
#searchInput {
    flex: 1;
    border: none;
    padding: 12px 12px;
    font-size: 0.8rem;
    background: transparent;
    color: #1e1e1e;
    outline: none;
    min-width: 120px;
}
#searchInput::placeholder {
    color: #64748b;
    font-weight: 500;
}

/* Arrow icon inside search wrapper */
.search-wrapper .fa-arrow-right {
    font-size: 1.3rem;
    color: #0047cc;
    margin: 0 8px;
    cursor: pointer;
}
.search-wrapper .fa-arrow-right:hover {
    color: #0037a3;
}

/* Weather widget inside header */
.header-weather {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eaf2ff;
    padding: 8px 16px;
    border-radius: 48px;
    border: 1px solid #bfd4ff;
    white-space: nowrap;
}
.header-weather i {
    font-size: 1.4rem;
    color: #0047cc;
}
#weather {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-size: 0.95rem;
    font-weight: 600;
    flex-wrap: wrap;
}
.weather-location,
.weather-temp,
.weather-outlook {
    white-space: nowrap;
    color: #1e1e1e;
}

/* Responsive: stack on narrow screens */
@media (max-width: 800px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    .brand {
        justify-content: center;
    }
    .header-weather {
        justify-content: center;
        white-space: normal;
    }
    #weather {
        justify-content: center;
    }
}

/* Large touch targets for all interactive elements */
.search-engine-select,
#searchInput,
.search-wrapper .fa-arrow-right,
.header-weather {
    cursor: pointer;
}
.search-engine-select,
#searchInput,
.search-engine-logo {
    min-height: 44px;  /* comfortable tap size */
}

/* Focus outlines for accessibility */
.search-engine-select:focus,
#searchInput:focus,
.search-wrapper .fa-arrow-right:focus,
.header-weather:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 2px;
}

/* =========================================================
   THEME TOGGLE
========================================================= */
.theme-toggle {
    background: #ffffff;
    border: 2px solid #0047cc;
    color: #0047cc;
    font-size: 0.95rem;
    padding: 8px 12px;
    font-weight: bold;
    border-radius: 6px;
}
.theme-toggle:hover {
    background: #0047cc;
    color: #ffffff;
    border-color: #0047cc;
}

/* GRID */
#dashboard-grid {
    gap: 18px;
}

/* PANELS */
.dashboard-item {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* TITLES */
.panel-title {
    font-size: 1rem;
    color: #0047cc;
}

/* PIN BUTTON */
.pin-btn {
    width: 48px;
    height: 48px;
    font-size: 1rem;
    border: 2px solid #cbd5e1;
    background: #fff;
    border-radius: 12px;        /* added for consistency */
    cursor: pointer;
    transition: all 0.2s ease;
}

.pin-btn:hover {
    background: #f0f2f5;
    border-color: #0047cc;
}

.pin-btn.pinned {
    background: #0047cc;
    color: #fff;
    border-color: #0047cc;
}

/* BUTTONS */
.phone-card {
    min-height: 48px;
    font-size: 1.05rem;
}

.radio-station {
    min-height: 48px;
    font-size: 1.05rem;
}

.radio-controls {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.radio-stop-btn {
    min-height: 56px;
    padding: 0 20px;

    font-size: 1.15rem;
    font-weight: 700;

    background: #cc0000;
    color: #fff;

    border-radius: 999px;

    cursor: pointer;

    white-space: nowrap;
}

.radio-stop-btn:hover {
    background: #a80000;
}

/* Radio header row (title, lock, pin) */
.radio-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.radio-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Lock toggle button */
.radio-lock-toggle, .phone-lock-toggle, .music-lock-toggle, .emergency-lock-toggle {
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 0 solid #cbd5e1;
    border-radius: 12px;
    font-size: 1.4rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 0;
    right: 48px;
    bottom: 10px;
}

.radio-lock-toggle:hover {
    background: #f0f2f5;
}

/* MUSIC / RADIO READABILITY */
.music-track-item,
.radio-station {
    font-size: 1.05rem;
}

/* Music player synthesiser */
.music-synth {
    display: block;
    width: 100%;
    height: 80px;
    background: #0a0a1a;
    border-radius: 12px;
    margin: 1rem 0;
}

/* Radio synthesiser (for consistency) */
.radio-synth {
    display: block;
    width: 100%;
    height: 80px;
    background: #0a0a1a;
    border-radius: 12px;
    margin: 1rem 0;
}

.radio-station span {
    font-size: 0.9rem;
    color: #475569;    
}
.radio-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}
#galleryWakeLockBtn {
    min-height: 56px;
    padding: 0 20px;
    color: #475569 !important;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    width: 100%;
    max-width: 315px;
}
.radio-player-area {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: unset;
  margin-top: 6px;
  background: #ffffff;
  color: #0047cc;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  border: unset;
  border-radius: unset;
  cursor: pointer;
}

.radio-player-area:hover {
  color: #ffffff;
  text-decoration: none;
}

.radio-player-area:active {
  background: #0037a3;
  color: #ffffff;
}

.radio-now-playing {
    display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 24px;
  margin-top: 6px;
  background: #ffffff;
  color: #0047cc;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

/* CALL TO ACTION */
a[href^="tel"] {
    font-size: 1.1rem;
    padding: 10px 14px;
}

/* GALLERY MODULE */
.gallery-content {
  min-height: 400px;
  text-align: center;
}

.gallery-slide-img {
    max-height: 300px;
    border: 3px solid #0047cc;
    border-radius: 12px;
}

.gallery-caption {
    font-size: 1.1rem;
    color: #0047cc;
    font-weight: 600;
    margin-top: 12px;
}

.gallery-btn {
    min-height: 48px;
    font-size: 1.05rem;
    padding: 8px 16px;
    border: 2px solid #0047cc;
    background: #ffffff;
    color: #0047cc;
    border-radius: 24px;
    font-weight: bold;
}

.gallery-btn:hover {
    background: #0047cc;
    color: #ffffff;
}

.gallery-thumbs {
    margin-top: 12px;
}

.gallery-thumb {
    width: 60px;
    height: 60px;
    border: 3px solid #cbd5e1;
}

.gallery-thumb.active {
    border-color: #0047cc;
}


/* LIGHTBOX */
/* =========================================================
   GALLERY LIGHTBOX FIX
========================================================= */

/* Hidden by default */
.gallery-lightbox {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: 99999 !important;

    justify-content: center !important;
    align-items: center !important;
    flex-direction: column !important;

    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Visible when active */
.gallery-lightbox.active {
    display: flex !important;
}

/* Lightbox image */
.gallery-lightbox-img {
    max-width: 90vw !important;
    max-height: 80vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 12px !important;
    cursor: pointer;
}

/* Caption */
.gallery-lightbox-caption {
    margin-top: 18px !important;
    max-width: 90vw !important;
    text-align: center !important;
    color: #ffffff !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
}

/* Close button */
.gallery-lightbox-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;

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

    width: 56px !important;
    height: 56px !important;

    background: #ffffff !important;
    color: #0047cc !important;
    border: 3px solid #0047cc !important;
    border-radius: 50% !important;

    font-size: 2rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;

    cursor: pointer !important;
}

/* Previous / next buttons */
.gallery-lightbox-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;

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

    width: 64px !important;
    height: 64px !important;

    background: rgba(255, 255, 255, 0.95) !important;
    color: #0047cc !important;
    border: 3px solid #0047cc !important;
    border-radius: 50% !important;

    font-size: 2rem !important;
    font-weight: 700 !important;

    cursor: pointer !important;
}

.gallery-lightbox-prev {
    left: 20px !important;
}

.gallery-lightbox-next {
    right: 20px !important;
}

/* Hover states */
.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
    background: #0047cc !important;
    color: #ffffff !important;
}

/* Keyboard focus */
.gallery-lightbox-close:focus,
.gallery-lightbox-nav:focus {
    outline: 4px solid #ffcc00 !important;
    outline-offset: 4px !important;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .gallery-lightbox-close {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.6rem !important;
    }

    .gallery-lightbox-nav {
        width: 52px !important;
        height: 52px !important;
        font-size: 1.5rem !important;
    }

    .gallery-lightbox-prev {
        left: 10px !important;
    }

    .gallery-lightbox-next {
        right: 10px !important;
    }

    .gallery-lightbox-caption {
        font-size: 1rem !important;
    }
}

/* =========================================================
   BUS TRACKER — ELDERLY THEME
========================================================= */

/* Main content wrapper */
.bus-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 14px;
    width: 100%;
}

/* Loading / offline / empty states */
.bus-loading,
.bus-no-data,
.bus-offline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 180px;
    padding: 28px 24px;
    text-align: center;

    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;

    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.6;
    color: #1e1e1e;
}

.bus-loading i,
.bus-no-data i,
.bus-offline i {
    font-size: 2.5rem;
    color: #0047cc;
    margin-bottom: 14px;
}

/* Offline helper text */
.bus-offline-desc {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
}

/* Timestamp bar */
.bus-timestamp {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    padding: 12px 16px;

    background: #eaf2ff;
    border: 2px solid #bfd4ff;
    border-radius: 12px;

    font-size: 1rem;
    font-weight: 700;
    color: #0047cc;
}

.bus-timestamp i {
    font-size: 1rem;
}

/* Real-time / scheduled footnote */
.bus-footnote {
    margin-left: auto;
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
}

/* Bus stop card */
.bus-stop-card {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Stop name */
.bus-stop-title {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1e1e1e;
}

/* Direction */
.bus-direction {
    margin-bottom: 14px;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
}

/* Individual route row */
.bus-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    padding: 12px 0;
    border-top: 1px solid #e2e8f0;
}

.bus-item:first-of-type {
    border-top: none;
    padding-top: 0;
}

/* Route badge */
.bus-route {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 110px;
    padding: 8px 12px;

    background: #0047cc;
    color: #ffffff;

    font-size: 1rem;
    font-weight: 700;
    line-height: 1;

    border-radius: 999px;
}

/* Arrival time */
.bus-arrival {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e1e1e;
    text-align: right;
    white-space: nowrap;
}

/* No buses text */
.bus-no-buses {
    padding: 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
}

/* Refresh / retry buttons */
.bus-refresh-btn,
.bus-retry-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 56px;
    padding: 0 24px;
    margin-top: 6px;

    background: #ffffff;
    color: #0047cc;

    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;

    border: 3px solid #0047cc;
    border-radius: 999px;

    cursor: pointer;
}

.bus-refresh-btn:hover,
.bus-retry-btn:hover {
    background: #0047cc;
    color: #ffffff;
}

/* Keyboard focus */
.bus-refresh-btn:focus,
.bus-retry-btn:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 4px;
}

/* Mobile layout */
@media (max-width: 640px) {
    .bus-stop-title {
        font-size: 1.2rem;
    }

    .bus-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .bus-route {
        min-width: auto;
    }

    .bus-arrival {
        text-align: left;
        white-space: normal;
    }

    .bus-footnote {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }

    .bus-refresh-btn,
    .bus-retry-btn {
        width: 100%;
    }
}

/* =========================================================
   ELDERLY THEME OVERRIDES — GALLERY BUTTONS
========================================================= */

/* Button toolbar wrapper */
.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 16px 0 18px;
}

/* Common gallery buttons */
.gallery-controls button,
.gallery-controls .gallery-btn,
.gallery-controls .stay-awake-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 56px;
    padding: 0 22px;
    margin: 0;

    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;

    color: #0047cc;
    background: #ffffff;
    border: 3px solid #0047cc;
    border-radius: 999px;

    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

/* Make the Stay Awake button start on a new line */
.gallery-controls .stay-awake-btn {
    flex-basis: 100%;
    width: fit-content;
}

/* Hover/active states */
.gallery-controls button:hover,
.gallery-controls .gallery-btn:hover,
.gallery-controls .stay-awake-btn:hover {
    background: #eaf2ff;
}

.gallery-controls button:active,
.gallery-controls .gallery-btn:active,
.gallery-controls .stay-awake-btn:active {
    background: #dbeafe;
}

/* Strong keyboard focus */
.gallery-controls button:focus,
.gallery-controls button:focus-visible,
.gallery-controls .gallery-btn:focus,
.gallery-controls .gallery-btn:focus-visible,
.gallery-controls .stay-awake-btn:focus,
.gallery-controls .stay-awake-btn:focus-visible {
    outline: 4px solid #ffcc00;
    outline-offset: 3px;
}

/* Keep icon sizes balanced */
.gallery-controls i {
    font-size: 1.05em;
    line-height: 1;
}

/* Stack buttons vertically on very narrow screens */
@media (max-width: 480px) {
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-controls button,
    .gallery-controls .gallery-btn,
    .gallery-controls .stay-awake-btn {
        width: 100%;
        justify-content: center;
    }

    .gallery-controls .stay-awake-btn {
        flex-basis: auto;
        width: 100%;
    }
}

/* REMOVE HEAVY EFFECTS */
.dashboard-item:hover {
    transform: none;
    box-shadow: none;
}

/* FOCUS ACCESSIBILITY */
button:focus,
a:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 3px;
}

/* =========================================================
   ELDERLY THEME OVERRIDES — MASTODON MODULE
========================================================= */

/* Content wrapper */
.mastodon-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
}

/* Each trending story */
.mastodon-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 14px;

    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px;

    overflow: hidden;
}

/* Thumbnail on the LEFT */
.mastodon-image,
.mastodon-item img {
    display: block;
    flex: 0 0 100px !important;
    width: 100px !important;
    height: 75px !important;
    max-width: 100px !important;
    min-width: 100px !important;
    object-fit: cover;
    border-radius: 8px;
    background: #e2e8f0;
    margin: 0 !important;
}

/* Placeholder */
.mastodon-image.placeholder {
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 1.5rem;
}

/* Text content on the RIGHT */
.mastodon-body {
    flex: 1 1 auto;
    min-width: 0;
}

/* Title */
.mastodon-title {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0047cc;
    margin-bottom: 6px;
    text-decoration: underline;
}

/* Source/provider */
.mastodon-provider {
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

/* Description */
.mastodon-desc {
    font-size: 1rem;
    line-height: 1.5;
    color: #1e1e1e;

    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.module-loading,
.module-empty,
.module-error {
    padding: 20px;
    text-align: center;
    font-size: 1.05rem;
    color: #1e1e1e;
}

/* Compact panel height */
.dashboard-item[data-module="mastodon"] {
    min-height: auto !important;
    height: auto !important;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .mastodon-image,
    .mastodon-item img {
        flex-basis: 80px !important;
        width: 80px !important;
        height: 60px !important;
        max-width: 80px !important;
        min-width: 80px !important;
    }

    .mastodon-title {
        font-size: 1.05rem;
    }

    .mastodon-provider,
    .mastodon-desc {
        font-size: 0.95rem;
    }
}

/* =========================================================
   ELDERLY THEME OVERRIDES — NEWS MODULE
========================================================= */

.news-scroll-wrapper,
.mastodon-scroll-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.mastodon-list {
    max-height: none !important;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 4px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-article,
.mastodon-item {
    padding: 12px 14px;
    border-bottom: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 0;
    min-height: 170px;
    height: 170px;
    overflow: hidden;
}

.news-article:last-child,
.mastodon-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.news-article a,
.mastodon-title {
    display: block;
    font-weight: 700;
    color: #1e1e1e;
    text-decoration: none;
    margin-bottom: 6px;
}

.news-date {
    font-size: 0.85rem;
    color: #475569;
}

.news-scroll-btn, .music-scroll-btn, .radio-scroll-btn {
    width: 100%;
    padding: 12px 0;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    background: #f8fafc;
    color: #1e1e1e;
    font-size: 1rem;
    cursor: pointer;
}

.news-scroll-btn:hover, .music-scroll-btn:hover, .radio-scroll-btn:hover {
    background: #e2e8f0;
    border-color: #0047cc;
    color: #0047cc;
}
.news-scroll-btn:active, .music-scroll-btn:active, .radio-scroll-btn:active {
    background: #e2e8f0;
}

/* =========================================================
   FRIENDLY PHONE — ELDERLY THEME
========================================================= */

/* Main content area */
.phone-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Grid layout */
.phone-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 16px;
}

/* On wider screens allow two columns */
@media (min-width: 900px) {
    .phone-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Individual contact card */
.phone-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    background: #ffffff;
    border: 3px solid #0047cc;
    border-radius: 20px;

    padding: 24px 20px;
    min-height: 280px;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Contact photo */
.phone-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;

    border: 4px solid #0047cc;
    background: #f1f5f9;

    margin-bottom: 16px;
}

/* Placeholder avatar */
.phone-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 2.5rem;
    color: #0047cc;
}

/* Contact name */
.phone-name {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1e1e1e;
    margin-bottom: 8px;

    word-break: break-word;
}

/* Phone number */
.phone-number {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 20px;

    word-break: break-word;
}

/* Call button */
.phone-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 60px;
    width: 100%;

    padding: 14px 20px;
    margin-top: auto;

    background: #008000;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 700;

    border: 3px solid #006400;
    border-radius: 14px;

    transition: none;
}

/* Hover state */
.phone-call:hover {
    background: #006400;
    color: #ffffff;
    text-decoration: none;
}

/* Active state */
.phone-call:active {
    background: #004d00;
}

/* Icon inside call button */
.phone-call i {
    font-size: 1.2rem;
}

/* Empty module state */
.module-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 300px;
    padding: 32px 24px;

    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.6;
    color: #1e1e1e;
}

.module-empty i {
    font-size: 3.5rem;
    color: #0047cc;
    margin-bottom: 16px;
}

/* Hint text */
.module-hint {
    margin-top: 12px;
    font-size: 1.05rem;
    font-weight: 500;
    color: #475569;
}

/* Strong keyboard focus */
.phone-call:focus,
.phone-call:focus-visible {
    outline: 4px solid #ffcc00;
    outline-offset: 4px;
}

/* High contrast support */
@media (prefers-contrast: more) {
    .phone-card {
        border-width: 4px;
    }

    .phone-call {
        border-width: 4px;
    }

    .phone-name,
    .phone-number {
        color: #000000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .phone-call,
    .phone-card {
        transition: none;
    }
}

/* =========================================================
   ELDERLY THEME OVERRIDES — LOCAL PLAYER + RADIO
========================================================= */

/* ---------- Audio panel spacing ---------- */

.local-player-content,
.radio-content {
    margin-top: 12px;
}

/* Current track title */
.local-player-content .current-track,
.local-player-content .track-title,
.local-player-content .now-playing {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.5;
    color: #1e1e1e;
    margin-bottom: 6px;
    word-break: break-word;
}

/* Status text */
.local-player-content .player-status,
.local-player-content .status {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 14px;
}

/* ---------- Player control buttons ---------- */

.player-controls,
.music-controls,
.audio-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;   /* ← add this line */
    margin: 14px 0 18px;
}

.player-controls button,
.music-controls button,
.audio-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 64px;
    min-height: 64px;
    padding: 0 20px;
    margin: 0;

    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;

    color: #0047cc;
    background: #ffffff;
    border: 3px solid #0047cc;
    border-radius: 16px;

    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: none;
}

.player-controls button:hover,
.music-controls button:hover,
.audio-controls button:hover {
    background: #eaf2ff;
}

.player-controls button:active,
.music-controls button:active,
.audio-controls button:active {
    background: #dbeafe;
}

/* Play button emphasis */
.player-controls .play-btn,
.player-controls .pause-btn,
.music-controls .play-btn,
.music-controls .pause-btn {
    min-width: 76px;
    background: #0047cc;
    color: #ffffff;
}

.player-controls .play-btn:hover,
.player-controls .pause-btn:hover,
.music-controls .play-btn:hover,
.music-controls .pause-btn:hover {
    background: #0037a3;
    color: #ffffff;
}

/* =========================================================
   ELDERLY THEME OVERRIDE — NOW PLAYING PANEL
========================================================= */

.music-now-playing {
    background: #ffffff !important;
    border: 2px solid #0047cc !important;
    border-radius: 16px !important;

    padding: 18px 20px !important;
    margin-bottom: 18px !important;

    text-align: center !important;

    font-size: 1.15rem !important;
    font-weight: 700 !important;
    line-height: 1.6 !important;
    color: #1e1e1e !important;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

/* Track title inside the panel */
.music-now-playing .track-title,
.music-now-playing .current-track,
.music-now-playing .now-playing {
    display: block;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1e1e1e !important;
    line-height: 1.5 !important;
    margin-bottom: 6px !important;
}

/* Artist / additional info */
.music-now-playing .track-artist,
.music-now-playing .artist-name,
.music-now-playing .track-info {
    display: block;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    line-height: 1.5 !important;
}

/* Playing icon */
.music-now-playing i {
    color: #0047cc !important;
    margin-right: 6px;
}

/* Mobile */
@media (max-width: 640px) {
    .music-now-playing {
        padding: 16px !important;
        font-size: 1.05rem !important;
    }

    .music-now-playing .track-title,
    .music-now-playing .current-track,
    .music-now-playing .now-playing {
        font-size: 1.15rem !important;
    }
}

.music-title {
  color: unset !important;    
}


.player-controls button:hover, .music-controls button:hover, .audio-controls button:hover {
  background: #eaf2ff;

}

.music-btn.primary {
  background: unset;
  color: unset;
  width: 55px;
  height: 55px;
}
/* ---------- Playlist items ---------- */

.music-track-list,
.track-list,
.playlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.music-track-item,
.track-item,
.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
    padding: 12px 14px;

    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 12px;

    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
    color: #1e1e1e;

    text-decoration: none;
    cursor: pointer;
    word-break: break-word;
}

/* Track icons */
.music-track-item i,
.track-item i,
.playlist-item i {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: #0047cc;
}

/* ---------- Radio station links ---------- */

.radio-stations,
.station-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.radio-station {
    display: flex;
    align-items: center;
    gap: 12px;

    width: 100%;
    min-height: 64px;
    padding: 14px 18px;

    background: #ffffff;
    color: #1e1e1e;
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;

    border: 2px solid #cbd5e1;
    border-radius: 14px;

    box-sizing: border-box;
}

.radio-station:hover {
    background: #f8fbff;
    border-color: #0047cc;
    color: #0047cc;
    text-decoration: none;
}

/* Radio icons */
.radio-station i {
    flex-shrink: 0;
    font-size: 1.35rem;
    color: #0047cc;
}

/* ---------- Focus accessibility ---------- */

.player-controls button:focus,
.player-controls button:focus-visible,
.music-track-item:focus,
.music-track-item:focus-visible,
.radio-station:focus,
.radio-station:focus-visible {
    outline: 4px solid #ffcc00;
    outline-offset: 3px;
}

/* ---------- Mobile layout ---------- */

@media (max-width: 640px) {
    .player-controls,
    .music-controls,
    .audio-controls {
        justify-content: center;
    }

    .player-controls button,
    .music-controls button,
    .audio-controls button {
        min-width: 60px;
        min-height: 60px;
        font-size: 1.35rem;
    }

    .radio-station,
    .music-track-item {
        font-size: 1rem;
    }
}

/* =========================================================
   ELDERLY THEME OVERRIDES — RADIO LINK COLOR FIX
   Prevent visited/current radio links from turning light blue.
========================================================= */

.radio-station,
.radio-station:link,
.radio-station:visited,
.radio-station:hover,
.radio-station:active,
.radio-station:focus,
.radio-station:focus-visible {
    color: #1e1e1e !important;
    text-decoration: none !important;
}

/* Icon color remains blue */
.radio-station i {
    color: #0047cc !important;
}

/* Hover state */
.radio-station:hover {
    background: #f8fbff !important;
    border-color: #0047cc !important;
}

.gallery-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 18px 0;
}

/* Top row grouping */
.gallery-control-group {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
}

/* Base button */
.gallery-btn {
    flex: 1 1 auto;
    min-height: 56px;
    padding: 0 18px;

    font-size: 1.15rem;
    font-weight: 700;

    border-radius: 14px;
    border: 2px solid #0047cc;

    background: #ffffff;
    color: #0047cc;

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

    gap: 8px;

    cursor: pointer;
}

/* Primary buttons (main navigation) */
.gallery-btn.primary {
    background: #ffffff;
    color: #0047cc;
    border-color: #0047cc;
}

/* Secondary button (wake lock) */
.gallery-btn.secondary {
    width: 100%;
    background: #f8fbff;
    border: 2px dashed #0047cc;
}

/* Hover states */
.gallery-btn:hover {
    transform: none;
    filter: brightness(0.95);
}

/* Active press feedback */
.gallery-btn:active {
    transform: scale(0.98);
}

/* Focus accessibility */
.gallery-btn:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 3px;
}

/* Mobile behavior */
@media (max-width: 500px) {
    .gallery-control-group {
        flex-wrap: wrap;
    }

    .gallery-btn {
        min-width: 120px;
    }
}
.lightbox button {
    min-height: 56px;
    min-width: 56px;

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

    background: #ffffff;
    color: #0047cc;

    border: 3px solid #0047cc;
    border-radius: 50%;

    font-size: 1.6rem;
    font-weight: 700;

    cursor: pointer;

    position: absolute;
}

.lightbox .gallery-lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox .gallery-lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox .gallery-lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.radio-scroll-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#stations-list.radio-list {
    max-height: 420px;
    overflow-y: auto;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
}

.music-scroll-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.music-playlist {
    max-height: 420px;
    overflow-y: auto;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
}
/* =========================================================
   UNIFIED ACTIVE STYLES FOR RADIO & MUSIC (DARK MARKUP + WHITE ICONS)
   ========================================================= */

/* Active music track */
.music-track-item.active,
.music-track-item.active i,
.music-track-item.active .music-track-icon i,
.music-track-item.active .fa-volume-high,
.music-track-item.active .fa-volume-mute {
    background: #1e2a3a !important;        /* Dark slate background */
    color: #ffffff !important;            /* White text */
    border-left: 5px solid #00d4ff !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5) !important;
}

/* Ensure any icon inside active music track becomes white */
.music-track-item.active i {
    color: #ffffff !important;
}

/* Active radio station (using .active-station class from JS) */
.radio-station.active-station,
.radio-station.active-station i,
.radio-station.active-station .station-icon i,
.radio-station.active-station .fa-volume-high,
.radio-station.active-station .fa-volume-mute {
    background: #1e2a3a !important;        /* Same dark background */
    color: #ffffff !important;
    border-left: 5px solid #00d4ff !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5) !important;
}

/* Also cover any .active class on radio stations (fallback) */
.radio-station.active,
.radio-station.active i {
    background: #1e2a3a !important;
    color: #ffffff !important;
    border-left: 5px solid #00d4ff !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5) !important;
}

/* Force icon color white for all cases above */
.radio-station.active-station i,
.radio-station.active i,
.music-track-item.active i {
    color: #ffffff !important;
}

/* =========================================================
   FIX: Ensure station name text (e.g., "Newstalk") turns white when active
   ========================================================= */
.radio-station.active-station span,
.radio-station.active span,
.music-track-item.active span {
    color: #ffffff !important;
}

/* Phone module action bar */
.phone-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.phone-lock-toggle:hover {
    background: #f0f2f5;
}

/* Disabled call link (when locked) */
.phone-call.locked {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.2);
}

/* =========================================================
   RADIO MODULE – Fix pin button overlapping lock
========================================================= */
.radio-header-actions, .music-header-actions, .radio-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.radio-header-actions .pin-btn,
.radio-header-actions .pin-btn-clone {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

/* Music header row (title, lock, pin) */
.music-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.music-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.music-lock-toggle:hover {
    background: #f0f2f5;
}

/* Ensure pin button (clone) behaves correctly */
.music-header-actions .pin-btn-clone,
.music-header-actions .pin-btn {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

/* Phone header row (title, lock, pin) */
.phone-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.phone-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Lock toggle button */
.phone-lock-toggle:hover {
    background: #f0f2f5;
}

/* Ensure cloned pin button behaves normally (no absolute positioning) */
.phone-header-actions .pin-btn-clone,
.phone-header-actions .pin-btn {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

/* Emergency header row (title, lock, pin) */
.emergency-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.emergency-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.emergency-lock-toggle:hover {
    background: #f0f2f5;
}

/* Ensure cloned pin button behaves normally */
.emergency-header-actions .pin-btn-clone,
.emergency-header-actions .pin-btn {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

/* Settings link button (used in empty states) */
.settings-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 20px;
    background: #0047cc;
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.settings-link-btn:hover {
    background: #0037a3;
}
.settings-link-btn i {
    font-size: 1.1rem;
}

/* =========================================================
   FORCE NON‑SCROLLABLE TOUCH LISTS (NEWS + MASTODON)
   Only the ▲ / ▼ buttons can navigate the list.
========================================================= */

.mastodon-list {
    height: 350px !important;          /* fixed height for exactly 2 items (170px each + 10px gap) */
    max-height: 350px !important;
    overflow-y: auto !important;       /* allow programmatic scrolling by buttons */
    scrollbar-width: thin;             /* optional: keep scrollbar visible for feedback */
}

/* Ensure the wrapper does not introduce extra scroll */
.mastodon-scroll-wrapper {
    overflow: visible;
    touch-action: manipulation;
}

/* Optional: prevent accidental overscroll on body while touching the list */
.mastodon-list {
    overscroll-behavior: contain;
}

/* =========================================================
   NEWS MODULE – FULL HEIGHT, NO CUTOFF
========================================================= */

/* Main news list container */
.news-list {
    max-height: 700px;      /* increased from ~380px – fits two full articles */
    overflow-y: auto;
    padding: 4px;
    scroll-behavior: smooth;
}

/* Individual article card */
.news-article {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 2px 14px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}
.news-article:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Header area (image + metadata) */
.news-header {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

/* Article image (if available) */
.news-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    background: #e2e8f0;
}
.news-image-placeholder {
    width: 80px;
    height: 80px;
    background: #e2e8f0;
    border-radius: 12px;
}

/* Metadata column */
.news-meta {
    flex: 1;
}
.news-source {
    font-weight: 700;
    color: #0047cc;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 4px;
}
.news-source a {
    color: #0047cc;
    text-decoration: none;
}
.news-source a:hover {
    text-decoration: underline;
}
.news-date {
    font-size: 0.8rem;
    color: #64748b;
}

/* Article title */
.news-title {
    font-size: 1.2rem;
    margin: 12px 0 8px;
    line-height: 1.4;
}
.news-title a {
    color: #1e1e1e;
    text-decoration: none;
}
.news-title a:hover {
    color: #0047cc;
    text-decoration: underline;
}

/* Article excerpt (full text) */
.news-excerpt {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 8px;
}

/* Scroll buttons (▲/▼) */
.news-scroll-btn {
    width: 100%;
    padding: 12px 0;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    background: #f8fafc;
    color: #1e1e1e;
    font-size: 1rem;
    cursor: pointer;
    margin: 6px 0;
}
.news-scroll-btn:hover {
    background: #e2e8f0;
    border-color: #0047cc;
    color: #0047cc;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .news-list {
        max-height: 600px;
    }
    .news-image, .news-image-placeholder {
        width: 60px;
        height: 60px;
    }
    .news-title {
        font-size: 1rem;
    }
    .news-excerpt {
        font-size: 0.85rem;
    }
}

/* =========================================================
   FIXED FOOTER – always at the bottom of the screen
========================================================= */
body {
    padding-bottom: 80px;          /* space for fixed footer */
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 2px solid #cbd5e1;
    padding: 0.5rem 1rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.footer-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

.footer-icon {
    background: transparent;
    border: none;
    font-size: 3.6rem;
    color: #0047cc;
    cursor: pointer;
    padding: 0.5rem 1.5rem;
    min-width: 56px;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: background-color 0.2s;
}

.footer-icon:hover {
    background-color: #eaf2ff;
}

.footer-icon:focus {
    outline: 4px solid #ffcc00;
    outline-offset: 2px;
}

@media (max-width: 800px) {
    .footer-bar button {
        font-size: 2rem;
    }
    .footer-bar {
        gap: 0.2rem;
        font-size: 17px;
    }
    .footer-icon {
        padding: 0.25rem 0.75rem;
    }
    .handi-logo {
        font-size: 2.5rem;
        align-self: center;

    }   
}

/* Mobile: larger touch area */
@media (max-width: 640px) {
    body {
        padding-bottom: 90px;
    }
    .footer-bar {
        gap: 0.2rem;
        font-size: 15px;
    }
    .footer-icon {
        font-size: 15rem;
        min-width: unset;
        min-height: unset;
        padding: 0.25rem 0.75rem;
    }
}



/* =========================================================
   FIX FOOTER OVERLAP – add bottom padding to main content
========================================================= */
body {
    padding-bottom: 200px;  /* same as footer height + some extra */
}

/* If you have a wrapper around the dashboard, adjust that instead */
.dashboard-wrapper {
    padding-bottom: 20px;
}

/* Ensure the footer stays above content but doesn't cover it */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 2px solid #cbd5e1;
    padding: 0.5rem 1rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

/* =========================================================
   FIX BUTTON ALIGNMENT INSIDE MODULE CONTROLS
========================================================= */
.module-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

/* Override global absolute positioning for all buttons inside .module-controls */
.module-controls button,
.module-controls .pin-btn,
.module-controls .radio-lock-toggle,
.module-controls .music-lock-toggle,
.module-controls .phone-lock-toggle,
.module-controls .emergency-lock-toggle {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    margin: 0 !important;
    width: 44px;
    height: 44px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

/* Ensure pin button keeps its pinned colour */
.module-controls .pin-btn.pinned {
    background: #0047cc;
    color: #fff;
    border-color: #0047cc;
}

/* Hover effect for all module control buttons */
.module-controls button:hover {
    background: #f0f2f5;
}

/* Remove any extra margins or transforms */
.module-controls button i {
    margin: 0;
    font-size: inherit;
}

/* Chat Module Styles */
.chat-content {
    min-height: 200px;
}

.chat-loading, .chat-empty, .chat-error {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.chat-rooms-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-room-card {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.2s;
}

.chat-room-card.has-new {
    border-color: #cc0000;
    background: #fff5f5;
}

.chat-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.chat-room-name {
    font-weight: 700;
    color: #1e1e1e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-badge {
    background: #cc0000;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.chat-toggle-msgs {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.chat-toggle-msgs:hover {
    background: #e2e8f0;
}

.chat-room-messages {
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.chat-message {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.chat-sender {
    font-weight: 700;
    color: #0047cc;
    font-size: 0.85rem;
}

.chat-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-left: 8px;
}

.chat-body {
    color: #1e1e1e;
    font-size: 0.85rem;
    margin-top: 4px;
    word-break: break-word;
}

.chat-more {
    font-size: 0.75rem;
    color: #64748b;
    padding: 8px 0;
    text-align: center;
}

.chat-refresh-btn {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.chat-refresh-btn:hover {
    background: #e2e8f0;
    border-color: #0047cc;
}

/* Calendar Module Styles */
.calendar-content {
    min-height: 200px;
}

.calendar-loading, .calendar-empty, .calendar-error {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.calendar-today-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0047cc;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #eaf2ff;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-notification-badge {
    font-size: 0.75rem;
    font-weight: normal;
    background: #0047cc;
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.calendar-event-card {
    display: flex;
    gap: 16px;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 16px;
    transition: box-shadow 0.2s;
}

.calendar-event-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.calendar-event-time {
    min-width: 100px;
    font-weight: 600;
    color: #0047cc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.calendar-event-details {
    flex: 1;
}

.calendar-event-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1e1e1e;
    margin-bottom: 4px;
}

.calendar-event-location {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.calendar-event-desc {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 6px;
}

.calendar-notification-info {
    margin-top: 16px;
    padding: 8px;
    background: #f0fdf4;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #166534;
}

.calendar-refresh-btn {
    width: 100%;
    padding: 10px;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 8px;
}

.calendar-refresh-btn:hover {
    background: #e2e8f0;
    border-color: #0047cc;
}

.calendar-retry-btn {
    margin-top: 12px;
    padding: 8px 20px;
    background: #0047cc;
    color: white;
    border: none;
    border-radius: 40px;
    cursor: pointer;
}

@media (max-width: 640px) {
    .calendar-event-card {
        flex-direction: column;
        gap: 8px;
    }
    .calendar-event-time {
        min-width: auto;
    }
}

/* Module Selection Popup Styles */
.module-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.module-selection-container {
    background: #ffffff;
    border-radius: 28px;
    max-width: 1200px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.3);
    border: 3px solid #0047cc;
}

.module-selection-header {
    background: #0047cc;
    color: white;
    font-size: 1.6rem;
    font-weight: bold;
    padding: 1rem 1.5rem;
    text-align: center;
    border-radius: 28px 28px 0 0;
}

.module-selection-body {
    padding: 1.5rem;
}

.selection-intro {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #556d8b;
}

.available-modules, .selected-modules {
    margin: 1rem 0;
}

.available-modules h3, .selected-modules h3 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: #0047cc;
}

.module-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    min-height: 150px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
}

.available-list .module-option {
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.selected-list .module-option {
    background: #eaf2ff;
    border: 2px solid #0047cc;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    transition: all 0.2s;
}

.selected-list .module-option:active {
    cursor: grabbing;
}

.module-option i {
    font-size: 1.2rem;
    color: #0047cc;
    margin-right: 8px;
}

.add-module-btn, .remove-module-btn {
    background: #0047cc;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-module-btn {
    background: #cc0000;
}

.drag-handle {
    cursor: grab;
    margin-right: 8px;
    color: #64748b;
}

.empty-selection {
    text-align: center;
    padding: 20px;
    color: #64748b;
    grid-column: 1 / -1;
}

.module-selection-footer {
    padding: 1rem 1.5rem 1.5rem;
    text-align: center;
}

.save-modules-btn {
    background: #0047cc;
    color: white;
    border: none;
    border-radius: 48px;
    padding: 12px 32px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 200px;
}

.save-modules-btn:hover:not(:disabled) {
    background: #0037a3;
}

.save-modules-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .module-selection-container {
        width: 95%;
        max-height: 90vh;
    }
    .module-list {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   FOOTER - Responsive Rows (6 buttons)
   Desktop: 1 row
   Mobile: 2 rows of 3 buttons each
========================================================= */

.footer-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

/* Desktop & Tablet: Single row, evenly spaced */
@media (min-width: 769px) {
    .footer-bar {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
    
    .footer-icon {
        flex: 0 0 auto;
    }
}

/* Mobile (≤768px): Two rows of 3 buttons each */
@media (max-width: 768px) {
    .footer-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        justify-items: center;
        align-items: center;
    }
    
    .footer-icon {
        width: 100%;
        max-width: 80px;
        min-width: 60px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .footer-bar {
        gap: 0.5rem;
    }
    
    .footer-icon {
        min-width: 50px;
        min-height: 50px;
        font-size: 1rem;
    }
}