/*
========================================
TABLE OF CONTENTS
========================================
1. GLOBAL STYLES
   - body, header, h1, p, footer
2. LAYOUT STYLES
   - .main-display, .sidebar-nav, .content-area, .overlay, .top-bar
3. HOMEPAGE STYLES
   - .homepage-card, .top-card
4. COMPONENT STYLES
   - .stat-card, .stats-layout
   - .planetProgress, .planetHealth
   - .stats-summary-grid
5. UTILITY CLASSES
   - Faction Colors (.terminid-color, etc.)
========================================
*/




/*  
    ========================
    1. GLOBAL STYLES
    ======================== 
*/

body {
    background-image: url("/static/images/bg-stars.jpg");
    background-color: rgb(34, 34, 34);
    background-repeat: no-repeat;
    background-attachment: fixed; 
    background-size: cover;
    font-family: monospace;
    margin: 0;
    padding-top: 60px;
}
header {
    color: #ffe710;
    text-align: center;
    padding: 20px;
    background-color: rgba(0,0,0,0.7);
    font-family: monospace;
    text-transform: uppercase;
}
h1 {
    color: #ffe710;
    text-align: center;
    margin: 0;
}
p {
    color: #ffe710;
    line-height: 1.8;
    text-align: center;
}
footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: #aaa;
    background-color: rgba(0,0,0,0.5);
}


/*  
    ========================
    2. LAYOUT STYLES
    ======================== 
*/
.main-display {
    display: flex;
    padding: 20px;
    margin: 0 auto;
    max-width: 1800px;
    background-color: rgba(0,0,0,0.3);
    justify-content: space-around;
    border: none;
    overflow: hidden;
}
.content-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}
.content-area h2 {
    color: #ffe710;
    font-size: 2em;
    margin-top: 6px;
    text-align: center;
}
.sidebar-nav {
    height: 100%;
    width: 240px;
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    padding: 20px;
    padding-top: 60px;
    font-family: monospace;
    border-right: #ffe710 2px solid;
    background-color: rgba(33,34,34,0.4);
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    transition: 0.3s;
    transform: translateX(-100%);
    text-align: center;
    overflow-x: hidden;
}
.sidebar-nav.active{
    transform: translateX(0);
}
.sidebar-nav h2 {
    color: #ffe710;
    margin-top: 0;
}
.sidebar-nav ul {
    list-style: none; /* Takes bullet points out */
    padding: 0;
}
.sidebar-nav li {
    color: #ffe710;
    margin-bottom: 10px;
}
.sidebar-nav a {
    color: #ffe710;
    text-transform: uppercase;
    text-decoration: none; /* No line for hyperlinks */
    font-size: 1.5em;
    display: block; /* Makes box clickable */
    padding: 10px 10px 10px 24px;
    border-radius: 4px;
    transition: background-color 0.4s ease, color 0.4s ease; /* Hover transition */
}
.sidebar-nav a:hover { /* Hover effect over text */
    background-color: #ffe710;
    color: #000;
}
.sidebar-nav a:focus {
    transition: 0.2s;
    background-color: #fef070;
    color: #000;
}

.overlay {
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: rgba(33,34,34,0.4);
    z-index: 5;
    cursor: pointer;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #ffe710;
    color: black;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    z-index: 11;
  }

/*  
    ========================
    3. HOMEPAGE STYLES
    ======================== 
*/
.menu-btn {
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: black;
    font-weight: bold;
    margin-right: 15px;
}
.open-btn {
    font-size: 32px;
    cursor: pointer;
    border: none;
    background-color: rgba(33,34,34,0.7);
}
.close-btn {
    position: absolute;
    top: 0;
    right: 10px;
    font-size: 36px;
    margin-left: 50px;
    background: none;
    border: none;
    color: #ffe710;
    cursor: pointer;
}
.app-title {
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}
#current-page-title {
    color: #333;
    font-size: x-large;
    font-weight: 700;
}
@media (max-width: 480px) {
    .app-text {
        display: none;
    }
    .separator {
        display: none;
    }
    .top-row-container{
        flex-direction: column;
    }
}

.top-row-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr)); /* Creates responsive columns*/
    gap: 20px;
    margin-bottom: 10px;
}
.top-row-container.homepage-card {
    flex: 1;
    margin-bottom: 0; /* Handled within parent container*/
}

.homepage-card {
    background-color: rgba(33,34,34,0.7);
    color: whitesmoke;
    border: #ffe710 1px solid;
    padding: 20px;
    padding-top: 0;
    margin-bottom: 20px;
    border-radius: 4px;
}
.homepage-card h3 {
    color:#ffe710;
    font-size: 2em;
    text-transform: uppercase;
    text-align: center;
}

.homepage-card .active-planets-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    width: 100%;
    padding-bottom: 8px;
}

