/* Global styles - used across multiple screens */
:root {
    --header-height: 23px;
    --header-width: 240px;
    --header-padding-horizontal: 1px;
    --icon-height: 20px;
    --or-name-font-size: 13px;
    --footer-height: 33px;
    --footer-icon-size: 24px;
    --headline-height: 26px;
    --list-item-height: 31px;
    --list-item-presets-height: 21px;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: "Noto Sans", sans-serif;
}

.screen-content {
    width: 240px;
    height: 320px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: #fff;
    padding: 0px 0;
    text-align: center;
    overflow: hidden;
    font-family: "Noto Sans", sans-serif;
    position: relative;
    /* For absolute positioning if needed */
}

/* Scrollbar hidden */
* {
    box-sizing: border-box;
}

/* New Layout Structure */
/* The iframe is 250x340 but shifted -8px, -8px. 
   Visible area starts at 8px, 8px and is 240x320. */
.app-layout {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0px;
    left: 0px;
    width: 240px;
    height: 320px;
    overflow: hidden;
    background-color: #000;
    /* Ensure background covers */
}

.header {
    height: var(--header-height);
    width: var(--header-width);
    display: flex;
    background-color: #000000;
    border-bottom: 0px solid #333;
    flex-shrink: 0;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 var(--header-padding-horizontal);
}

.header-left {
    display: flex;
    align-items: center;
    height: 100%;
    padding-left: var(--header-padding-horizontal);
}

.header-center {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0 auto;
}

.header-right {
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: var(--header-padding-horizontal);
}

.header-icon {
    height: var(--icon-height);
    width: auto;
    display: block;
}

.header-battery-icon {
    height: var(--icon-height);
    width: auto;
    display: block;
}

.or-name {
    font-family: "Noto Sans", sans-serif;
    font-size: var(--or-name-font-size);
    color: #fff;
    font-weight: 500;
    margin-left: 3px;
    line-height: var(--icon-height);
    white-space: nowrap;
}

/* Remove auto-space divs since we're using margin: auto on center */
.auto-space {
    display: none;
}

.clock {
    font-size: 16px;
    font-weight: 500;
    color: #4cc9f0;
}

.body-content {
    flex-grow: 1;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    /* Added bottom padding for footer space */
}

.footer {
    height: var(--footer-height);
    width: 100%;
    display: flex;
    background-color: #111;
    border-top: 1px solid #333;
    flex-shrink: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
}

.tab {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.tab-icon {
    height: var(--footer-icon-size);
    width: var(--footer-icon-size);
    object-fit: contain;
    display: block;
    filter: brightness(0.7);
    transition: filter 0.2s;
}

.tab.active .tab-icon {
    filter: brightness(1);
}

.tab.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-top: 2px solid #d1d1d1;
}

.tab:hover {
    background-color: #222;
}

.tab.focused {
    background-color: #333;
    border-top: 2px solid #4cc9f0;
    border-radius: 0px;
    margin: 0px;
}


/* Existing Styles (Adapted where needed) */
.screen-title {
    font-size: 20px;
    margin-bottom: 15px;
    color: #4cc9f0;
}

.screen-status {
    font-size: 16px;
    margin-bottom: 15px;
    color: #f72585;
}

.screen-info {
    font-size: 12px;
    color: #b8b8b8;
    max-width: 200px;
    margin-top: 10px;
}

/* List container */
.list-container {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin: 0px 0;
}

/* List items */
.list-item {
    width: calc(240px - 0px);
    height: var(--list-item-height);
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: #fff;
    transition: all 0.2s ease;
    border-right: 3px solid #000000;
}
.list-item.presets {
    height: var(--list-item-presets-height);
}

.list-item.focused {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #4cc9f0;
    border-radius: 5px;
    margin: 0px;
}

/* Hide caret/pen by default, show only when focused */
.list-item .arrow {
    display: none;
}

.list-item.focused .arrow {
    display: block;
}

.list-item.focused .arrow .material-icons {
    color: #4cc9f0 !important;
    margin: -2px 0 0 0; /* Adjusted up by 6px */
}

/* Circular progress indicator for long press feedback */
.progress-circle {
    width: 16px;
    height: 16px;
    position: relative;
    display: none;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke: #4cc9f0;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 44; /* circumference = 2 * pi * r, r = 7, circumference ≈ 44 */
    stroke-dashoffset: 44;
    transition: stroke-dashoffset 0.05s linear;
}

/* Hide material icon when progress circle is active */
.arrow.progress-active .material-icons {
    display: none;
}

.arrow.progress-active .progress-circle {
    display: block;
}

.item-text {
    font-size: 14px;
    text-align: left;
}

.checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.check-icon {
    font-size: 18px;
    color: #fff;
}

/* Navigation buttons (old style, maybe kept for sub-pages or wizards) */
.navigation-buttons {
    width: 240px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 0 10px;
}

.nav-btn {
    padding: 6px 12px;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    font-family: "Noto Sans", sans-serif;
    font-size: 12px;
    transition: all 0.2s ease;
    pointer-events: none;
    /* Disable mouse clicks by default */
}

