/* 

|| General Styles

*/


/* Peace Walker font */
@font-face {
    font-family: peaceWalker;
    src: url("../fonts/Peace Walker.ttf") format("truetype");
    font-style: normal;
}

/* Default font */
@font-face {
    font-family: "M PLUS 1";
    src: url("../fonts/MPLUS1-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* Bold font */
@font-face {
    font-family: "M PLUS 1";
    src: url("../fonts/MPLUS1-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
}

main {
    border: 2px solid lightgrey;
    margin: 30px;

    padding: 10px;
    width: 100%;
    background-color: white;

    /* Ensure fonts render consistently across browsers */
    font-synthesis: none;
    text-rendering: geometricPrecision;

    /* Allow for decorative image to be positioned */
    position: relative;
}

h1 {
    margin: 0 0 10px;
    font-size: 3rem;
    font-family: peaceWalker;
}

body {
    background-color: whitesmoke;
    font-family: "M PLUS 1";
    font-size: 1.2rem;
    margin: 0;

    display: flex;
    min-height: 100vh;
}

table {
    border-collapse: collapse;
    font-size: 1rem;
}

td,
th {
    border: 1px solid black;
}



/* Info tip hover button */

.info-tip {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    /* info-tip and info-tip-button both change the cursor to avoid the text appearing but the cursor not changing */
    cursor: help;
}

.info-tip-button {
    display: grid;
    width: 1rem;
    height: 1rem;
    padding: 0;
    place-items: center;
    border: 1px solid black;
    border-radius: 50%;
    font: 1rem sans-serif;
    cursor: help;

    box-sizing: content-box;
    background: transparent;
    color: inherit;
    margin: 0;

}

.info-tip-button:focus-visible {
    outline: 2px solid #A21D1B;
    outline-offset: 3px;
}

.info-tip-text {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 15rem;
    max-width: 65vw;
    padding: 0.5rem;
    background: #161616;
    color: white;
    font: 0.9rem/1.4 sans-serif;
    text-align: left;
    z-index: 20;
    visibility: hidden;
}

.info-tip:hover .info-tip-text,
.info-tip:focus-within .info-tip-text {
    visibility: visible;
}


/* 

|| Upload Container

*/


/* Information page links */
.link-container {
    margin: 20px 0;
}

.link-container a {
    color: black;
}

/* Container for the save file upload button */
fieldset {
    max-width: 400px;
}

#error-message {
    font-size: 1rem;
    color: red;
}

/* Ensure list text does not clip out of the screen */
#upload-container ul li {
    word-break: break-word;
}

/* Legal */
.disclaimer {
    margin-top: 100px;
    max-width: 700px;
    color: darkslategrey;
}

/* Decorative image at bottom-right when no save has been uploaded */
#upload-deco-image {
    position: absolute;
    height: 500px;
    right: 0;
    bottom: 0;

    /* Set image to black and white + slightly transparent */
    opacity: 0.5;
    filter: grayscale(1);
}


/* 

|| Save Editor

*/


/* The actual save editor container */
#save-editor {
    max-width: 1000px;
    margin: 15px auto;

    display: flex;
    flex-direction: column;
}

.save-editor-content {
    height: 600px;
    border: 4px solid black;
    box-shadow: -10px 10px 0 lightgrey;
    position: relative;
}

/* Scan lines effect */
.save-editor-content::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: repeating-linear-gradient(rgba(18, 16, 16, 0) 0px,
            rgba(18, 16, 16, 0) 1px,
            rgba(0, 0, 0, 0.05) 1px,
            rgba(0, 0, 0, 0) 3px);
    background-size: 100% 4px;
    z-index: 10;
    /* Prevents effect from blocking clicks */
    pointer-events: none;
}

/* Tabs above the editor content */
.tabs {
    max-width: 100%;
    height: 40px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    /* Ensure that tabs do not appear "floating" above the editor border */
    margin-bottom: -1px;
}

.tab {
    font-family: peaceWalker;
    font-size: 1.5rem;
    border: 0;
    padding: 0 22px;
    color: #f4f2e9;
    background: black;

    /* Trapezium shape */
    clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
}

/* Change tab color and pointer icon when hovered over */
.tab:hover,
.tab[aria-selected="true"] {
    background: #A21D1B;
    cursor: pointer;
}


