/*********************************************************************
 *  GLOBAL LAYOUT                                                     *
 *********************************************************************/

/* tweaks by Raithmore */

/* ---- Site-wide parchment background -------------------------------- */
body {
    background-image: url('images/seamless-parchment.webp');
    background-repeat: repeat;
    background-size: auto;
    background-position: top left;
    background-color: #e0dace; /* better contrast for readability */
}

/* ---- Site header / brand ------------------------------------------- */
.container-header .navbar-brand a {
    text-decoration: none;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    line-height: 1.2;
}

/* ---- Module header alignment and bg color override ----------------- */
.card-header {
    text-align: center; background-color: #eaeaea !important;
}

/* ---- Main menu styling --------------------------------------------- */
.mod-menu .active > a,
.mod-menu .current > a {
    border-bottom: 2px solid #ffffff;           /* underline active item */
}
.mod-menu {
    justify-content: left;
}

/* ---- Dropdown behaviour (hover reveal; still disabled by Kunena JS) */
ul.navbar-nav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}
ul.navbar-nav li.dropdown:hover > .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
}
ul.navbar-nav li.dropdown > a.dropdown-toggle::after {
    pointer-events: none;                       /* ignore click pointer */
}

/* Hide edit controls everywhere EXCEPT pages with .djslate */
body:not(.djslate) .com-content .actions,
body:not(.djslate) .com-content .actions a,
body:not(.djslate) .com-content .edit,
body:not(.djslate) a[href*="task=edit"],
body:not(.djslate) a[href*="/edit?"],
body:not(.djslate) a[href*="layout=edit"],
body:not(.djslate) a.icon-edit,
body:not(.djslate) span.icon-edit {
  display: none;
}

/* The above declaration messes up URL display in Kunena forum, so we are fixing it here */
.bbcode_url {display: initial !important;}

/* ---- Footer centring ----------------------------------------------- */
.mod-footer {
    margin: 0 auto;
}



/*********************************************************************
 *  KUNENA TWEAKS                                                     *
 *********************************************************************/

/* ---- TinyMCE editor frame (used in Kunena posts) ------------------- */
#tinymce {
    border: 1px solid #aaa;
    background-color: #fff !important;
}

/* ---- Category icon column width ------------------------------------ */
#kcat-icon {
    width: 5%;                                 /* adjust as needed */
}

/* ---- Forum index mobile layout fixes ------------------------------ */
@media screen and (max-width: 576px) {
    #kunena table.forumlist {
        table-layout: fixed;
        width: 100% !important;
    }
    #kunena table.forumlist th,
    #kunena table.forumlist td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: top;
    }
    #kunena table.forumlist h3,
    #kunena table.forumlist .lastpostlink,
    #kunena table.forumlist .lastpostby,
    #kunena table.forumlist .datepost {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    #kunena table.forumlist .header-desc {
        display: none;
    }
    #kunena #kcat-icon {
        display: none !important;              /* hide folder icon col */
    }
    #kunena table.forumlist > tbody > tr:first-child {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
    }
    #kunena table.forumlist > tbody > tr:first-child td {
        flex: 1 1 50%;
        padding: 0.5rem;
        text-align: center;
        border: none !important;
    }
    #kunena table.forumlist > tbody > tr:first-child td div {
        font-weight: bold;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    #kunena.layout td[colspan="7"],
    #kunena.layout td[colspan="4"] {
        display: none !important;
    }
    /* Selector button width */
    #catid {
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        min-width: 280px;
    }
}

/* ---- General cell alignment --------------------------------------- */
#kunena td,
#kunena th {
    text-align: left;
    vertical-align: middle;
}
#kunena li.btn-link {
    text-align: center !important;
}

/* ---- Float-left / right attachment images ------------------------- */
.kmsg .bbcode_right .kmsgimage {
    float: right;
    margin: 0 0 12px 20px;
    max-width: 250px;
}
.kmsg .bbcode_left .kmsgimage {
    float: left;
    margin: 0 20px 12px 0;
    max-width: 250px;
}
.kmsg::after {
    content: "";
    display: block;
    clear: both;
}

/* ---- Prevent awkward text wrapping around images ------------------ */
.kmsg {
    word-wrap: break-word;
    word-break: normal;
    overflow-wrap: break-word;
}
@media (max-width: 576px) {
    .kmsgimage + p {
        clear: both;
    }
}

/* Hide the “guests online” bit inside Kunena widgets */
.kstats-guest,                         /* Kunena Stats module */
.kwho-guest {    /* Crypsis / Aurelia layouts */
    display:none;
}

/* ---- Force white background for Kunena elements ------------------- */
body .kfrontend,
body .kcontainer,
body .kbody,
body .ksection,
body .kblock,
body .klist,
body .kmessage,
#categoryactions,
.badger-left,
#kpost-attachments,
#kpost-subscribe,
#kunena.layout select#postcatid {
    background-color: #ffffff !important;
    background-image: none !important;
}
#kunena #form_submit_button,
#kunena .btn-outline-primary {
    background-color: #fff;
}
#kunena #form_submit_button:hover {
    background-color: #448344;
}
#kunena .btn-outline-primary:hover {
    background-color: #010156;
}
.topic-item-messages {
    background-color: #ffffff;
}

