:root {
    --app-max-width: 480px;
    /* Typography */
    --app-font: "Montserrat", sans-serif;
    --app-font-size: 14px;
    /* Colors */
    --color-bg-main: #F2F0F5;
    --passive: #A5A5B5;

    --color-primary: #8BC4C1;
    --color-primary-dark: #109898;
    --light-background: #00000033;

    --white: #FFFFFF;

    /* text color */
    --f-dark-charcoal: #2D2D34;
    --f-dark-jungle-green: #191F26;

    /* heights */
    --height: 3rem;

    /* padding */
    --app-inline-padding: 1.875rem;
}


html {
    box-sizing: border-box;
    font-size: var(--app-font-size);
}

html,
body {
    font-family: var(--app-font);
    font-size: var(--app-font-size);
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
    margin: 0;
    padding: 0;
    font-weight: normal;
}

ol,
ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

body {
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    height: 100dvh;
    position: relative;
}

.main-body {
    max-width: var(--app-max-width);
    width: 100%;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--color-bg-main);
    position: relative;
    display: grid;
    grid-template-rows: 50px 1fr 50px;
    overflow: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--passive);
    padding-inline: var(--app-inline-padding);
    position: relative;
}

img {
    width: 100%;
    max-width: 100%;
    height: 100%;
}

.clinic-logo,
.chloe-logo {
    height: 40px;
    max-width: 80px;
}

.chloe-logo {
    width: 40px;
    position: absolute;
    left: calc(50% - 20px);
}

.viewer-button {
    background-color: var(--color-primary);
    color: var(--white);
    border: none;
    padding: 8px 4px 8px 24px;
    cursor: pointer;
    border-radius: 90px;
    height: 34px;
    display: flex;
    font-family: inherit;
    font-size: 1rem
}

.viewer-button img {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-left: 0.5rem;
}

.footer {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-inline: 1rem;
    background-color: var(--color-primary);
    height: 73px;
    padding: 13px 23px;
    overflow-x: auto;
    gap: 1rem;
}

.footer .f-link {
    position: relative;
    color: var(--white);
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.footer .f-link:hover,
.footer .f-link.active {
    color: var(--color-primary-dark);
}

.footer .f-link.active::after {
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    content: '';
    height: 5px;
    background-color: var(--color-primary-dark);
    border-radius: 5px;
}

.content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden; 
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    overflow-wrap: break-word;
}
/* Hide scrollbar — Chrome, Safari */
.content::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar — Firefox */
.content {
    scrollbar-width: none;
}

/* Hide scrollbar — IE/Edge */
.content {
    -ms-overflow-style: none;
}
/* Page visibility */
.page {
    display: none;
    height: 100%;
}

.page.is-active {
    display: block;
}

/* Home page wrapper */
.content .home-page.is-active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.home-page-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Title + subtitle block */
.content .home-page-content>div:first-child {
    padding: 8px 16px;
}


/* Title */
.content h1 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Subtitle */
.content>p {
    font-size: 1rem;
    color: #555;
}

/* Video list container */
.content section {
    display: grid;
    grid-template-columns: 1fr;
}

/* Individual video block */
.content figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Video itself */
.content video {
    /* width: 100%; */
    /* max-width: 100%; */
    background-color: #000;
    display: grid;
    place-items: center;
    margin-inline: auto;
    width: 100%;
    /* max-width: 22.86rem; */
    aspect-ratio: 16/9;
}

/* Description */
.content figcaption {
    font-size: 1rem;
    line-height: 1.4;
    color: #666;
    padding: 8px 16px;
    font-weight: 600;
}


/* Viewer page styles  */

.content .viewer-page.is-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.content .patient-info {
    margin-top: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    padding-inline: var(--app-inline-padding);
    gap:1rem
}

.patient-info p {
    font-size: .875rem;
    color: var(--f-dark-charcoal);
    font-weight: 600;
}

.embryo-media {
    /* padding: 16px; */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Large video */
.media-main {
    padding-inline: var(--app-inline-padding);
    margin-bottom: 1rem;
}

.video-container {
    display: grid;
    place-items: center;
    margin-inline: auto;
    width: 100%;
    max-width: 20rem;
    aspect-ratio: 1;
    position: relative;
}

.embryo-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-container .title {
    position: absolute;
    background-color: var(--light-background);
    width: 100%;
    top: 0;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    z-index: 1;
    color: var(--white);
}

/* Thumbnails row */
.slider-container {
    padding-inline: var(--app-inline-padding);
    width: 100vw;
    max-width: var(--app-max-width);
}

.slider {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-inline: var(--app-inline-padding);
    overflow-y: hidden;
}

.slide-item {
    border: none;
    background: none;
    padding: 0;
    flex: 0 0 auto;
    cursor: pointer;
    text-align: center;
    padding: .5rem .3rem .3rem;
}

.slide-item .item-title {
    font-size: .625rem;
    white-space: nowrap;
    color: var(--f-dark-jungle-green);
}

.slide-item img {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    aspect-ratio: 1;
}

.slide-item .no-image {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: .625rem;
    margin-bottom: 4px;
}

.slide-item.active {
    background-color: var(--white);
}

.slide-item.active img {
    opacity: 1;
    transform: scale(1.05);
}

.slide-item:not(.active):hover img {
    opacity: 0.7;
}

/* Video control panel styles */

.video-controls-panel {
    padding-inline: var(--app-inline-padding);
    margin-top: 1rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
}

.hours-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--color-primary);
    margin-top: 0.5rem;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 0.5rem;
    margin-top: 16px;
}