.nav-btn.focused {
    background-color: #4cc9f0;
    color: #000;
    border: 1px solid #4cc9f0;
    border-radius: 5px;
    margin: 2px;
}

.nav-btn:disabled {
    opacity: 0.4;
}

.nav-btn.previous {
    margin-right: auto;
}

.nav-btn.next {
    margin-left: auto;
}

/* Footer buttons for preset overview */
.footer-button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border: none;
    padding: 0;
    color: #fff;
    font-family: "Noto Sans", sans-serif;
    font-size: 15px;
    font-weight: 500;
    /* Medium weight */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 90%;
    outline: none;
}

.footer-button.back-button {
    color: #888;
}

.footer-button.proceed-button {
    color: #4cc9f0;
}

.footer-button.revert-button {
    color: #f07c0a;
}

.footer-button.continue-button {
    color: #4cc9f0;
}

.footer-button.previous-button {
    color: #888;
}

.footer-button.next-button {
    color: #4cc9f0;
}

.footer-button.focused {
    background-color: #333;
    border: 1px solid #4cc9f0;
    border-radius: 5px;
    margin: 2px;
}

.footer-button:hover {
    background-color: #222;
}

.footer-button:focus {
    outline: none;
}

/* Headline styling */
.headline {
    width: 240px;
    height: var(--headline-height);
    font-family: "Noto Sans", sans-serif;
    font-size: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0;
}

/* Blinking animation for trend timer alert */
.headline.blinking {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Custom scrollbar styling */
.body-content::-webkit-scrollbar {
    width: 6px;
}

.body-content::-webkit-scrollbar-track {
    background: transparent;
}

.body-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.body-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Firefox scrollbar styling */
.body-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Position Grid Styles */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 74px);
    grid-template-rows: repeat(3, 76px);
    gap: 3px;
    margin: 8px auto;
    width: 240px;
    justify-content: center;
}

.position-tile {
    width: 74px;
    height: 76px;
    background-color: #111;
    border: 1px solid #333;
    border-radius: 4px;
    position: relative;
    padding: 4px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.position-tile.focused,
.position-tile.moving {
    background-color: #222;
    border: 1px solid #4cc9f0;
    box-shadow: 0 0 5px rgba(76, 201, 240, 0.5);
}

.position-icon {
    position: absolute;
    left: 6px;
    top: 20px;
    width: auto;
    height: auto;
    max-width: 70px;
    max-height: 60px;
    object-fit: contain;
    z-index: 1;
}

.position-name {
    font-family: "Noto Sans Display", sans-serif;
    font-weight: 700;
    font-size: 10px;
    color: #fff;
    text-align: center;
    margin: 0 0 2px 0;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    position: absolute;
    width: 100%;
    left: 0;
    top: 4px;
}

.position-value {
    font-family: "Noto Sans", sans-serif;
    font-weight: 600;
    font-size: 14px;
    font-variation-settings:
        "wdth" 20.5;
    color: #ffffff;
    text-align: center;
    margin: 0;
    line-height: 1.2;
    z-index: 2;
    position: absolute;
    width: 100%;
    left: 0;
    top: 15px;
    opacity: 1;
    transition: opacity 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

.position-value .current-val {
    color: #888;
}

.position-value.moving .current-val,
.position-value.moving .target-val,
.position-value.moving .divider,
.position-value.moving {
    color: #4cc9f0;
}

.position-value .arrow {
    font-size: 14px;
    color: #555;
    margin-top: 1px;
}

.position-value .target-val {
    color: #fff;
}

.position-value.reached .check-icon {
    font-size: 14px;
    color: #4cc9f0;
    margin-right: 2px;
}

.position-value.reached .target-val {
    color: #fff;
}

.position-value.zero {
    opacity: 0.3;
}

/* Noto Sans Display font import */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Display:wght@400;700&display=swap');
/* Noto Sans variable font with extra condensed width (62.5) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wdth,wght@0,62.5,100..900;1,62.5,100..900&display=swap');

/* Paginator */
.paginator {
    width: 240px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 5px;
}

.page-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #444;
    transition: background-color 0.2s;
}

.page-dot.active {
    background-color: #4cc9f0;
}

/* Pagination Navigation */
.pagination-nav {
    width: 240px;
    height: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #000000;
    border-top: 0px solid #333;
    border-bottom: 0px solid #333;
    position: absolute;
    bottom: 33px;
    /* Footer height */
    left: 0;
    z-index: 5;
    padding: 0 10px;
    box-sizing: border-box;
}

.page-nav-btn {
    width: 40px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000000;
    border: 0px solid #444;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.page-nav-btn .material-icons {
    font-size: 18px;
    color: #fff;
}

.page-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-nav-btn.focused {
    background-color: #4cc9f0;
    border-color: #4cc9f0;
}

.page-nav-btn.focused .material-icons {
    color: #000;
}

.page-display {
    font-family: "Noto Sans", sans-serif;
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 2px;
}

.current-page {
    color: #4cc9f0;
}

.total-pages {
    color: #888;
}

/* Hide footer navigation in screen pages for alternative version with hardware buttons */
.footer-container, [data-component="footer-nav"] {
    display: none !important;
}