/* ---- Kunena padding and button group tidy-ups --------------------- */
.badger-left,
.data-badger {
    padding: 20px !important;
}
#kunena.layout [class*="badger"]::after {
    background-color: #fff;
}
#modified-reason {
    margin: 0 0 0 20px;
}
#kpost-subscribe {
    padding: 20px;
}
.btn-marging > * {
    margin-right: 10px;
}
#kunena .btn-group {
    background-color: #fff !important;
}

/* ---- Hide gender, email, birthday icons --------------------------- */
span[data-bs-toggle="tooltip"][title^="Birthdate"],
.bi-envelope,
#kunena.layout .kicon-profile-gender-male,
#kunena.layout .kicon-profile-gender-female {
    display: none !important;
}

/* ---- Zebra striping inside post-content tables -------------------- */
.kmsg table {
    border-collapse: collapse;
    border: 1px solid #ccc;
    width: 90%;
    margin: 0 auto;
}
.kmsg th,
.kmsg td {
    border: 1px solid #ccc;
    padding: 8px;
}
.kmsg table tr:nth-child(even) {
    background-color: #f9f9f9;
}
.kmsg table tr:nth-child(odd) {
    background-color: #ffffff;
}
.kmsg table tr:first-child {
    background-color: #e0e0e0;
    font-weight: bold;
}

/* ---- “Forum Menu” heading (navbar) -------------------------------- */
.navbar.navbar-expand-lg {
    flex-wrap: wrap;                    /* allow wrapping above 992 px */
}
#kunena .navbar::before {
    content: "Forum";
    font-family: var(--cassiopeia-font-family-headings,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");
    flex: 0 0 100%;
    order: -1; 
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    margin: 0 0 0.5rem;

  --card-spacer-y: 1rem;
  --card-spacer-x: 1rem;
  --card-title-spacer-y: .5rem;
  --card-title-color: ;
  --card-subtitle-color: ;
  --card-border-width: var(--border-width);
  --card-border-color: #dfe3e7;
  --card-border-radius: var(--border-radius);
  --card-box-shadow: ;
  --card-inner-border-radius: calc(var(--border-radius) - (var(--border-width)));
  --card-cap-padding-y: .5rem;
  --card-cap-padding-x: 1rem;
  --card-cap-bg: rgba(var(--body-color-rgb),.03);
  --card-cap-color: ;
  --card-height: ;
  --card-color: ;
  --card-bg: var(--body-bg);
  --card-img-overlay-padding: 1rem;
  --card-group-margin: .5em;
  word-wrap: break-word;
  padding: var(--card-cap-padding-y)var(--card-cap-padding-x);
  color: var(--card-cap-color);
  background-color: var(--card-cap-bg);
  border-bottom: var(--card-border-width)solid var(--card-border-color);
  margin: -10px 0px 0px 0px;
}


/* ---- Replace off-canvas heading text ------------------------------ */
#offcanvasKunena h5 {
    font-size: 0;                       /* hide original string */
}
#offcanvasKunena h5::before {
    content: "Forum Menu";
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5rem;
}



/*********************************************************************
 *  COMMUNITY BUILDER / LOGIN TWEAKS                                 *
 *********************************************************************/

/* ---- Mod-login layout --------------------------------------------- */
.mod-login-logout__login-avatar,
.mod-login-logout__button {
    margin: 0 auto;
    text-align: center;
}

/* ---- Login page title injection ----------------------------------- */
.login-page .container-component {
    padding: 0 20px;
}
.login-page .cbLoginForm::before {
    content: "Login";
    display: block;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 1em;
    color: #333;
}

/* ---- Hide profile-edit note on new accounts ----------------------- */
.view-saveregisters .main-top,
.view-confirm .main-top {
    display: none;
}

/* ---- Hide “Allow Auto-Starting Tours” ----------------------------- */
#cbfr_jform_params_allowTourAutoStart {
    display: none !important;
}

/* ---- Core CB style tweaks ----------------------------------------- */
.cbTabsContent {
    padding: 20px !important;
}
#cbtabsCBNav {
    margin-bottom: 0 !important;
}
.cb_template .offset-sm-3 {
    margin-left: 0 !important;
    width: 100% !important;
    text-align: center;
}
.cbProfileEditButtons .col-sm-9 {
    margin: 10px 0;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}