.action-button {
    border-radius: 50%;
    color: var(--color-primary);
    border: none;
    cursor: pointer;
}

.action-button:hover {
    background-color: var(--white);
}

.action-button.play-pause-btn {
    width: 4rem;
    height: 4rem;
    background-color: var(--color-primary);
}

.action-button .play-pause-icon {
    font-size: 2rem;
    color: var(--white);
}

.action-button.forward-backward-btn {
    width: var(--height);
    height: var(--height);
}

.action-button.forward-backward-btn i {
    font-size: 1.5rem;
}

.seekbar-wrapper {
    width: 100%;
    max-width: var(--app-max-width);
    margin: 12px auto 0;
}

.seekbar {
    width: 100%;
    appearance: none;
    height: 4px;
    background: #dcdcdc;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

/* Track */
.seekbar::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.seekbar::-moz-range-track {
    height: 4px;
    background: transparent;
}

/* WebKit (Chrome, Safari) */
.seekbar::-webkit-slider-thumb {
    appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    margin-top: -2px;
}

/* Firefox */
.seekbar::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
}

/* Filled progress effect */
.seekbar {
    background: linear-gradient(to right,
            var(--color-primary) 0%,
            var(--color-primary) var(--progress, 0%),
            #dcdcdc var(--progress, 0%),
            #dcdcdc 100%);
}

.video-description {
    padding: var(--app-inline-padding);
    color: var(--f-dark-charcoal);
    margin-top: 1rem;
    /* linear opacity fade */
    -webkit-mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
}

/* image viewer style */
.home-page-image-viewer {
    padding-inline: var(--app-inline-padding);
}

.day-image-container {
    position: relative;
    margin-inline: auto;
    max-width: 20rem;
    aspect-ratio: 1;
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: 0px 0px 6px var(--passive);
}

.day-image {
    width: 100%;
    height: auto;
    max-width: 15rem;
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.day-title {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
}

/* day slider */

.day-slider {
    margin-top: 8px;
}

.day-slider .slide-image {
    background-color: var(--white);
    padding: 0.25rem;
    box-shadow: 0px 0px 6px var(--passive);
}

.day-slider .simple-slider {
    padding-inline: var(--app-inline-padding);
    width: 100vw;
    max-width: var(--app-max-width);
}

.day-slider .slider-container {
    width: 100%;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.day-slider .slide-item {
    padding: 0.57rem 0.35rem;
    border-radius: 0.29rem;
    text-align: left;
    cursor: pointer;
}

.day-slider .slide-item.active {
    background-color: var(--white);
}

.day-slider .slide-item .slide-image {
    width: 3.57rem;
    aspect-ratio: 1;
    border-radius: 0.93rem;
}

.day-slider .slide-item .slide-title {
    font-size: 10px;
    white-space: nowrap;
    color: var(--f-dark-jungle-green);
}

/* day control panel */
.stages-page .day-control-panel {
    padding-inline: var(--app-inline-padding);
    padding-block: 1rem;
}

.day-control-panel .selected-day {
    font-size: 16px;
    font-weight: 600;
    color: var(--f-dark-charcoal);
}

.day-control-panel .controls {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 0.5rem;
    height: 2.625rem;
}

.day-control-panel .controls .line {
    width: 1px;
    background-color: var(--color-primary);
    height: var(--height);
}

.day-control-panel .controls .action-button {
    border-radius: 50%;
    color: var(--color-primary);
    border: none;
    cursor: pointer;
    width: var(--height);
    height: var(--height);
}

.day-control-panel .controls .action-button:hover {
    background-color: var(--white);
}

.day-control-panel .controls .action-button i {
    font-size: 1.7rem;
}

.stages-page .day-description {
    padding: var(--app-inline-padding);
    margin-top: 1rem;
    color: var(--f-dark-charcoal);
    /* linear opacity fade top → bottom */
    -webkit-mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
}


/* funnel page styles */

.funnel-page .funnel {
    padding-inline: var(--app-inline-padding);

    /* linear opacity fade top → bottom */
    -webkit-mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom,
            rgba(0, 0, 0, 1),
            rgba(0, 0, 0, 0));
}

.funnel-page .funnel .funnel-card {
    grid-column: span 3;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    column-gap: 1rem;
    align-items: center;
    border-bottom: 1px solid var(--color-primary);
    padding-block: 1rem;
}

.funnel-card img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.day-control-panel .controls .action-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.slide-item.disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* fallback page styles */

.fallback-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 4rem;
    gap: 2rem;
}

.fallback-chloe-logo {
    width: 10rem;
    height: 10rem;
}

.fallback-text {
    text-align: center;
}

/* loader */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 9999;

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

.app-loader img {
    height: 50px;
    width: 50px;
}

.app-loader.hidden {
    display: none;
}