#units, #equipment, #implants {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0;
  padding: 0;
}

#units > h2, #equipment > h2, #implants > h2 {
  flex-basis: 100%;
  text-align: left;
  padding: 0.3rem 0 0.3rem 0.4rem;
  margin: 0.5rem 0;
  background-image: linear-gradient(to right, #6c6c6c, transparent);
}

body {
  margin: 25px;
  padding: 0 0 75px 0;
  font-family: Arial, Sans-serif;
  font-size: 1.2em;
  font-variant-caps: small-caps;
  text-shadow: 1px 1px rgba(0, 0, 0, 0.5);

  color: white;
  background-color: black;

  background-image: url('/assets/BG2.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

* {
  cursor: url('/assets/cubedweb/cursor.png'), auto;
  font-family: 'Roboto-Medium';
}

@font-face {
  font-family: 'Roboto-Bold';
  src: url('/assets/Fonts/Roboto-Bold.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Roboto-Medium';
  src: url('/assets/Fonts/Roboto-Medium.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

header #personal-nav-icon {
  width: 42px;
  height: 37px;
  position: fixed;
  top: 8px;
  right: 8px;
  background-image: url('/assets/cubedweb/menu.png');
  background-size: contain;
  background-repeat: no-repeat;
}

header #personal-nav {
  position: absolute;
  right: 5px;
  top: 50px;
  visibility: hidden;
  opactity: 0;
  transform: translateY(-5px);
  width: 14rem;
  background-color: black;
  border: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  
  display: flex;
  flex-direction: column;
  
  transition: visibility 0s 0.2s, opacity 0.2s linear, transform 0.2s ease-in-out;
}

header #personal-nav.visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

header #personal-nav > div {
  padding: 0.5rem 1rem;
  color: #374151;
  transition-property: background-color;
  transition-duration: 150ms;
  
  display: block;
}

header #personal-nav > div:hover {
  background-color: #f3f4f6;
}

header #personal-nav > div > a {
  text-decoration: none;
  width: 100%;
  height: 100%;
  display: block;
}

div.unread {
  background-image: url('/assets/exported/Notification_Icon.png');
  background-repeat: no-repeat;
  background-position: bottom left;
  background-size: contain;
  height: 22px;
  width: 22px;
  position: absolute;
  bottom: 1px;
  left: -3px;
  visibility: hidden;
}

div.unread.visible {
  visibility: visible;
}

a.unread::after {
  content: '';
  display: inline-block;
  background-image: url('/assets/exported/Notification_Icon.png');
  background-repeat: no-repeat;
  background-size: contain;
  width: 18px;
  height: 18px;
  margin: 0 0 0 5px;
}

header {
  z-index: 99;
  width: 100vw;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.7);
  position: fixed;
  top: 0;
  left: 0;
}

header h1 {
  position: relative;
  margin: 50px 0 0 20px;
  padding: 0;
  color: #ffe172;
  width: 300px;
  overflow-x: visible;
  white-space: nowrap;
  border-bottom: 1px dotted white;
}

main {
  margin: 50px 0 0 0;
  display: grid;
  grid-template-rows: auto auto;
}

main > section {
  display: grid;
  grid-template-columns: auto auto;
}

nav#sidenav {
  position: fixed;
  top: 125px;
  width: 150px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-left: 0;
  padding-left: 0;
  left: 0;
}

nav#sidenav a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 50px;
  line-height: 50px;
  font-size: 23px;
  padding: 0 0 0 20px;
  text-decoration: none;
  color: white;
  cursor: pointer;
}

nav#sidenav a.active {
  background: linear-gradient(to right, #6c6c6c, transparent) !important;
  color: orange;
}
nav#sidenav a:hover {
  background: linear-gradient(to right, #3c3c3c, transparent);
  color: orange;
}

section#navigation {
  position: fixed;
  top: 5px;
  left: 20px;
  z-index: 99;
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  height: 50px;
}

section#toolsPage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 300px));;
  gap: 25px;
}
section#toolsPage>div {
  position: relative;
  border: 1px dotted white;
  width: 300px;
  height: 80px;
  background-repeat: no-repeat;
  background-size: contain;
}

section#toolsPage>div>a {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

