@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;600;700&display=swap');

/* Clan — X Galaxy style (join + company) */
/* Felső menü + resource sáv után maradó hely (ne lógjon ki alul) */
#main.clan-xg-layout {
    display: flex;
    flex-direction: column;
    /* fallback ha nincs JS; pontos érték: clan.php fitClanMain() */
    height: calc(100vh - 320px);
    height: calc(100dvh - 320px);
    max-height: calc(100vh - 320px);
    max-height: calc(100dvh - 320px);
    min-height: 280px;
    overflow: hidden;
    margin-bottom: 8px;
    box-sizing: border-box;
}

#main.clan-xg-layout .container,
#main.clan-xg-layout .row {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.xg-clan-page {
    --xg-bg: #050a12;
    --xg-panel: rgba(8, 16, 28, 0.92);
    --xg-border: rgba(66, 135, 245, 0.35);
    --xg-accent: #4287f5;
    --xg-accent-dim: rgba(66, 135, 245, 0.15);
    --xg-text: #e8f4ff;
    --xg-muted: rgba(180, 200, 220, 0.75);
    --xg-warn-bg: rgba(212, 168, 42, 0.12);
    --xg-warn-border: rgba(255, 200, 80, 0.45);
    --xg-warn-text: #f5d78e;
    --xg-mmo: #ff8a3d;
    --xg-eic: #4da3ff;
    --xg-vru: #5ee06a;
    max-width: 1060px;
    width: 100%;
    margin: 6px auto 8px;
    padding: 0 16px;
    color: var(--xg-text);
    font-family: "Segoe UI", system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-height: 800px) {
    #main.clan-xg-layout {
        height: calc(100vh - 240px);
        height: calc(100dvh - 240px);
        max-height: calc(100vh - 240px);
        max-height: calc(100dvh - 240px);
    }
}

@media (max-height: 700px) {
    #main.clan-xg-layout {
        height: calc(100vh - 200px);
        height: calc(100dvh - 200px);
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
        min-height: 220px;
    }
}
/* X Galaxy — clan tab navigation */
.clan-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
}
.clan-nav-btn {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(66, 135, 245, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none !important;
    display: block;
    box-sizing: border-box;
}
.clan-nav-btn:hover {
    background: rgba(66, 135, 245, 0.1);
    border-color: rgba(66, 135, 245, 0.4);
    color: rgba(255, 255, 255, 0.9) !important;
}
.clan-nav-btn.active {
    background: rgba(66, 135, 245, 0.3);
    border-color: #4287f5;
    color: #4287f5 !important;
    font-weight: 700;
}

/* Join layout */
.xg-clan-board {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    border: 1px solid var(--xg-border);
    background: var(--xg-panel);
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}
.xg-clan-create,
.xg-clan-list {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.xg-clan-panel__title {
    margin: 0 0 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xg-accent);
}
.xg-clan-create {
    padding: 22px 20px;
    border-right: 1px solid rgba(0, 174, 255, 0.25);
    background: rgba(0, 0, 0, 0.25);
}
.xg-clan-form-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.xg-clan-form-row--stack {
    grid-template-columns: 1fr;
    align-items: start;
}
.xg-clan-form-row--stack label {
    margin-bottom: 6px;
}
.xg-clan-form-row label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--xg-muted);
}
.xg-clan-form-row input[type="text"],
.xg-clan-form-row textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--xg-text);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 174, 255, 0.35);
    border-radius: 2px;
    outline: none;
}
.xg-clan-form-row input:focus,
.xg-clan-form-row textarea:focus {
    border-color: var(--xg-accent);
    box-shadow: 0 0 0 2px rgba(0, 174, 255, 0.15);
}
.xg-clan-form-row textarea {
    min-height: 88px;
    resize: vertical;
}
.xg-btn-primary {
    display: inline-block;
    margin-top: 8px;
    padding: 11px 28px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff !important;
    background: linear-gradient(180deg, #1a9fd4 0%, #0d6ea8 100%);
    border: 1px solid rgba(0, 200, 255, 0.6);
    border-radius: 2px;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
}
.xg-btn-primary:hover {
    filter: brightness(1.1);
}
.xg-btn-primary.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Clan list */
.xg-clan-list {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.xg-clan-list__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.xg-clan-list__head h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xg-accent);
}
.xg-clan-list__apps {
    font-size: 12px;
    font-weight: 600;
    color: #ff9d3b !important;
    text-decoration: none !important;
    cursor: pointer;
}
.xg-clan-list__apps:hover {
    text-decoration: underline !important;
}
.xg-clan-table-wrap {
    flex: 1 1 auto;
    overflow: auto;
    border: 1px solid rgba(0, 174, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
}
.xg-clan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.xg-clan-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--xg-accent);
    background: rgba(0, 40, 70, 0.5);
    border-bottom: 1px solid rgba(0, 174, 255, 0.25);
}
.xg-clan-table thead th.col-num { width: 40px; }
.xg-clan-table thead th.col-tag { width: 80px; }
.xg-clan-table thead th.col-co { width: 90px; text-align: center; }
.xg-clan-table thead th.col-mem { width: 90px; text-align: center; }
.xg-clan-table thead th.col-view { width: 70px; text-align: right; }
.xg-clan-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.xg-clan-table tbody tr:hover td {
    background: rgba(0, 174, 255, 0.06);
}
.xg-clan-table tbody td.col-co,
.xg-clan-table tbody td.col-mem {
    text-align: center;
}
.xg-clan-table tbody td.col-view {
    text-align: right;
}
.xg-clan-table a.xg-link-view {
    color: var(--xg-accent) !important;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
}
.xg-clan-table a.xg-link-view:hover {
    text-decoration: underline !important;
}
.xg-faction-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: 800;
    border-radius: 2px;
    line-height: 1;
}
.xg-faction-letter--mmo { color: var(--xg-mmo); border: 1px solid rgba(255, 138, 61, 0.4); background: rgba(255, 138, 61, 0.1); }
.xg-faction-letter--eic { color: var(--xg-eic); border: 1px solid rgba(77, 163, 255, 0.4); background: rgba(77, 163, 255, 0.1); }
.xg-faction-letter--vru { color: var(--xg-vru); border: 1px solid rgba(94, 224, 106, 0.4); background: rgba(94, 224, 106, 0.1); }