#cbtabscb_tabmainNav {
    margin-bottom: 0 !important;
}
html body .cb_template .border-top {
    border-top: 2px solid #dee2e6 !important;
}
.cbTabNav.nav-item {
    border-left: 1px solid #fff;
    border-top: 1px solid #fff;
    border-right: 1px solid #fff;
    border-radius: 4px 4px 0 0;
}
.cbTabNav.nav-item:hover {
    background-color: rgba(100,100,100,.2);
}
.cbMenu_UE_MENU_EDIT {
  background-color: rgba(255,255,0,.5);
  border: 1px solid red;
}
/* ---- Profile form label weight ------------------------------------ */
.col-form-label {
    font-weight: bold;
}

/* ---- CB user-list mobile fix -------------------------------------- */
.cbUserListStackedRow {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.cbUserListRowColumn {
    box-sizing: border-box;
    flex: 1 1 25%;
    max-width: 25%;
    min-width: 220px;
    padding-left: 10px;
    padding-right: 10px;
}

.cbUserListFC_onlinestatus {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    white-space: normal;
}

.cb_offline,
.cb_online {
    display: inline-flex;
    align-items: center;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

@media (max-width: 991px) {
    .cbUserListRowColumn {
        flex: 1 1 50%;
        max-width: 50%;
    }
}

@media (max-width: 575px) {
    .cbUserListRowColumn {
        flex: 1 1 100%;
        max-width: 100%;
        min-width: 0;
    }
}

/* ---- CB user-list style ----------------------------------- */
#cbUserTable {
    background-color: #fff;
    padding: 20px;
}

.cbUserListTitle {
    display: none;
}

/* ---- Inject notice above CB “SvS” section ------------------------- */
#cbfr_66::before {
    content: "------------- Optional SvS Information -------------";
    flex: 0 0 100%;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
}
.profile-page #cbfr_66::before {
    display: none;
}

/* ---- make admin field have a different background ---- */
#cbfr_67 {padding: 6px; background-color: #ccc;}


/*********************************************************************
 *  DP CALENDAR TWEAKS                                               *
 *********************************************************************/

.fc-view-harness {
    background-color: #ffffff !important;
    background-image: none !important;
}

/* ---- Highlight “today” cell --------------------------------------- */
.fc-day-today {
    background-color: #ffeaa7 !important;
    border: none !important;
    outline: 2px dashed #e17055 !important;
    outline-offset: -1px;
    position: relative;
    z-index: 2;
}



/*********************************************************************
 *  MISCELLANEOUS                                                     *
 *********************************************************************/

/* ---- Hide generic icons class (front-end editing) ----------------- */
.icons {
    display: none;
}

/* ---- Reduce GTranslate widget size -------------------------------- */
#gt_float_wrapper {
    transform: scale(0.8);
    transform-origin: top right;
}

/* ---- Battlefield signup page layout ------------------------------- */
.signup-page h1 {
    display: block;
    margin: 0 auto;
    padding-bottom: 40px;
    text-align: center;
}
.signup-page #userForm {
    max-width: 640px;
    margin: 0 auto;
    border: 2px solid #3B3D72;
    padding: 18px;
    background-color: #ccc;
}

/* ---- Fix transparent dropdown on timezone control ----------------- */
.dp-timezone__select {
    background-color: #fff !important;
}

/* ---- Adding a customized map for our users ---- */
#alliance-map {
  width: 100%;
  height: 600px;
  margin: 1em 0;
}
.info.legend {
  background: white;
  padding: 6px;
  font: 14px/1.4 Arial, sans-serif;
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
}
.info.legend i {
  width: 14px;
  height: 14px;
  float: left;
  margin-right: 6px;
  opacity: 0.8;
  background: #ccc;
}
/* Applies to any module with class 'leaflet-map' */
.moduletable.leaflet-map #alliance-map,
.moduletable.leaflet-map .leaflet-container {
  width: 100% !important;
  height: 600px !important;
  position: relative;
}

.moduletable.leaflet-map {
  overflow: visible !important;
}

#alliance-map {
  width: 100%;
  height: 600px;
  min-height: 600px;
  max-width: 100%;
  margin: 1em auto;
  position: relative;
  z-index: 0;
}
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* ---- Top 5 User List Page Tweaks ---- */
.top5-contenders-page .cbUserListResultCount {display: none;}

body.top5-contenders-page #cbUserTable {
  overflow-x: auto;
}

/* Keep rows and headers in a horizontal line */
body.top5-contenders-page .cbUserListHeader,
body.top5-contenders-page .cbUserListRow {
  display: flex !important;
  flex-wrap: nowrap !important;
}

/* All columns: equal width by default, ellipsis truncation */
body.top5-contenders-page .cbUserListHeader > div,
body.top5-contenders-page .cbUserListRow > div {
  flex: 0 0 25% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Column 4 (Notes): allow wrapping and give more space */
body.top5-contenders-page .cbUserListHeaderCol4,
body.top5-contenders-page .cbUserListRowCol4 {
  flex: 1.5 1 0 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
}

/* Inner content inside column 4: allow full wrapping */
body.top5-contenders-page .cbUserListHeaderCol4 *,
body.top5-contenders-page .cbUserListRowCol4 * {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  display: inline !important;
}