section#toolsPage>div>a>.text {
  font-size: 23px;
  line-height: 23px;
  position: absolute;
  text-decoration: none;
  color: white;
  bottom: 1px;
  right: 1px;
  width: calc(100% - 5px);
  box-sizing: border-box;
  padding: 2px 2px 2px 0;
  background-color: rgba(64, 64, 64, 0.5);
  text-align: right;
}

a, a:visited {
  color: orange;
  text-shadow: 1px 1px solid rgba(0, 0, 0, 0.5);
}
a:active {
  color: dark-grey;
}

section#page, section#toolsPage {
  margin: 70px 0 0 0;
}

section#page, section#toolsPage p {
  display: block;
}

section#content {
  margin-left: 175px;
  width: calc(100vw - 225px);
}

section#unit {
  width: calc(100vw - 50px);
}

section#admin {
  margin: 70px 0 0 0;
  width: 1000px;
  display: flex;
  flex-wrap: wrap;
}

/* Basic Fieldset and Legend Styling */
fieldset {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 0 16px 16px;
  background-color: #666;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

legend {
  font-weight: bold;
  font-size: 1.25em;
  padding: 0 8px;
  cursor: pointer;
  color: #fff;
}

/* Container for the content, initially hidden with grid */
.fieldset-content {
  display: grid;
  grid-template-rows: 0fr; /* The key to the trick: initially 0 height */
  transition: grid-template-rows 0.3s ease-in-out;
}

/* Inner container to prevent content from collapsing in transition */
.fieldset-content > div {
  overflow: hidden;
  padding-top: 10px; /* Add some padding once expanded */
}

/* Class added by JavaScript to expand the content */
.fieldset-content.expanded {
  grid-template-rows: 1fr; /* Expands to its natural height */
}

/* Fix for child elements (labels, inputs) inside the expanded grid */
.fieldset-content.expanded label {
  display: block;
  margin-top: 5px;
}

.fieldset-content.expanded input,
.fieldset-content.expanded textarea,
.fieldset-content.expanded select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box; /* Ensure padding and border are included in the element's total width and height */
}

#solidCloudsLogo {
  position: fixed;
  z-index: 9999;
  bottom: 20px;
  right: 20px;
}

#solidCloudsLogo img:hover {
  filter: brightness(0.5);
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 600px;
}

form label, form input, form output {
  width: 100%;
}

form input:required::after, form  label:has(input:required)::after {
  content: ' *';
  color: red;
}

form input:invalid {
  border: 1px solid red;
}

#hangar-container {
  display: grid;
  /* Defines three rows: header (auto), content (fills space), footer (auto) */
  grid-template-rows: auto 1fr auto;
  /* Defines a single column for the whole container */
  grid-template-columns: 1fr;
  max-height: 80vh;
  border: 1px solid #ccc;
}

/* Your existing hangars grid, which is now a child of the content wrapper */
#hangars {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  grid-gap: 1px;
  background-color: #444;
}
.levelup {
  grid-template-columns: 2fr 1fr 1fr!important;
}

/* NEW: Scrollable content wrapper */
#hangar-content {
  /* This makes only the content area scrollable */
  overflow-y: auto;
}

/* Styles for the header row */
.hangar-headers {
    /* Aligns header cells with the main content grid */
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    grid-gap: 1px;
    background-color: #333;
    color: #f0f0f0;
    /* Sets this div to span the entire width of the container grid */
    grid-column: 1 / -1;
}

/* Footer Styles */
.hangar-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: #333;
    color: #f0f0f0;
    border-top: 1px solid #555;
    /* Sets this div to span the entire width of the container grid */
    grid-column: 1 / -1;
}

#add-hangar-button {
    background-color: #555;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.header-cell {
    padding: 10px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #555; /* A subtle, slightly lighter border */
}

/* Styles for the hangar-card rows */
hangar-card {
    display: contents; /* This lets the inner row participate in the grid */
    color: #f0f0f0; /* Set the text color for the data rows */
}

/* The actual row inside the custom element's shadow DOM */
hangar-card::part(row) {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    background-color: #2c2c2c; /* The main background color for the rows */
    border-bottom: 1px solid #444; /* Darker border to separate rows */
}

