/* Basic reset for full-screen experience */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevents scrollbars */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    position: relative; /* Crucial for positioning the pseudo-element */
    overflow: hidden; /* Prevents scrollbars on the whole page */
	user-select: none; /* Prevents the logo from being selected */
}

/* New pseudo-element for the transparent background */
body::before {
    content: '';
    position: fixed; /* Covers the entire viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('NASA_Foot.jpg'); /* Your image file */
    background-size: cover; /* Ensures the image covers the whole area */
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.9; /* This sets the transparency */
    z-index: -1; /* Puts the background behind your actual content */
	user-select: none; /* Prevents the logo from being selected */
}

/* The main container that holds the background image */
#viewer-container {
    flex: 5; /* Takes up 5/6 of the vertical space */
    background-color: rgba(0, 0, 0, 0.95);
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative; /* This is crucial for the overlays inside */
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: background-image 0.5s ease-in-out;
	user-select: none; /* Prevents the logo from being selected */
}

/* The semi-transparent text overlay */
#text-overlay {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 0.1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 5vh;
    max-width: 90%;
    box-sizing: border-box;
	user-select: none;
}

/* The text for the achievement */
#achievement-text {
    color: white;
    font-size: 1.6rem;
    text-align: center;
    line-height: 1.4;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

@media (max-width: 600px) {
    #achievement-text {
        font-size: 1.2rem;
    }
}

/* Style for the Batch ID overlay */
#batch-id-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.5);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    word-break: break-all;
    text-align: right;
    /* We add a max-width and let flexbox handle the rest */
    max-width: 50%;
}

/* This new container will be positioned by JS to perfectly cover the image */
#image-overlays-container {
    position: absolute;
    padding: 10px; /* This replaces the JS padding calculation */
    box-sizing: border-box; /* Ensures padding is included in the size */
    
    /* Flexbox magic to position the items inside */
    display: flex;
    justify-content: space-between; /* Pushes logo left, ID right */
    align-items: flex-start; /* Aligns them to the top */
    
    /* Start hidden, made visible by JS */
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Simplified logo style */
#logo-overlay {
    width: 150px;
    height: auto;
    opacity: 0.5;
    flex-shrink: 0; /* Prevents the logo from shrinking */
}

/*
 ===============================================
 NEW FLEXBOX CONTROL PANEL
 ===============================================
*/
#control-panel {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 1.5rem; /* Ensures 1.5rem space on left/right */
    gap: 1.5rem;
}


/* --- Pioneer Medal Button Style --- */
.medal-button-reverted {
    /* Using flexbox for alignment inside the button */
    display: flex;
    align-items: center;
    /* Sizing and layout */
    flex: 0 1 240px; /* Flex properties for responsive behavior */
    max-width: 300px;
    min-height: 50px;
    padding: 0.25rem; /* p-1 */
    border-radius: 9999px; /* rounded-full */
    cursor: pointer;

    /* Design styles */
    background: #000; /* Changed background to black */
    box-shadow:
        0px 8px 25px rgba(0, 0, 0, 0.6),      /* Deeper main shadow for more lift */
        inset 0px 4px 10px rgba(255, 255, 255, 0.1), /* Subtle inner highlight */
        inset 0px -4px 10px rgba(0, 0, 0, 0.5);   /* Inner shadow for depth */
    border: 1px solid rgba(79, 91, 102, 0.5); /* Border with 50% transparency */
    transition: all 0.2s ease-in-out;
    position: relative;
}

.medal-button-reverted:hover {
    transform: translateY(-2px);
    box-shadow:
        0px 12px 30px rgba(0, 0, 0, 0.8),
        inset 0px 5px 12px rgba(255, 255, 255, 0.15),
        inset 0px -5px 12px rgba(0, 0, 0, 0.6);
    filter: brightness(1.1);
}

.medal-button-reverted:active {
    transform: translateY(1px);
    box-shadow:
        0px 4px 10px rgba(0, 0, 0, 0.4),
        inset 0px 2px 5px rgba(255, 255, 255, 0.1),
        inset 0px -2px 5px rgba(0, 0, 0, 0.3);
    filter: brightness(0.9);
}