/* 

|| Overview Category 

*/


#overview {
    height: 100%;
    overflow-x: scroll;
}

/* Main save file details */
.overview-main {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    max-width: 80%;
    margin: auto;
    padding: 10px 0;
    font-size: 1.1rem;
    height: 120px;
    border-bottom: 1px solid black;
}

#overview-profile-name {
    font-size: 4rem;
    font-family: peaceWalker;
    margin: 0;
    text-align: center;

    /* Ensure long names do not cause clipping */
    max-width: 400px;
    word-break: break-word;
}

.overview-main p {
    margin: 0;
}

/* Other save file details */
.overview-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.2rem;
    margin: 25px auto;
    max-width: 700px;
}

/* Prevents mission names from stretching too far */
.overview-secondary p {
    max-width: 400px;
}

/* Styling for game stats */
#overview-save-date,
#overview-save-time,
#overview-play-time,
#overview-heroism,
#overview-camaraderie,
#overview-gmp,
#overview-last-mission {
    font-family: peaceWalker;
    font-size: 1.7rem;
}

.overview-export {
    max-width: 60%;
    margin: auto;
}

/* Export button */
#exportSave {
    /* Center button */
    display: block;
    margin: 0 auto 20px;
    padding: 5px 10px;
    border-radius: 10px;

    font-family: peaceWalker;
    font-size: 1.8rem;
}


/* 

|| Staff Category 

*/


/* Staff category has a sidebar, so slightly different styling than other categories*/
#staff {
    height: 100%;
    display: flex;
    /* Display sidebar on the left, content on the right */
    flex-direction: row;
}

/* Sidebar containing staff list */
#staff-sidebar {
    height: 100%;
    width: 175px;
    border-right: 2px solid grey;
}

/* Top of the sidebar - filter by staff location + name search */
.staff-sidebar-search {
    font-size: 1rem;
    width: 100%;

    /* 120px of 600px height */
    height: 120px;

    border-bottom: 2px solid black;
    padding: 5px;
    /* Padding goes inwards instead of enlarging the container */
    box-sizing: border-box;
}

/* Search inputs */
#staff-sidebar-team,
#staff-sidebar-name {
    width: 145px;
}

/* List of staff members */
#staff-sidebar-content {
    overflow-y: scroll;
    /* 480px of 600px height */
    /* Search container is 120px, 480 + 120 = 600 so entire height is covered */
    height: 480px;
}

.staff-sidebar-staff {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-bottom: 1px solid black;
    cursor: pointer;
    font-size: 1.3rem;
    font-family: peaceWalker;
    word-break: break-word;
}

.staff-sidebar-staff:hover,
.staff-sidebar-staff.selected {
    background: white;
}

/* Staff detail panel */
#staff-content {
    width: 100%;
    padding: 10px;
    overflow-y: scroll;
    position: relative;
}

#staff-content h2 {
    font-size: 2rem;
    text-align: center;
    font-family: peaceWalker;
}

/* Display an overlay on staff members currently dispatched on OUTER OPS */
/* These staff can only be edited when editing is enabled in Advanced */
#staff-outerops-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.92);
    font-family: peaceWalker;
    font-size: 2rem;
}

#staff-outerops-overlay small {
    display: block;
    margin-top: 15px;
    font-family: "M PLUS 1";
    font-size: 1rem;
}

#staff-name {
    font-size: 3rem;
    font-family: peaceWalker;
    margin: 5px 0;
    max-width: 400px;
    word-break: break-word;
}

/* Display details in three groups/columns */
.staff-main-details {
    max-width: 95%;
    margin: auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* Ensure input widths are not too long */
.staff-main-details p input {
    width: 60px;
}

.staff-max-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;

    margin: 20px auto 0;
    width: fit-content;
}

.staff-abilities {
    display: flex;
    justify-content: space-between;
    margin: 25px auto 0;
    max-width: 90%;
}

.ability {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
}

/* Bar sliders for ability inputs */

.ability .ability-bar {
    position: relative;
    width: 40px;
    height: 150px;
    border: 1px solid rgba(65, 65, 53, .45);
    background: rgba(65, 65, 53, 1);
}