/* Pagination */
.xg-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}
.xg-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--xg-muted) !important;
    text-decoration: none !important;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 174, 255, 0.25);
}
.xg-pagination a:hover {
    color: var(--xg-text) !important;
    border-color: var(--xg-accent);
}
.xg-pagination a.is-current {
    color: #fff !important;
    background: var(--xg-accent);
    border-color: var(--xg-accent);
}

/* Modals */
#infos,
#user-applications {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, 94vw);
    max-height: 90vh;
    overflow: auto;
    padding: 24px 28px;
    background: linear-gradient(180deg, rgba(12, 24, 40, 0.98) 0%, rgba(6, 12, 22, 0.98) 100%);
    border: 1px solid var(--xg-border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
    color: var(--xg-text);
}
#infos-loader {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    background: rgba(6, 12, 22, 0.95);
}
.xg-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    line-height: 30px;
    text-align: center;
    font-size: 20px;
    color: var(--xg-muted);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
}
.xg-modal-close:hover {
    color: #fff;
    border-color: var(--xg-accent);
}
#infos-avatar {
    width: 72px !important;
    height: 72px !important;
    border: 1px solid var(--xg-border);
    border-radius: 4px;
    object-fit: cover;
}
#infos .xg-infos-grid {
    display: inline-block;
    margin-left: 14px;
    vertical-align: top;
    font-size: 13px;
    line-height: 1.7;
}
#infos .xg-infos-grid b {
    display: inline-block;
    width: 88px;
    color: var(--xg-muted);
    font-weight: 600;
}
#infos-description,
#send_clan_application textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0 !important;
    padding: 10px 12px;
    color: var(--xg-text);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 174, 255, 0.35);
    border-radius: 2px;
    resize: vertical;
}
#applicationsSend {
    max-height: 320px;
    overflow: auto;
}
#applicationsSend > div {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
}
#noApp {
    border: 1px dashed rgba(248, 113, 113, 0.5) !important;
    border-radius: 4px;
    padding: 12px !important;
    text-align: center;
    color: #fca5a5;
}