/* Hover effect for the entire row */
hangar-card::part(row):hover {
    background-color: #3a3a3a; /* A slightly lighter gray on hover */
    cursor: pointer;
}

/* Styling for the individual cells */
hangar-card::part(cell) {
    padding: 10px;
    border-right: 1px solid #444; /* Darker border between cells */
}

/* Adjusting the first and last cell borders */
hangar-card::part(cell):first-child {
    border-left: 1px solid #444;
}

.form-message {
  border: none!important;
  border-radius: 3px;
  padding: 5px;
}

.form-message.failed {
  border: 1px solid red;
  color: red;
}

.form-message.success {
  color: white;
  border: 1px solid white;
}

.hidden { display: none; }



/** Notifications **/
.modal {
  text-shadow: none;
  color: black;
  z-index: 9999;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden; /* Initially hidden */
}

.modalContent {
  position: absolute;
  background: white;
  width: 75%;
  height: 75%;
  display: flex;
  padding: 20px;
  border-radius: 10px;
}

.messageList {
  width: 35%;
  overflow-y: scroll;
  min-height: 300px;
  height: 100%;
}

.messageList li {
  list-style: none;
  line-height: 25px;
  height: 25px;
}

.messageList li:hover {
  color: #ee701c;
}

.messagePanel {
  width: 65%;
  line-height: 25px;
  font-size: 25px;
  padding: 0 15px;

  overflow-y: scroll;
  min-height: 300px;
  height: 100%;
}

.messagePanel h2 .set-icon{
  padding: 0;
  margin: 0 0 5px;
  font-size: 30px;
}

.messagePanel h3 {
  padding: 0;
  margin: 0 0 15px;
  font-size: 15px;
  color: grey;
  font-weight: normal;
}

.messagePanel p {
  font-size: 20px;
}

.modal .unread {
  font-weight: bold;
  color: black;
  background-image: url('/assets/exported/Notification_Icon.png');
  background-repeat: no-repeat;
  background-size: 20px 20px;
  background-position: 270px 0;
  height: 25px;
}

.modal .read {
  color: gray;
}

#closeModal {
  all: unset;
  position: absolute;
  top: -64px;
  right: 0;
  background-image: url('/assets/cubedweb/close_button.png');
  background-repeat: none;
  background-size: contain;
  width: 189px;
  height: 54px;
}


/* Generic Table */
.table-container {
  display: grid;
  /* Defines three rows: header (auto), content (fills space), footer (auto) */
  grid-template-rows: auto 1fr auto;
  /* Defines a single column for the whole container */
  grid-template-columns: 1fr;
  max-height: 80vh;
  border: 1px solid #ccc;
}

/* Your existing hangars grid, which is now a child of the content wrapper */
.table-container > div {
  display: grid;
  grid-gap: 1px;
  background-color: #444;
}

#threecol .table-headers, #threecol .table-content {
  grid-template-columns: 2fr 1fr 1fr;
}

#fivecol_head .table-headers, #fivecol_head .table-content {
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
}

#sevencol .table-headers, #sevencol .table-content  {
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
}

#ninecol .table-headers, #ninecol .table-content  {
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
}

/* NEW: Scrollable content wrapper */
.table-content {
  /* This makes only the content area scrollable */
  overflow-y: auto;
}

/* Styles for the header row */
.table-headers {
    /* Aligns header cells with the main content grid */
    display: grid;
    grid-gap: 1px;
    background-color: #333;
    color: #f0f0f0;
    /* Sets this div to span the entire width of the container grid */
    grid-column: 1 / -1;
}

.table-header-cell, .table-data-cell {
    padding: 10px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #555; /* A subtle, slightly lighter border */
}


/* Footer Styles */
.table-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: #333;
    color: #f0f0f0;
    border-top: 1px solid #555;
    /* Sets this div to span the entire width of the container grid */
    grid-column: 1 / -1;
}

cite {
  margin: 5px 0 25px 0;
  display: block;
}

form input[type="file"] {
  border: none;
  font-family: 'Roboto-Medium';
}

form input[type="file"]::file-selector-button {
  border: none;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 1rem;
  color: black;
  font-family: 'Roboto-Medium';
}

form input[type="file"]::file-selector-button:hover {
  color: orange;
}