.mo-card {
    max-width: 800px;
    background-color: rgba(33,34,34,0.7);
    border: #ffe710 1px solid;
    padding: 20px;
    text-align: center;
}
.mo-card h3 {
    color: #ffe710;
    font-weight: bold;
    margin-top: 0;
}
.mo-card h2 {
    color:#ffe710;
    font-weight: bold;
    margin-top: 0;
}
.mo-card p {
    color: whitesmoke;
    font-size: 1.5em;
    text-align: center;
    margin-top: 0;
}

/*  
    ========================
    4. COMPONENT STYLES
    ======================== 
*/
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    text-align: center;
    background-color: rgba(33,34,34,0.7);
    border:#ffe710 1px solid;
    border-radius: 4px;
    padding: 10px;
}
.stats-summary-grid p {
    font-size: 1.3em;
    font-weight: bold;
    margin: 10px; 
}
.war-effort {
    width: auto; /* Let the grid handle the width */
}

.stats-layout {
    display: flex;
    flex-wrap: wrap;
    grid-template-columns: repeat(2, minmax(320px, 1fr)); /* Creates responsive columns*/
    gap: 24px;
}
.stats-layout h3 {
    font-size: 2em;
}
.stats-layout p {
    font-size: 1.3em;
}

@keyframes pulse-danger {
    0% {
        box-shadow: 0 0 5px #fe6a67, 0 0 10px #fe6a67;
    }
    50% {
        box-shadow: 0 0 16px #fe6a67, 0 0 30px #fe6a67;
    }
    100% {
        box-shadow: 0 0 5px #fe6a67, 0 0 10px #fe6a67;
    }
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background-color: rgba(0,0,0,0.5);
    border-radius: 4px;
    z-index: 0;
}
.stat-card > * {
    position: relative;
    z-index: 1;
}
.stat-card {
    background-color: rgba(33,34,34,0.4);
    border: #ffe710 1px solid;
    padding: 15px;
    text-align: center;
    border-radius: 4px;
    display: flex;
    flex-direction: column;

    min-width: 320px;
    flex: 1 1 320px;
    max-width: 400px;
    min-height: 200px;

    /* Image styling */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}
.stat-card .health-bar:first-of-type {
    margin-top: auto;
}
.stat-card .defense-timer {
    margin-top: 8px;
}
.stat-card .war-effort {
    text-align: center;
    width: auto;
    font-variant: small-caps;
}
.stat-card.is-defending {
    /*border-color: #fe6a67 !important;*/
    animation-name: pulse-danger;
    animation-duration: 1.3s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}
.stat-card h3 {
    color: #ffe710;
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 5px;
    word-wrap: break-word;
    text-shadow: 2px 2px 2px #000;
}
.stat-card p {
    color: whitesmoke;
    font-size: 1em;
    font-weight: bold;
    margin: 0;
    margin-bottom: 10px;
    text-shadow: 2px 2px 2px #000;
}

.progress-bar-container {
    display: flex;
    position: relative;
    width: 100%;
    height: 1.25em;
    background-color: rgba(34,34,34,0.6);
    border: 1px solid #777;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 0;
}
.progress-bar-container .progress-bar-text,
.progress-bar-container .task-progress-bar-text {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    line-height: 1;
    text-shadow: 1px 1px 2px black;
    z-index: 10;
}
.progress-bar {
    color: #fff !important;
    /* font-weight: bold; */
    font-size: 0.7em;
    text-align: center;
    line-height: 1.25em;
    white-space: nowrap;
    height: 100%;
    transition: width 0.5s ease-in-out;
}

.progress-bar-container:has(+ .progress-bar-container) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
}

.progress-bar-container + .progress-bar-container {
    margin-top: 0; 
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none; 
}

.defender-bar {
    background-color: #41639C;
    text-shadow: 1px 1px 2px #000;
}
.attacker-bar {
    text-shadow: 1px 1px 2px #000;
}
.liberation-bar {
    background-color: #ffe710;
    text-shadow: 1px 1px 2px #000;
}

.mo-tasks {
    text-align: left;
    margin: 20px auto;
    max-width: 80%;
}

.mo-arrow {
    position: absolute;
    top: -1.1em;
    left: 50%; /* Default center */
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.4rem;
    color: #ffe710;
    text-shadow: 1px 1px 2px #000;
    transition: left 0.4s ease-out;
    z-index: 10;
    line-height: 1;
}

.mo-arrow-text {
    font-weight: bold;
    color: #ffe710;
}

/* Tug-of-war MO progress bar */
.bidirectional-progress-container {
    position: relative;
    width: 80%;
    height: 1.5em;

    /* This creates the red/green 50/50 split */
    background: linear-gradient(90deg, #fe6a67 50%, #25c225 50%);
    border: 1px solid #000;
    border-radius: 4px;
    margin-top: 15px;
    margin-bottom: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5); /* Adds depth */
}

.progress-bar-container-binary {
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 8px;
}
.progress-bar-container-binary .task-container {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%;
}

.progress-bar-container-binary .type-name {
    font-size: 1.4rem;
    text-transform: uppercase;
    text-align: left;
    flex: 1;
    color: #ffe710;
}
.progress-bar-container-binary .target-name {
    text-align: center;
    font-size: 1.65rem;
    font-weight: bold;
    flex: 2;
    word-wrap: break-word;
    text-shadow: 2px 2px 2px #000;
}
.progress-bar-container-binary .status {
    text-align: right; 
    font-weight: bold;
    flex: 1;
}