.ability .ability-bar input[type="range"] {
    position: absolute;
    inset: 0;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 100%;
    height: 100%;
    inline-size: 100%;
    block-size: 100%;
    margin: 0;
    opacity: 0;
    cursor: ns-resize;
}

/* Grey out the Combat ability  */
.ability-bar-readonly {
    opacity: 0.5;
}


.ability p {
    margin: 0;
}

/* 3x2 grid */
.staff-other-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    text-align: center;
    margin-top: 25px;
    justify-content: center;
    align-items: center;
}

#staff-portrait-choice {
    max-width: 190px;
}

.staff-quote-editor {
    text-align: center;
    margin-top: 25px;
}

#staff-quote-choice {
    width: 400px;
}

.staff-quote {
    text-align: center;
    max-width: 80%;
    margin: 25px auto 0;
}

/* 2x2 grid */
.staff-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.staff-status p {
    margin: 0;
}

.staff-status button {
    grid-column: span 2;
    max-width: 150px;
    margin: 10px auto 0;
}

.skill-title {
    text-align: center;
}

.staff-skills {
    max-width: 80%;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

/* Limit skill dropdowns width and center them */
.staff-skills select {
    max-width: 200px;
    margin: auto;
}

.ability input[type="number"] {
    width: 50px;
}

/* Staff portraits: native resolution, no trimming or enlargement. */
.staff-portrait-preview-frame {
    width: 128px;
    height: 128px;
    margin: 0.6rem auto 0;
    background: #c9c9b3;
    display: grid;
    place-items: center;
}
#staff-portrait-preview {
    width: 128px;
    height: 128px;
    object-fit: contain;
}
#staff-portrait-preview[hidden], #staff-portrait-preview-status[hidden] {
    display: none;
}
#staff-portrait-preview-status {
    font-size: 0.8rem;
    text-align: center;
    padding: 0.3rem;
}


/* 

|| Codename Category

*/


#codename {
    padding: 0 30px;
    height: 100%;
    overflow-y: scroll;
}

#codename h3 {
    text-align: center;
}

.codename-tracker h2 {
    font-family: peaceWalker;
    font-size: 2.5rem;
    margin: 15px 0;
}


.weapons-takedowns {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
}

.takedowns-text {
    max-width: 400px;
}

.takedowns-table {
    text-align: center;
    max-width: 500px;
}

.takedowns-table th,
.takedowns-table td {
    padding: 0 5px;
}

.codename-ranks {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
}

.codename-next {
    max-width: 500px;
}

.codename-next-table td,
.codename-next-table th {
    padding: 5px;
}

.obtained-codenames {
    margin: auto;
    width: 400px;
    text-align: center;
}

.foxhound-table {
    width: 650px;
    margin: 50px auto;
    text-align: center;
}

.foxhound-table td {
    padding: 0 5px;
}

/* Codename editor */

#enable-codename-editing {
    margin: 25px 0;
}

.takedowns-editor-table {
    margin: auto;
}

.codename-editor-table {
    margin: 30px auto;
}

.takedowns-editor table td,
.takedowns-editor-table th,
.codename-editor-table td,
.codename-editor-table th {
    padding: 5px 8px;
}

.takedowns-editor-table input,
.codename-editor-table select {
    display: block;
    margin: auto;
}


/* 

|| RnD Category

*/


#rnd {
    height: 100%;
    overflow: auto;
    padding: 0 30px;
    box-sizing: border-box;
}

#rnd h2 {
    margin: 15px 0;
    font-family: peaceWalker;
    font-size: 2.5rem;
}

.rnd-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.rnd-tabs button {
    padding: 8px 16px;
    cursor: pointer;
    font-family: peaceWalker;
    font-size: 1.5rem;
}

.rnd-tabs button[aria-selected="true"] {
    background: #161616;
    color: #f4f2e9;
}

.rnd-bulk-actions {
    margin-bottom: 30px;
}

/* Weapons */

#rnd-weapon-category {
    font-size: 1.1rem;
    margin: 0 0 12px 8px;
    max-width: 100%;
}

/* Table styling */

.rnd-table-scroll {
    overflow-x: auto;
    margin-bottom: 24px;
}

.rnd-rank-table {
    width: 100%;
    min-width: 880px;
    table-layout: fixed;
    font-size: 0.85rem;
}