/* Company change page */
/* —— Change Company (xgalaxy.com) —— */
.xg-company-page {
    border: 1px solid rgba(66, 135, 245, 0.25);
    background: linear-gradient(135deg, rgba(8, 12, 20, 0.92), rgba(15, 20, 35, 0.88));
    backdrop-filter: blur(12px);
    padding: 24px 20px 32px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
.xg-clan-page--company .page-title {
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #4287f5;
    margin: 0 0 20px;
    text-align: center;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
}
.xg-clan-page--company .warning-box {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    padding: 20px;
    border-radius: 8px;
    margin: 0 auto 28px;
    max-width: 820px;
    text-align: center;
}
.xg-clan-page--company .warning-box .warning-text {
    font-size: 12px;
    color: #fbbf24;
    line-height: 1.6;
    margin: 0;
}
.xg-clan-page--company .warning-box strong {
    color: #fff;
}
.xg-clan-page--company .companies-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    padding-bottom: 24px;
}
.xg-clan-page--company .company-card {
    width: 280px;
    height: 450px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(66, 135, 245, 0.3);
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.xg-clan-page--company .company-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
}
.xg-clan-page--company .company-card:hover::before {
    background: rgba(0, 0, 0, 0.1);
}
.xg-clan-page--company .company-card:hover {
    border-color: #4287f5;
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 20px 40px rgba(66, 135, 245, 0.5);
}
.xg-clan-page--company .company-mmo {
    background-image: url("/public/img/companyChoose/bg_character_mmo.jpg?v=aetherion");
}
.xg-clan-page--company .company-eic {
    background-image: url("/public/img/companyChoose/bg_character_eic.jpg?v=drakaris");
}
.xg-clan-page--company .company-vru {
    background-image: url("/public/img/companyChoose/bg_character_vru.jpg?v=elyndra");
}
.xg-clan-page--company .company-name {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    z-index: 1;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    padding: 0 12px;
    box-sizing: border-box;
}
#company-change-modal.xg-company-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3100;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
#company-change-modal.xg-company-modal.active {
    display: flex;
}
#company-change-modal .modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(8, 12, 20, 0.98), rgba(15, 20, 35, 0.95));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(66, 135, 245, 0.4);
    max-width: 600px;
    width: 90%;
    padding: 40px 36px 32px;
    text-align: center;
    box-sizing: border-box;
}
.xg-company-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    padding: 0;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    font-size: 18px;
    line-height: 33px;
    cursor: pointer;
    transition: all 0.3s;
}
.xg-company-modal__close:hover {
    background: rgba(239, 68, 68, 0.35);
}
#company-change-modal .modal-title {
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #4287f5;
    margin: 0 0 15px;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
}
#company-change-modal .modal-company-name {
    font-size: 16px;
    color: #fbbf24;
    margin-bottom: 25px;
    font-weight: 600;
}
#company-change-modal .modal-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    margin: 0 0 30px;
}
#company-change-modal .modal-text strong {
    color: #fff;
}
#company-change-modal .modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
#company-change-modal .modal-btn {
    padding: 12px 30px;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    min-width: 120px;
}
#company-change-modal .modal-btn.confirm {
    background: linear-gradient(135deg, #4287f5, #2563eb);
    color: #fff;
}
#company-change-modal .modal-btn.cancel {
    background: rgba(107, 114, 128, 0.5);
    color: #fff;
    border: 1px solid rgba(107, 114, 128, 0.7);
}
#company-change-modal .modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 135, 245, 0.5);
}
@media (max-width: 768px) {
    .xg-clan-page--company .companies-container {
        flex-direction: column;
        align-items: center;
    }
    .xg-clan-page--company .company-card {
        width: 100%;
        max-width: 350px;
        height: 420px;
    }
}