.medal-fill {
    fill: url(#goldGradient3D);
}

.ribbon-fill {
    fill: url(#ribbonGradient);
}

/* Styling for the text inside the button */
.button-text {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400; /* font-normal */
    font-size: 1rem; /* text-base */
    padding-left: 0.5rem; /* px-2 */
    padding-right: 0.5rem; /* px-2 */
    text-align: center;
    flex-grow: 1; /* Allows text to fill available space */
}



/* Custom Fonts */
.font-playfair { font-family: 'Playfair Display', serif; }
.font-merriweather { font-family: 'Merriweather', serif; }

/* Base styles for the pop-up overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: visible;
    opacity: 1;
}

/* Class to hide the popup */
.popup-overlay.popup-hidden {
    visibility: hidden;
    opacity: 0;
}


/* The main container for the pop-up content and its frame */
.popup-container {
    position: relative;
    width: 91.666667%;
    max-width: 42rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* The outermost frame layer (dark wood effect) */
.diploma-frame-outer {
    background: #4a2c1a;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(0, 0, 0, 0.6);
    flex-shrink: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* The second frame layer (gold trim) */
.diploma-frame-inner {
    background: #f0e6d2;
    border: 5px solid #c9a438;
    padding: 10px;
    position: relative;
    box-shadow: inset 0 0 10px rgba(106, 74, 45, 0.5);
    flex-shrink: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Adding corner flourishes */
.diploma-frame-inner::before,
.diploma-frame-inner::after,
.diploma-content::before,
.diploma-content::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    background: #c9a438;
    z-index: 1;
}
.diploma-frame-inner::before { top: -10px; left: -10px; }
.diploma-frame-inner::after { top: -10px; right: -10px; }
.diploma-content::before { bottom: -10px; left: -10px; }
.diploma-content::after { bottom: -10px; right: -10px; }

/* The main content area */
.diploma-content {
    border: 2px dashed #b18e54;
    padding: 40px 50px;
    padding-bottom: 80px;
    text-align: center;
    position: relative;
    color: #4a2c1a;
    /* MODIFIED: This prevents all scrolling and hides scrollbars */
    overflow: hidden;
}

/* Styling for the close button */
.close-btn {
    position: absolute;
    top: 2px;
    right: 12px;
    font-size: 2.25rem;
    color: #b18e54;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}
.close-btn:hover {
    color: #4a2c1a;
}

/* Star Seal Styles */
.star-seal {
    position: absolute;
    bottom: 20px;
    right: 30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #e53e3e, #b92121, #9b2c2c);
    clip-path: polygon(50% 0%, 55% 25%, 71% 10%, 65% 35%, 88% 29%, 75% 45%, 100% 50%, 75% 55%, 88% 71%, 65% 65%, 71% 90%, 55% 75%, 50% 100%, 45% 75%, 29% 90%, 35% 65%, 12% 71%, 25% 55%, 0% 50%, 25% 45%, 12% 29%, 35% 35%, 29% 10%, 45% 25%);
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.4));
}

/* RESPONSIVE POPUP STYLES */
@media (max-width: 768px) {
    .diploma-frame-outer {
        padding: 10px;
    }
    .diploma-content {
        padding: 25px;
        padding-bottom: 70px;
    }
    #merch-popup .font-playfair {
        font-size: 2rem !important;
        line-height: 1.1 !important;
    }
    #merch-popup .font-merriweather {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    .star-seal {
        width: 60px;
        height: 60px;
        bottom: 10px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    #merch-popup .font-playfair {
       font-size: 1.5rem !important;
    }
    #merch-popup .font-merriweather {
       font-size: 0.8rem !important;
    }
    .diploma-content {
       padding: 20px 15px;
       padding-bottom: 60px;
    }
    .control-btn {
        font-size: 0.8rem;
        padding: 10px;
    }
}