form .skill-row {
  display: flex;
  width: 100%;
  flex-direction: column;
}

[data-clickable="true"]:hover {
  background-color: #555;
  color: orange;
  cursor: pointer;
}

#equipment > h2 .set-icon {
  background-size: 50px 40px;
  background-position: left;
  background-repeat: no-repeat;
  width: auto;
  height: 40px;
  padding-left: 60px;
}
#equipment > h2 .set-icon[data-equipment-set="Attack"] { background-image: url('/assets/Icons/Set\ icons/ATK.png'); }
#equipment > h2 .set-icon[data-equipment-set="Attack_Speed"] { background-image: url('/assets/Icons/Set\ icons/ATKSPD.png'); }
#equipment > h2 .set-icon[data-equipment-set="Buff_Durations"] { background-image: url('/assets/Icons/Set\ icons/BUFF.png'); }
#equipment > h2 .set-icon[data-equipment-set="Critical"][data-equipment-set="Critical"] { background-image: url('/assets/Icons/Set\ icons/CRIT.png'); }
#equipment > h2 .set-icon[data-equipment-set="Defense"] { background-image: url('/assets/Icons/Set\ icons/DEF.png'); }
#equipment > h2 .set-icon[data-equipment-set="Defense_DebuffResistance"] { background-image: url('/assets/Icons/Set\ icons/DEFSEC.png'); }
#equipment > h2 .set-icon[data-equipment-set="DoT_Potency"] { background-image: url('/assets/Icons/Set\ icons/DOT.png'); }
#equipment > h2 .set-icon[data-equipment-set="DebuffChance"] { background-image: url('/assets/Icons/Set\ icons/HACK.png'); }
#equipment > h2 .set-icon[data-equipment-set="HullPoints"] { background-image: url('/assets/Icons/Set\ icons/HP.png'); }
#equipment > h2 .set-icon[data-equipment-set="Hull_Leech"] { background-image: url('/assets/Icons/Set\ icons/LEECH.png'); }
#equipment > h2 .set-icon[data-equipment-set="Outgoing_Repair"] { background-image: url('/assets/Icons/Set\ icons/REPAIR.png'); }
#equipment > h2 .set-icon[data-equipment-set="Reflect"] { background-image: url('/assets/Icons/Set\ icons/RETALIATE.png'); }
#equipment > h2 .set-icon[data-equipment-set="Berserk"] { background-image: url('/assets/Icons/Set\ icons/REVENGE.png'); }
#equipment > h2 .set-icon[data-equipment-set="Shield"] { background-image: url('/assets/Icons/Set\ icons/SHIELD.png'); }
#equipment > h2 .set-icon[data-equipment-set="Speed"] { background-image: url('/assets/Icons/Set\ icons/SPD.png'); }
#equipment > h2 .set-icon[data-equipment-set="Stealth"] { background-image: url('/assets/Icons/Set\ icons/STEALTH.png'); }

/* Abyss Bounty */
#equipment > h2 .set-icon[data-equipment-set="Attack_On_Hit_Inferno_Origin"] { background-image: url('/assets/Icons/Set\ icons/BURNER.png'); }
#equipment > h2 .set-icon[data-equipment-set="Defense_Ignore"] { background-image: url('/assets/Icons/Set\ icons/PIERCER.png'); }

/* Abyssal */
#equipment > h2 .set-icon[data-equipment-set="Abyssal_Attack"] { background-image: url('/assets/Icons/Set\ icons/ATKCRIT.png'); }
#equipment > h2 .set-icon[data-equipment-set="Abyssal_Defense"] { background-image: url('/assets/Icons/Set\ icons/DEFHP.png'); }
#equipment > h2 .set-icon[data-equipment-set="Abyssal_DebuffChance"] { background-image: url('/assets/Icons/Set\ icons/HACKCRIT.png'); }
#equipment > h2 .set-icon[data-equipment-set="Abyssal_HullPoints"] { background-image: url('/assets/Icons/Set\ icons/HPSEC.png'); }