.planet-node .planet-label {
    color: #ffe710;
}

#custom-alert-overlay {
    position: fixed; /* Cover the whole screen */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex; /* Use flex to center the box */
    align-items: center;
    justify-content: center;
}

#custom-alert-box {
    background-color: rgb(34, 34, 34);
    border: 2px solid #ffe710;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    min-width: 300px;
    max-width: 80%;
}

#custom-alert-message {
    font-family: monospace;
    color: whitesmoke;
    font-size: 1.1em;
    white-space: pre-wrap; /* Respect newlines \n */
    margin: 0 0 20px 0;
    text-align: left;
}

#custom-alert-ok {
    background-color: #ffe710;
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-family: monospace;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#custom-alert-ok:hover {
    background-color: #fff;
}

/*  
    ========================
    5. UTILITY CLASSES
    ======================== 
*/
.planetHealth.terminid-color {
    background-color: #FF9f00 !important;
}
.planetHealth.automaton-color {
    background-color: #fe6a67 !important;
}
.planetHealth.illuminate-color {
    background-color: #db58fb !important;
}
.planetHealth.seaf-color {
    background-color: #6bb7ea !important;
    color: #fff !important;
}
.planetHealth.seaf-color-2 {
    background-color: #41639C !important;
    color: #fff !important;
}

/* FACTION COLOUR CLASSES*/
.helldiver-color {
    color: #ffe710 !important;
}
.terminid-color {
    color: #FF9f00 !important;
}
.automaton-color {
    color: #fe6a67 !important;
}
.illuminate-color {
    color: #db58fb !important;
}
.seaf-color {
    color: #6bb7ea !important;
}
.seaf-color-2 {
    color: #41639C !important;
}
.success-color {
    color: #25c225 !important;
}


/*  
    ========================
    BIOME BACKGROUND IMAGES
    ======================== 
*/
.stat-card[data-biome="Acidic Badlands"] {
    background-image: url('/static/images/landscapes/Acidic_Badlands.png');
}
.stat-card[data-biome="Basic Swamp"] {
    background-image: url('/static/images/landscapes/Basic_Swamp.png');
}
.stat-card[data-biome="Black Hole"] {
    background-image: url('/static/images/landscapes/Black_Hole.png');
}
.stat-card[data-biome="Boneyard"] {
    background-image: url('/static/images/landscapes/Boneyard.png');
}
.stat-card[data-biome="Deadlands"] {
    background-image: url('/static/images/landscapes/Deadlands.png');
}
.stat-card[data-biome="Desert Cliffs"] {
    background-image: url('/static/images/landscapes/Desert_Cliffs.png');
}
.stat-card[data-biome="Desert Dunes"] {
    background-image: url('/static/images/landscapes/Desert_Dunes.png');
}
.stat-card[data-biome="Ethereal Jungle"] {
    background-image: url('/static/images/landscapes/Ethereal_Jungle.png');
}
.stat-card[data-biome="Haunted Swamp"] {
    background-image: url('/static/images/landscapes/Haunted_Swamp.png');
}
.stat-card[data-biome="Hive World"] {
    background-image: url('/static/images/landscapes/Hive_World.png');
}
.stat-card[data-biome="Icy Glaciers"] {
    background-image: url('/static/images/landscapes/Icy_Glaciers.png');
}
.stat-card[data-biome="Ionic Crimson"] {
    background-image: url('/static/images/landscapes/Ionic_Crimson.png');
}
.stat-card[data-biome="Ionic Jungle"] {
    background-image: url('/static/images/landscapes/Ionic_Jungle.png');
}
.stat-card[data-biome="Magma"] {
    background-image: url('/static/images/landscapes/Magma.jpg');
}
.stat-card[data-biome="Moon"] {
    background-image: url('/static/images/landscapes/Moon.png');
}
.stat-card[data-biome="Plains"] {
    background-image: url('/static/images/landscapes/Plains.png');
}
.stat-card[data-biome="Rocky Canyons"] {
    background-image: url('/static/images/landscapes/Rocky_Canyons.png');
}
.stat-card[data-biome="Scorched Moor"] {
    background-image: url('/static/images/landscapes/Scorched_Moor.png');
}
.stat-card[data-biome="Super Earth"] {
    background-image: url('/static/images/landscapes/Super_Earth.png');
}
.stat-card[data-biome="Supercolony"] {
    background-image: url('/static/images/landscapes/Supercolony.png');
}
.stat-card[data-biome="Tien Kwan"] {
    background-image: url('/static/images/landscapes/Tien_Kwan.png');
}
.stat-card[data-biome="Tundra"] {
    background-image: url('/static/images/landscapes/Tundra.png');
}
.stat-card[data-biome="Volcanic Jungle"] {
    background-image: url('/static/images/landscapes/Volcanic_Jungle.png');
}