/* —— Clan panel (overview / members / company) —— */
.xg-clan-panel {
    border: 1px solid rgba(66, 135, 245, 0.25);
    background: linear-gradient(135deg, rgba(8, 12, 20, 0.92), rgba(15, 20, 35, 0.88));
    backdrop-filter: blur(12px);
    padding: 22px 24px 20px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.xg-clan-panel--overview {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.xg-clan-panel--scroll {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.xg-clan-panel--members {
    padding-bottom: 22px;
}
.xg-clan-block--last {
    margin-bottom: 0;
}
.xg-clan-section-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xg-accent);
}
.xg-clan-section-title--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.xg-clan-section-title__action {
    font-size: 14px;
    color: var(--xg-accent);
    cursor: pointer;
    text-decoration: none !important;
}
.xg-clan-section-title__action:hover {
    color: #fff !important;
}

/* Overview */
.xg-clan-overview-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 16px;
    margin-bottom: 12px;
}
.xg-clan-stats {
    border: 1px solid rgba(0, 174, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
}
.xg-clan-stat-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.xg-clan-stat-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}
.xg-clan-stat-row:last-child {
    border-bottom: none;
}
.xg-clan-stat-row dt {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--xg-muted);
}
.xg-clan-stat-row dd {
    margin: 0;
    color: var(--xg-text);
}
.xg-clan-stat-row dd .fa-cog {
    margin-left: 8px;
    color: var(--xg-accent);
    cursor: pointer;
}
.xg-clan-logo-box {
    border: 1px solid var(--xg-border);
    background: rgba(0, 0, 0, 0.45);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    max-height: 160px;
}
.xg-clan-logo-box img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}
.xg-clan-overview-top,
.xg-clan-desc-block {
    flex-shrink: 0;
}
.xg-clan-desc-block {
    margin-bottom: 16px;
}
.xg-clan-desc-box {
    margin-top: 8px;
    padding: 12px 14px;
    min-height: 48px;
    max-height: 88px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid rgba(0, 174, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
    word-break: break-word;
}
.xg-clan-news-wrap {
    border: 1px solid rgba(0, 174, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.xg-clan-news-head {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xg-accent);
    background: rgba(0, 60, 100, 0.35);
    border-bottom: 1px solid rgba(0, 174, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.xg-clan-news-list {
    flex: 1 1 auto;
    min-height: 72px;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.xg-clan-news-list .ps-scrollbar-y-rail,
.xg-clan-news-list .ps-scrollbar-x-rail {
    display: none !important;
}
.xg-clan-news-item {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 14px;
    font-size: 12px;
    line-height: 1.45;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.xg-clan-news-item--new { background: rgba(101, 101, 0, 0.35); }
.xg-clan-news-item--join { background: rgba(34, 120, 60, 0.25); }
.xg-clan-news-item--settings { background: rgba(100, 50, 140, 0.3); }
.xg-clan-news-item--bank { background: rgba(140, 130, 0, 0.2); }
.xg-clan-news-item--log { background: rgba(40, 80, 140, 0.2); }
.xg-clan-news-item--default { background: rgba(180, 90, 0, 0.2); }
.xg-clan-news-item time {
    color: var(--xg-muted);
    font-weight: 600;
}

/* Tables (members / diplomacy) */
.xg-clan-block {
    margin-bottom: 24px;
}
.xg-clan-table-wrap--scroll {
    max-height: 280px;
}
.xg-clan-table-wrap--scroll-sm {
    max-height: 200px;
}
.xg-clan-table .col-actions {
    text-align: right;
    white-space: nowrap;
}
.xg-clan-table .col-actions a,
.xg-clan-table .col-actions b {
    color: var(--xg-accent) !important;
    cursor: pointer;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 12px;
}
.xg-clan-table .col-actions a:hover {
    text-decoration: underline !important;
}
.xg-clan-empty {
    padding: 24px;
    text-align: center;
    color: var(--xg-muted);
    font-size: 13px;
}

/* —— Diplomacy (xgalaxy.com layout) —— */
.diplomacy-panel {
    background: linear-gradient(135deg, rgba(8, 12, 20, 0.92), rgba(15, 20, 35, 0.88));
    backdrop-filter: blur(12px);
    border: 1px solid rgba(66, 135, 245, 0.25);
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    margin: 0;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
}
.section-title--inline {
    border-bottom: none;
}
.diplomacy-header {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 100px minmax(90px, 140px) 100px;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
}
.diplomacy-list {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 16px;
}
.diplomacy-list::-webkit-scrollbar,
.requests-list::-webkit-scrollbar {
    width: 8px;
}
.diplomacy-list::-webkit-scrollbar-track,
.requests-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}
.diplomacy-list::-webkit-scrollbar-thumb,
.requests-list::-webkit-scrollbar-thumb {
    background: rgba(66, 135, 245, 0.3);
    border-radius: 4px;
}
.diplomacy-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 100px minmax(90px, 140px) 100px;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(20, 20, 20, 0.3);
    margin-bottom: 2px;
    font-size: 11px;
    transition: background 0.3s;
}
.diplomacy-row:hover {
    background: rgba(66, 135, 245, 0.1);
}
.diplomacy-row > div {
    display: flex;
    align-items: center;
}
.diplomacy-row > div:nth-child(2),
.diplomacy-row > div:nth-child(3) {
    justify-content: center;
}
.diplomacy-row > div:nth-child(4) {
    justify-content: flex-end;
}
.diplomacy-type {
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}
.diplomacy-type.alliance {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.diplomacy-type.nap {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}
.diplomacy-type.war {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.diplomacy-action {
    color: #4287f5 !important;
    cursor: pointer;
    font-size: 10px;
    text-decoration: none !important;
}
.diplomacy-action:hover {
    text-decoration: underline !important;
}
.requests-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}
.request-item {
    padding: 15px 20px;
    background: rgba(20, 20, 20, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 2px;
}
.request-header {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 100px minmax(90px, 140px) 120px;
    gap: 10px;
    align-items: center;
    font-size: 11px;
    margin-bottom: 0;
}
.request-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.request-message {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}
.request-message-title {
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    color: #fbbf24;
}
.send-request-form {
    padding: 16px 20px 22px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}
.send-request-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}
.form-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
}
.form-select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(66, 135, 245, 0.3);
    color: #fff;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    min-width: 160px;
}
.form-select option[value="1"] { color: #22c55e; }
.form-select option[value="2"] { color: #fbbf24; }
.form-select option[value="3"] { color: #ef4444; }
.send-btn {
    padding: 8px 20px;
    background: rgba(66, 135, 245, 0.3);
    border: 1px solid #4287f5;
    color: #4287f5;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}
.send-btn:hover {
    background: rgba(66, 135, 245, 0.5);
    color: #fff;
}
.xg-clan-empty--inline {
    padding: 16px 20px;
    margin: 0;
}
.form-textarea {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(66, 135, 245, 0.3);
    color: #fff;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    min-height: 100px;
    resize: vertical;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.form-textarea:focus {
    outline: none;
    border-color: #4287f5;
}
.warning-text {
    color: #ef4444;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
}
.modal-btn {
    width: 100%;
    padding: 12px;
    font-family: 'Orbitron', "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    box-sizing: border-box;
}
.modal-btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.modal-btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.5);
}
.modal-title {
    color: #4287f5 !important;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 12;
}
@media (max-width: 720px) {
    .diplomacy-header,
    .diplomacy-row,
    .request-header {
        grid-template-columns: 1fr 1fr;
    }
    .diplomacy-header > div:nth-child(3),
    .diplomacy-header > div:nth-child(4),
    .diplomacy-row > div:nth-child(3),
    .diplomacy-row > div:nth-child(4) {
        justify-content: flex-start;
    }
}

/* Clan modals (settings, news, members…) */
.clan-window,
#clan-message {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, 94vw);
    max-height: 90vh;
    overflow: auto;
    padding: 24px 28px;
    background: linear-gradient(180deg, rgba(12, 24, 40, 0.98) 0%, rgba(6, 12, 22, 0.98) 100%) !important;
    border: 1px solid var(--xg-border) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
    color: var(--xg-text);
}
.xg-clan-modal {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    margin: 0 !important;
    transform: translate(-50%, -50%) !important;
    width: min(480px, 94vw) !important;
    min-height: 240px;
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.xg-clan-modal.xg-clan-modal--result .xg-clan-modal__title {
    border-bottom-color: transparent;
}
.xg-clan-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 12;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(220, 60, 60, 0.7);
    background: rgba(140, 30, 30, 0.85);
    color: #fff !important;
    font-size: 18px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
}
.xg-clan-modal__close--danger {
    border-color: rgba(248, 113, 113, 0.8);
    background: rgba(153, 27, 27, 0.9);
}
.xg-clan-modal__title {
    margin: 0;
    padding: 18px 48px 14px 22px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--xg-accent);
    border-bottom: 1px solid rgba(0, 174, 255, 0.35);
}
.xg-clan-modal__body {
    padding: 18px 22px 22px;
}
.xg-clan-modal__body[hidden],
.xg-clan-modal__loader[hidden] {
    display: none !important;
}
.xg-clan-modal__loader {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 12, 22, 0.96);
    padding: 56px 22px 22px;
    box-sizing: border-box;
}
.xg-clan-modal__loader:not([hidden]) {
    display: flex !important;
}
.xg-clan-modal__loader-inner {
    text-align: center;
    color: var(--xg-text);
    width: 100%;
    max-width: 360px;
}
.xg-clan-modal__loader-inner span {
    display: block;
    margin: 12px 0 16px;
    font-size: 14px;
    line-height: 1.45;
}
.xg-clan-modal__loader-inner i {
    font-size: 48px;
    margin-bottom: 4px;
    color: var(--xg-accent);
}
.xg-clan-modal__loader-inner .fa-check {
    color: #4ade80;
}
.xg-clan-modal__loader-inner .fa-times {
    color: #f87171;
}
.xg-clan-modal__hint {
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--xg-muted);
    font-size: 11px;
}
.xg-clan-modal__form .xg-clan-form-row label {
    color: var(--xg-muted);
}
.xg-clan-modal__form select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--xg-text);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 174, 255, 0.35);
    cursor: pointer;
}
.xg-clan-modal__confirm {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--xg-muted);
}
.xg-clan-modal__submit--danger {
    background: linear-gradient(180deg, #c44 0%, #822 100%) !important;
    border-color: rgba(255, 100, 100, 0.5) !important;
}
.xg-clan-modal__radios {
    margin-bottom: 14px;
    font-size: 13px;
}
.xg-clan-modal__radios-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--xg-muted);
}
.xg-clan-modal__radios label {
    margin-right: 12px;
    cursor: pointer;
}
.xg-clan-modal__submit {
    width: 100%;
    margin-top: 6px;
    text-align: center;
    border: none;
}
.xg-clan-modal__submit--wide {
    padding: 13px 20px;
    font-size: 13px;
}
.xg-clan-modal__loader .xg-btn-primary {
    margin-top: 14px;
}
#infos-loader,
#infos-loader-clan,
#infos-loader-clan2 {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    left: auto !important;
    top: auto !important;
    background: transparent !important;
}