.rnd-rank-table caption {
    text-align: left;
    margin-bottom: 8px;
}

.rnd-rank-table th,
.rnd-rank-table td {
    padding: 8px;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.rnd-rank-table thead {
    background: #e8e8e8;
}

.rnd-rank-table th[scope="row"] {
    text-align: left;
}

.rnd-item-card p {
    margin: 6px 0;
}

.rnd-developed-label,
.rnd-stock-label {
    display: block;
    margin: 8px 0;
}

.rnd-stock-label input {
    width: 100%;
    max-width: 7em;
    box-sizing: border-box;
    font: inherit;
}

.rnd-item-card button {
    font: inherit;
    margin: 6px 0;
}

.rnd-item-note {
    font-size: 0.9em;
}

.rnd-edit-error {
    color: #a02020;
}

.rnd-item-card progress {
    width: 100%;
    height: 8px;
}

.rnd-item-state {
    font-weight: bold;
}

#rnd [hidden] {
    display: none !important;
}

.rnd-weapon-card p {
    margin: 6px 0;
}

.rnd-weapon-card progress {
    width: 100%;
    height: 8px;
}


/* Five-column R&D Other inventory */
.rnd-other-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-width: 800px;
}

.rnd-other-card {
    border: 1px solid black;
    padding: 10px;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.rnd-other-card h4 {
    font-size: 1em;
    margin: 0 0 12px;
}

.rnd-other-card label {
    display: block;
    margin: 8px 0;
}

.rnd-other-card input[type="number"] {
    width: 100%;
    max-width: 7em;
    box-sizing: border-box;
}

/* Captured mechs are individual records, including duplicate models */
.rnd-mechs-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-width: 800px;
}

.rnd-mech-card {
    border: 1px solid black;
    padding: 10px;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.rnd-mech-card h4 {
    font-size: 1em;
    margin: 0 0 12px;
}

.rnd-mech-card progress {
    display: block;
    width: 100%;
    height: 1rem;
}

#rnd-mechs details {
    margin: 1rem 0;
}

#rnd-mechs summary {
    cursor: pointer;
}

.add-mech-button {
    margin-left: 5px;
}

.rnd-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}


/* 

|| Insignias Category

*/


#insignias {
    height: 100%;
    overflow: auto;
    padding: 0 30px;
    box-sizing: border-box;
}

#insignias h2 {
    margin: 15px 0;
    font-family: peaceWalker;
    font-size: 2.5rem;
}

.insignia-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    margin-bottom: 20px;
}

.insignia-table th,
.insignia-table td {
    padding: 8px;
    border: 1px solid #aaa;
    vertical-align: top;
}

.insignia-table td:first-child {
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
}

.insignia-table input[type="checkbox"] {
    cursor: pointer;
}

#insignia-error {
    color: #a00;
}


/* 

|| ZEKE Category

*/


#zeke {
    height: 100%;
    overflow: auto;
    padding: 0 30px;
    box-sizing: border-box;
}

#zeke h2 {
    margin: 15px 0;
    font-family: peaceWalker;
    font-size: 2.5rem;
}

/* ZEKE parts and AI boards */
#zeke {
    min-width: 0;
}

.zeke-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin: 1rem 0;
}

.zeke-parts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: 1rem;
}

.zeke-part-group {
    border: 1px solid currentColor;
    padding: .75rem;
}

.zeke-part-group h4 {
    margin: 0 0 .5rem;
}

.zeke-part-group ul {
    padding-left: 1.25rem;
}

.zeke-boards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: 1.5rem;
}

/* Space out bottom row and top row of tables */
.zeke-board-category h4 {
    margin: 0 0 10px;
}

.zeke-board-grid {
    display: grid;
    grid-template-rows: repeat(10, auto);
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: .2rem;
}

.zeke-board {
    position: relative;
    min-width: 0;
    width: 100%;
    font: inherit;
    font-size: .75rem;
    border: 1px solid #888;
    background: #eee;
    color: #555;
    cursor: help;
}

.zeke-board.obtained {
    background: #6a5600;
    color: white;
    border-color: #6a5600;
}

.zeke-board:focus-visible {
    outline: 3px solid #d36a00;
    outline-offset: 2px;
    z-index: 1;
}

