/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&display=swap');

/* ------------------- */
/* Root Variables      */
/* ------------------- */
:root {
    --primary-color: #FDB813;
    --text-color-dark: #212121;
    --text-color-light: #FFFFFF;
    --background-color: #FFFFFF;
    --border-color: #DDDDDD;
    --overlay-color: rgba(0, 0, 0, 0.5);
    --font-primary: 'Gochi Hand', cursive;
    
    /* Layout Dimension Variables */
    --header-height: 60px;
    --footer-height: 0px;
}

/* ------------------- */
/* Global Styles       */
/* ------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; /* Prevent scrolling on the body itself */
    font-family: var(--font-primary);
    background-color: #f0f0f0; /* Background for the desktop view outside the app container */
}

/* ------------------- */
/* Layout Containers   */
/* ------------------- */
#app-container {
    max-width: 500px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
    position: relative; /* CRITICAL for positioning children */
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
    overflow: hidden; /* Clip the flyout menu */
}

#main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: transform 0.3s ease-in-out;
}

#main-header.header-hidden {
    transform: translateY(-100%);
}

#site-title {
    font-size: 1.5rem;
    cursor: pointer;
    flex-grow: 1;
    text-align: center;
}

#main-content {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

#daily-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem;
    /* justify-content is now handled by a class in JS */
}

.centered-content {
    justify-content: center;
}

#main-footer {
    height: var(--footer-height);
    background-color: #f7f7f7;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
}

/* ------------------- */
/* Flyout Menu & Overlay */
/* ------------------- */
#overlay {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-color);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.menu-open #overlay {
    opacity: 1;
    visibility: visible;
}

#flyout-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: var(--background-color);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

body.menu-open #flyout-menu {
    transform: translateX(0);
}

.menu-header {
    padding: 0 1rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    justify-content: flex-end; 
}

.menu-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    font-family: var(--font-primary);
    color: var(--text-color-dark);
}

#flyout-menu ul {
    list-style: none;
    flex-shrink: 0; 
}

#flyout-menu ul li a {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-color-dark);
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

#flyout-menu ul li a:hover {
    background-color: #f0f0f0;
}

.scan-to-share {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    padding: 1rem;
    text-align: center;
}

.scan-to-share p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.scan-to-share img {
    max-width: 150px;
    display: block;
    margin: 0 auto;
}

/* -------------------------- */
/* Header Buttons             */
/* -------------------------- */
#hamburger-btn {
    width: 70px;
    display: flex;
    justify-content: center;
}

#header-share-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 40px;
}

.share-icon,
.share-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease-in-out;
}

.share-icon {
    height: 24px;
    width: 24px;
    opacity: 1;
}

.share-text {
    font-size: 1.2rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

#header-share-btn.text-visible .share-icon {
    opacity: 0;
    pointer-events: none;
}

#header-share-btn.text-visible .share-text {
    opacity: 1;
}

/* -------------------------- */
/* Dynamic Content & Pages    */
/* -------------------------- */
.content-page {
    padding: 1.5rem;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    height: 100%;
}

.content-page h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color-dark);
}

.content-page p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.content-page ol {
    padding-left: 2rem;
}

.content-page .back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.instruction-section {
    margin-bottom: 1.5rem;
}

.instruction-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.about-image {
    display: block;
    margin: 20px auto;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.about-greeting {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ------------------- */
/* Media Element Styles*/
/* ------------------- */
#daily-content-wrapper .image-container {
    position: relative;
    line-height: 0;
}

#daily-content-wrapper .daily-image {
    max-width: 100%;
    max-height: 70dvh;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: zoom-in;
    transition: all 0.3s ease-in-out;
}

#daily-content-wrapper .daily-audio {
    width: 100%;
    max-width: 400px;
}

#daily-content-wrapper .media-caption {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: #555;
    line-height: normal;
}

.main-image-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    gap: 8px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.main-image-controls.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.main-image-controls button {
    height: 36px;
    border-radius: 18px;
    background-color: rgba(30, 30, 30, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-zoom-btn {
    width: 36px;
    font-size: 1.8rem;
    padding: 0;
}

.main-download-btn,
.main-share-btn { /* NEW grouped style */
    font-size: 1rem;
    padding: 0 12px;
}

.daily-video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 9 / 16;
    cursor: pointer;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
}

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

.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(0, 0, 0, 0.4);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding-left: 5px;
}

.daily-video-container.playing .play-button-overlay {
    opacity: 0;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.loading-indicator img {
    width: 100px;
    height: 100px;
    animation: pulse 1.5s infinite ease-in-out;
}
.loading-indicator p {
    margin-top: 1rem;
    font-size: 1.5rem;
    color: var(--text-color-dark);
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --------------------------------- */
/* Fullscreen Media Container Styles */
/* --------------------------------- */
#video-fullscreen-container,
#image-fullscreen-container { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#image-fullscreen-container { 
    cursor: zoom-out;
}

#video-fullscreen-container.visible,
#image-fullscreen-container.visible { 
    opacity: 1;
    visibility: visible;
}

#fullscreen-video, 
#fullscreen-image { 
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    box-shadow: 0 0 25px rgba(0,0,0,0.5);
}

.fullscreen-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 210;
    display: flex;
    gap: 10px;
}

.fullscreen-controls button {
    height: 40px;
    border-radius: 20px;
    background-color: rgba(30, 30, 30, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.fullscreen-controls button:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.fullscreen-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(30, 30, 30, 0.5);
}

/* NEW: grouped style for fullscreen text buttons */
#image-download-btn,
#image-share-btn {
    font-size: 1.1rem;
    padding: 0 15px;
}

#image-close-btn,
#video-close-btn { 
    font-size: 1.5rem;
    width: 40px;
    padding: 0;
}

/* ------------------- */
/* Utility Classes     */
/* ------------------- */
.hidden {
    display: none !important;
}

.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}