.xg-clan-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2990;
    background: rgba(0, 0, 0, 0.55);
}
.xg-clan-backdrop[hidden] {
    display: none !important;
}
.clan-window form input[type="text"],
.clan-window form textarea,
.clan-window form select,
#clan-message textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    color: var(--xg-text);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 174, 255, 0.35);
}
.clan-window .btn,
#clan-message .btn {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff !important;
    background: linear-gradient(180deg, #1a9fd4 0%, #0d6ea8 100%);
    border: 1px solid rgba(0, 200, 255, 0.5);
    cursor: pointer;
}
.clan-window .btn-danger {
    background: linear-gradient(180deg, #c44 0%, #822 100%) !important;
    border-color: rgba(255, 100, 100, 0.5) !important;
}
.clan-window > span[onclick],
#clan-message > span[onclick],
.clan-window > span[style*="cursor:pointer"]:first-of-type {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    float: none !important;
    margin: 0 !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 30px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--xg-muted) !important;
}

/* Hide old left menu if any remnant */
.page.clan .left-menu {
    display: none !important;
}

@media (max-width: 900px) {
    .xg-clan-board {
        grid-template-columns: 1fr;
    }
    .xg-clan-create {
        border-right: none;
        border-bottom: 1px solid rgba(0, 174, 255, 0.25);
    }
    .xg-clan-overview-top {
        grid-template-columns: 1fr;
    }
}

/* Challenge tab embeds clan-challenge UI */
.xg-clan-page--challenge {
  padding-bottom: 0;
  min-height: 0;
  height: 100%;
}
.xg-clan-page--challenge .cc-stage.cc-embedded {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
}
.xg-clan-page--challenge .cc-modal {
  flex: 1 1 auto;
  min-height: 0;
}