.zeke-source-guide {
    margin: 1rem 0;
}

.zeke-source-guide summary {
    cursor: pointer;
}

.zeke-table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.zeke-table-scroll table {
    margin: 1rem auto 0;
    text-align: center;
}

.zeke-source-guide th,
.zeke-source-guide td {
    padding: .4rem .6rem;
}

/* Stable ZEKE inventory rows: reserve a slot for every possible part. */
.zeke-parts {
    display: block;
}

.zeke-part-section {
    margin: 1rem 0;
    border: 1px solid currentColor;
    padding: 0.75rem;
}

.zeke-part-section h4 {
    margin: 0 0 0.5rem;
}

.zeke-part-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) 9rem minmax(15rem, 2fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid #aaa;
}

.zeke-part-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.zeke-part-slots {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.3rem;
}

.zeke-part-slot {
    display: block;
    text-align: center;
    padding: 0.3rem 0;
    background: #eee;
    color: #333;
    border: 1px solid #aaa;
}

.zeke-part-slot small {
    display: block;
    font-size: 0.7rem;
}

.zeke-part-slot.equipped {
    border: 2px solid #6a5600;
    padding: calc(0.3rem - 1px) 0;
}

.zeke-recommended table {
    width: 100%;
    border-collapse: collapse;
}

.zeke-recommended th,
.zeke-recommended td {
    padding: 0.5rem;
    border: 1px solid #aaa;
    text-align: left;
    vertical-align: top;
}

@media (max-width: 750px) {
    .zeke-part-row {
        grid-template-columns: minmax(0, 1fr) 9rem;
    }

    .zeke-part-slots {
        grid-column: 1 / -1;
    }
}
/* Emphasize the OUTER OPS lock only while Advanced editing is disabled. */
#zeke-status.zeke-editing-locked {
    font-size: 1.25em;
    font-weight: 700;
}


/* 

|| Advanced Category

*/


#advanced {
    padding: 0px 30px;
}

#advanced h2 {
    font-family: peaceWalker;
    font-size: 2.5rem;
    margin: 15px 0;
}

.checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mobile Styles */

@media (max-width: 768px) {


    /* || Mobile General Styles */


    main {
        margin: 10px;
        font-size: 1rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    #saveFile {
        width: 100%;
    }

    #save-editor {
        max-width: 95%;
    }

    .save-editor-content {
        width: 100%;
        box-shadow: none;
    }

    /* Shrink tabs and bring them closer together */

    .tabs {
        gap: 0;
    }

    .tab {
        padding: 0 10px;
        font-size: 1rem;
        clip-path: polygon(5% 0%, 95% 0%, 100% 100%, 0% 100%);
    }


    /* || Mobile Overview Category */


    #overview {
        text-wrap: wrap;
    }

    .overview-main {
        flex-wrap: wrap;
        height: 100%;
        padding: 15px 0;

        justify-content: center;
        gap: 30px;
    }

    .overview-secondary {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        width: 90%;
    }

    /* Display elements top-to-bottom instead of side-by-side */
    .overview-export {
        grid-template-columns: 1fr;
    }


    /* || Mobile Staff Category */


    #staff-sidebar {
        width: 100px;
    }

    .staff-sidebar-search {
        font-size: 0.8rem;
    }

    #staff-sidebar-team,
    #staff-sidebar-name {
        width: 95%;
    }

    .staff-sidebar-staff {
        font-size: 1rem;
    }

    .staff-main-details {
        flex-wrap: wrap;
    }

    #staff-name {
        font-size: 2.5rem;
        word-break: break-word;
    }

    .staff-abilities {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }

    .staff-other-details {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }

    #staff-quote-choice {
        width: 90%;
    }

    .staff-skills {
        gap: 10px;

    }

    .staff-skills select {
        width: 100%;
    }

    /* || Mobile Codenames Category */

    .weapons-takedowns {
        margin: 0;
    }

    /* Allow tables to be scrollable horizontally when there isn't enough space */
    .table-container {
        overflow-x: auto;
        width: 100%;
    }

    .weapons-takedowns,
    .codename-ranks {
        flex-wrap: wrap;
    }

    #codename table {
        font-size: 0.9rem;
    }

}