/* Crafted */
#equipment > h2 .set-icon[data-equipment-set="Crafted_DebuffChance"] { background-image: url('/assets/Icons/Set\ icons/EXPLOIT.png'); }
#equipment > h2 .set-icon[data-equipment-set="Crafted_All_Stats"] { background-image: url('/assets/Icons/Set\ icons/OMNICORE.png'); }
#equipment > h2 .set-icon[data-equipment-set="Crafted_Outgoing_Repair"] { background-image: url('/assets/Icons/Set\ icons/RECOVERY.png'); }
#equipment > h2 .set-icon[data-equipment-set="Crafted_Speed"] { background-image: url('/assets/Icons/Set\ icons/SWIFTNESS.png'); }

/* New */
#equipment > h2 .set-icon[data-equipment-set="On_Hit_Corrosion_Origin"] { background-image: url('/assets/Icons/Set\ icons/PLAGUEBRINGER.png'); }
#equipment > h2 .set-icon[data-equipment-set="Inc_Crit_Down"] { background-image: url('/assets/Icons/Set\ icons/HARDENED.png'); }

.equipment-card-placeholder {
  position: relative;
  text-shadow: 1px 1px rgba(128, 128, 128, 1);
  font-weight: bold;
  transition: all 0.3s ease-in-out;
  box-sizing: border-box;
  width: 134px;
  height: 103px;
  clip-path: polygon(12px 0, 134px 0, 134px 103px, 0 103px, 0 12px);
}

/* Equipment Filters */
/* Container that holds the hangar name and filters side by side */

/* Filters container */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
}

/* This forces a new row */
.filter-break {
    flex-basis: 100%;
    height: 0;
}

/* Each filter group (label + buttons) */
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Filter label */
.filter-group label {
    color: #ccc;
    display: inline-block;
    width: 170px;
    height: 100%;
    vertical-align: top;
}

/* Segmented buttons (single-select) */
.pill-group {
    display: grid;
    grid-auto-rows: auto;
    grid-auto-flow: row;
    grid-template-columns: repeat(6, max-content);
    column-gap: 0.5rem;
    row-gap: 0.5rem;
}

.segmented button,
.pill-group button {
    background: #222;
    border: 1px solid #444;
    color: #ccc;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: 'Roboto-Medium';
}

/* Active state */
.segmented button.active,
.pill-group button.active {
    background: #555;
    border-color: #888;
    color: #fff;
}

/* Hover effect */
.segmented button:hover,
.pill-group button:hover {
    background: #333;
    border-color: #666;
}

#apply-filters {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ddd;
    padding: 0.45rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    height: 32px; /* matches your filter button height */
    display: flex;
    align-items: center;
}

/* Hover */
#apply-filters:hover {
    background: #333;
    border-color: #666;
    color: #fff;
}

/* Active press */
#apply-filters:active {
    background: #1f1f1f;
    border-color: #555;
}

/* Disabled state (optional) */
#apply-filters:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Fixed Filters button */
.filter-toggle {
    position: fixed;
    top: 400px;
    left: 20px;
    z-index: 1000;

    background: #222;
    border: 1px solid #444;
    color: #ddd;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Floating panel */
.filter-panel {
    top: 10vh;
    left: 0;
    position: fixed;
    margin: auto 5vw;
    max-width: auto;
    max-height: auto;
    overflow-y: auto;

    background: #1a1a1a;
    border: 1px solid #333;
    padding: 1rem;
    border-radius: 6px;
    z-index: 999;

    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
}

/* Hidden state */
.filter-panel.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Incursion */
.incursion-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 12px;

    background: #000;
    border: 2px solid #ffb300;
    border-radius: 8px;
    padding: 10px 16px;
    z-index: 999;

    color: white;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.4);
}

.incursion-icon {
    width: 32px;
    height: 32px;
}

.incursion-label {
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 1px;
}

.incursion-time {
    color: #ffb300;
    font-weight: bold;
    font-size: 0.95rem;
    margin-left: auto;
}

.hidden { display: none; }

.beginner {
    border: 1px solid #bf7432;
    box-shadow: inset 0 0 8px #bf7432;
    background: rgba(255, 179, 0, 0.1);
}

ul li.Common { color: #6c6c6c; }
ul li.Uncommon { color: #38874f; }
ul li.Rare { color: #4369a3; }
ul li.Epic { color: #723681; }
ul li.Legendary { color: #bf7432; }
