/* =================================================================
   profile-grid.css
   Turnieje, message board, posty.
   Wymaga profile.css (zmienne CSS, font Montserrat).

   ARCHITEKTURA GRIDU:
   .trn-section        → display: grid; definiuje kolumny per wariant
   .trn-section-header → grid-column: 1 / -1
   .trn-grid-head      → display: grid; grid-template-columns: subgrid
   .trn-row            → display: grid; grid-template-columns: subgrid
   ================================================================= */

/* ================================================================
   TOURNAMENTS WRAPPER
   ================================================================ */

.tournaments-wrapper {
    width: 100%;
    height: fit-content;
    border-radius: var(--radius-card);
    background-color: var(--graphite);
    border: 1px solid var(--slate-steel);
    box-sizing: border-box;
    padding: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-card-v2);
    display: flex;
    flex-direction: column;
}

/* ================================================================
   TRN-SECTION — grid rodzic dla subgridu
   ================================================================ */

.trn-section {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    row-gap: 0;
    column-gap: 8px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(55, 57, 66, .35);
    align-items: start;
    overflow-x: auto;
    overflow-y: hidden;
}

.trn-section:first-child {
    padding-top: 0;
}

.trn-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.trn-section-header,
.trn-grid-scroll,
.trn-empty,
.cfm {
    grid-column: 1 / -1;
}

/* ── Nagłówek sekcji ─────────────────────────────────────────────── */

.trn-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.trn-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #666c7c;
}

.trn-section-title img {
    height: 13px;
    width: 13px;
    opacity: 0.35;
    flex-shrink: 0;
}

.trn-section-title-sub {
    color: #555e70;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-size: 10px;
}

.trn-count-badge {
    font-size: 12px;
    font-weight: 700;
    color: #666c7c;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(55, 57, 66, .5);
    border-radius: 10px;
    padding: 1px 8px;
    letter-spacing: 0.2px;
    flex-shrink: 0;
}

/* ================================================================
   TRN-GRID — subgrid
   ================================================================ */

.trn-grid-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    display: grid;
    row-gap:10px;
    grid-template-columns: subgrid;
}

.trn-grid {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

.trn-grid-head {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    padding: 0 8px 7px;
    gap: 8px;
    font-size: 9px;
    font-weight: 700;
    color: #3a4150;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 1px solid rgba(55, 57, 66, .4);
    margin-bottom: 2px;
    align-items: end;
}

.trn-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    padding: 9px 8px;
    gap: 8px;
    background-color: #161a1e;
    align-items: center;
    border-radius: 10px;
    border:1px solid #ffffff0f;
    transition: background-color 120ms ease;
    position: relative;
}

.trn-row::before {
    content: '';
    position: absolute;
    left: 1px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 75%;
    border-radius: 0 3px 3px 0;
}

.trn-row.tr-comp::before {
    background: var(--completed);
    box-shadow: 0 0 5px 0 var(--completed);
}


.tr-comp.fPlace{
    background:linear-gradient(to left, rgba(253, 184, 19, 0.2), #161a1e);
}

.tr-comp.sPlace {
    background: linear-gradient(to left, rgba(150, 150, 150, 0.2), #161a1e);
}

.tr-comp.tPlace{
    background:linear-gradient(to left, rgba(148, 87, 18, 0.2), #161a1e);
}

.trn-row.tr-inc::before {
    background: var(--incoming);
    box-shadow: 0 0 5px 0 var(--incoming);
}

.trn-row:last-child {
    border-bottom: none;
}

.trn-row:hover {
    background-color: rgba(255, 255, 255, .028);
}

/* ── Komórka ─────────────────────────────────────────────────────── */

.trn-cell {
    font-size: 13px;
    color: #bdc2cf;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding:0 8px;
    font-weight: 600;
}



.trn-cell a {
    color: #ccd0da;
    text-decoration: none;
    font-weight: 600;
    transition: color 100ms ease;
}

.trn-cell a:hover {
    color: #fff;
}

.trn-center {
    text-align: center;
    justify-self: center;
}

/* ── Kolumna turniejowa ───────────────────────────────────────────── */

.trn-cell--name {
    overflow: visible;
    white-space: normal;
}

.trn-name-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.trn-thumb-wrap {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--deep-steel);
}

.trn-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 300ms ease;
}

.trn-thumb-wrap img.img-loaded {
    opacity: 1;
}

.thumb-blur {
    filter: blur(6px) !important;
}

.trn-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.trn_name {
    font-size: 13px;
    font-weight: 600;
    color: #ccd0da;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 100ms ease;
}

.trn-name-link:hover .trn_name {
    color: #fff;
}

.trn_date {
    font-size: 10.5px;
    color: #4c5264;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trn-private-icon {
    height: 10px !important;
    width: 10px !important;
    opacity: 0.5;
}

/* ── Kolumna gry ─────────────────────────────────────────────────── */

.trn-cell--game {
    display: flex;
    align-items: center;
}

.trn-cell--game img {
    max-height: 18px;
    max-width: 90px;
    object-fit: contain;
    opacity: 0.85;
}

/* ── Badge miejsca ───────────────────────────────────────────────── */

.ranktd {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranktd img {
    height: 24px;
    opacity: 0.9;
}

.place-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.place-badge--1 {
    color: #e0c030;
    background: rgba(224, 192, 48, .12);
    border: 1px solid rgba(224, 192, 48, .3);
}

.place-badge--2 {
    color: #9aacbc;
    background: rgba(154, 172, 188, .1);
    border: 1px solid rgba(154, 172, 188, .25);
}

.place-badge--3 {
    color: #c07840;
    background: rgba(192, 120, 64, .1);
    border: 1px solid rgba(192, 120, 64, .25);
}

/* ── Gwiazdki ────────────────────────────────────────────────────── */

.stars-wrapper-table {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 2px 0;
}

.stars-wrapper-table svg {
    height: 13px;
}

/* ── Zwycięzca ───────────────────────────────────────────────────── */

.trn-cell.team {
    white-space: normal;
    overflow: visible;
}

.team b {
    color: #ffcf33;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 12.5px;
}

.team b img {
    height: 12px;
}

.team ul {
    list-style: none;
    padding: 2px 0 0 18px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.team li {
    font-size: 11px;
    color: #b0bcc8;
}

.team a {
    color: #b2b2b2;
    text-decoration: none;
    transition: color 100ms;
    font-weight: 600;
}

.team a:hover {
    color: #b0bcc8;
}

/* ================================================================
   WARIANTY — grid-template-columns na .trn-section
   ================================================================ */

.trn-section--player-comp {
    grid-template-columns: repeat(4, auto) 60px;
}

.trn-section--player-inc {
    grid-template-columns: repeat(5, auto);
}

.trn-section--host-inc {
    grid-template-columns: repeat(5, auto);
}

.trn-section--host-comp {
    grid-template-columns: repeat(5, auto);
}

.trn-section--board {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trn-section--player-comp .trn-grid-scroll,
.trn-section--player-inc .trn-grid-scroll,
.trn-section--host-inc .trn-grid-scroll,
.trn-section--host-comp .trn-grid-scroll {
    min-width: 520px;
}

/* ================================================================
   BRAK WYNIKÓW + LINK "VIEW ALL"
   ================================================================ */

.trn-empty {
    font-size: 12.5px;
    color: #484f60;
    padding: 4px 8px;
    margin: 0;
}

.cfm {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    color: #424857;
    font-size: 9.5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 700;
    text-decoration: none;
    margin-top: 10px;
    transition: color 150ms ease;
}

.cfm:hover {
    color: #7080a8;
}

/* ================================================================
   MESSAGE BOARD (host)
   ================================================================ */

.host-activities-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    position: relative;
}

.post-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#textarea-post {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, .03);
    border: 1px solid rgba(55, 57, 66, .6);
    resize: none;
    min-height: 72px;
    font-size: 13.5px;
    line-height: 1.6;
    border-radius: 8px;
    font-family: Montserrat, sans-serif;
    color: #ccd0da;
    transition: border-color 150ms ease;
}

#textarea-post::placeholder {
    color: #444b5a;
}

#textarea-post:focus {
    outline: none;
    border-color: rgba(100, 110, 140, .5);
    background-color: rgba(255, 255, 255, .04);
}

.post-box-actions {
    display: flex;
    justify-content: flex-end;
}

#postBtn {
    border: none;
    border-radius: 6px;
    font-family: Montserrat, sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    padding: 6px 18px;
    background-color: var(--main-green);
    color: white;
    cursor: var(--custom-pointer);
    transition: background-color 100ms ease-in-out, opacity 100ms;
    letter-spacing: 0.3px;
}

#postBtn:hover {
    background-color: var(--main-green-hover);
}

#postBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#postBtn:disabled:hover {
    background-color: var(--main-green);
}

.posts-wrapper {
    display: flex;
    flex-direction: column;
    max-height: 560px;
    overflow-y: auto;
    overflow-x: hidden;
    gap:10px;
}

  /* glass card */
  .card{
    display:flex;gap:12px;
    color:rgb(230, 230, 230);
    background:rgb(157 157 157 / 3%);
    border:1px solid rgba(255,255,255,.07);
    border-radius:12px;padding:16px;
    position:relative;overflow:hidden;
    flex-shrink: 0;
    transition:background .13s,border-color .13s;
    animation:up .22s ease both;
    margin-right: 10px;
  }
  .card:hover{
    background:rgba(255,255,255,.055);
    border-color:rgba(255,255,255,.12);
  }
  @keyframes up{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}

  /* Subtle inner glow on hover — pure CSS, no filter */
  .card::before{
    content:'';position:absolute;inset:0;border-radius:12px;
    background:radial-gradient(ellipse 60% 40% at 50% 0%, rgba(124,140,255,.06) 0%, transparent 70%);
    opacity:0;transition:opacity .2s;pointer-events:none;
  }
  .card:hover::before{opacity:1}

  /* Colored left bar for typed posts */
  .card.t1::after,.card.t2::after,.card.t3::after,.card.t4::after{
    content:'';position:absolute;left:0;top:0;bottom:0;width:2.5px;border-radius:12px 0 0 12px;
  }
  .card.t1::after{background:#4f8fff}
  .card.t2::after{background:#3ecf8e}
  .card.t3::after{background:#f59e0b}
  .card.t4::after{background:#f87171}

.card.pinned {
    border: 1px solid rgba(0, 130, 250, .4);
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(0, 130, 250, .15);
    background: linear-gradient(135deg, rgba(0, 82, 180, .1) 0%, rgba(18, 16, 14, .5) 100%);
    padding: 12px;
    margin-bottom: 4px;
}

.pinnedspan {
    position: absolute;
    top: 6px;
    right: 6px;
}

.pinnedspan img {
    height: 16px;
    opacity: 0.5;
}

.pfpbox img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: cover;
}

.post-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.post-top {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.poster {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-text {
    font-size: 13.5px;
    color: #b8bcc6;
    line-height: 1.65;
}

.post-text a {
    color: #ccd0da;
    text-decoration: none;
}

.post-text a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.posttimeago {
    font-size: 10.5px;
    color: #555e70;
}

.agm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #555e70;
    font-size: 11px;
    cursor: help;
}

.agm img {
    height: 11px;
}

.tag {
    position: absolute;
    min-height: 22px;
    min-width: 44px;
    right: -18px;
    top: -9px;
    transform: rotate(45deg);
    border-radius: 0;
}

.agp1 {
    background-color: rgba(30, 153, 214, .65);
}

.agp2 {
    background-color: rgba(0, 255, 98, .28);
}

.agp3 {
    background-color: #ffd000;
}

.agp4 {
    background-color: #ff3f3f;
}

.post-controls,
.post-controls form{
    display: flex;
    gap:5px;
}

.post-controls button{
    display:inline-flex;align-items:center;gap:5px;
    padding:4px 11px;border-radius:20px;
    border:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.03);
    font-family:'Inter',sans-serif;font-size:12px;font-weight:500;
    color:rgba(255,255,255,.35);cursor:pointer;transition:all .13s;
    font-family: Montserrat;
}

.post-controls button svg{width:13px;height:13px;transition:transform .13s}
.post-controls button:hover{border-color:rgba(255,255,255,.16);color:rgba(255,255,255,.6)}
.post-controls button:hover svg{transform:scale(1.15)}
.post-controls button.like:hover,.post-controls button.like.selected{color:#3ecf8e;border-color:rgba(62,207,142,.25);background:rgba(62,207,142,.06)}
.post-controls button.dis:hover,.post-controls button.dis.selected{color:#f87171;border-color:rgba(248,113,113,.25);background:rgba(248,113,113,.06)}


.like>span,
.dislike>span {
    color: #7080a0;
}

.post-line {
    display: none;
}

.rrev {
    opacity: 0;
    transition: opacity 100ms ease;
}


.rrev img {
    height: 11px;
}

.replyBtns img {
    height: 11px;
}

.replyBtns:hover {
    filter: invert(0);
}

.discc {
    transform: scale(1.6);
    font-size: 18px;
    color: #666d72;
    margin: 0 4px;
}

.discx {
    font-size: 38px;
    color: #555b62;
    position: absolute;
    left: -13px;
    top: -13px;
}

.discz {
    font-size: 18px;
    line-height: 11px;
}

.edit-post-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-post-wrapper textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background-color: rgba(255, 255, 255, .04);
    border: 1px solid rgba(55, 57, 66, .6);
    outline: none;
    resize: vertical;
    min-height: 50px;
    font-size: 13.5px;
    border-radius: 6px;
    font-family: Montserrat, sans-serif;
    color: #ccd0da;
}

.edit-post-wrapper textarea:focus {
    border-color: rgba(100, 110, 140, .5);
}

.editbtns {
    display: flex;
    gap: 6px;
}

.edit-post-wrapper button {
    flex: 1;
    background-color: #0076e0;
    color: white;
    font-weight: 600;
    font-size: 12px;
    padding: 6px;
    border-radius: 6px;
    border: none;
    cursor: var(--custom-pointer);
    transition: background-color 100ms;
    font-family: Montserrat, sans-serif;
}

.edit-post-wrapper button:hover {
    background-color: #1284ef;
}

.revert-btn {
    flex: 0 0 40px !important;
    background-color: rgba(200, 200, 200, .15) !important;
    display: none;
}

.revert-btn:hover {
    background-color: rgba(200, 200, 200, .25) !important;
}

/* ================================================================
   FALLBACK — przeglądarki bez subgrid
   ================================================================ */

@supports not (grid-template-columns: subgrid) {
    .trn-grid-scroll {
        display: block;
    }

    .trn-grid {
        display: flex;
        flex-direction: column;
    }

    .trn-grid-head,
    .trn-row {
        display: grid;
        gap: 8px;
    }

    .trn-section--player-comp .trn-grid-head,
    .trn-section--player-comp .trn-row {
        grid-template-columns: minmax(140px, 1fr) 110px 80px 110px 48px;
    }

    .trn-section--player-inc .trn-grid-head,
    .trn-section--player-inc .trn-row {
        grid-template-columns: minmax(140px, 1fr) 110px 80px 110px 90px;
    }

    .trn-section--host-inc .trn-grid-head,
    .trn-section--host-inc .trn-row {
        grid-template-columns: minmax(140px, 1fr) 80px 120px 56px 60px;
    }

    .trn-section--host-comp .trn-grid-head,
    .trn-section--host-comp .trn-row {
        grid-template-columns: minmax(140px, 1fr) 80px 80px 110px minmax(100px, 160px);
    }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media only screen and (max-width: 1080px) {
    .tournaments-wrapper {
        padding: 16px;
    }

    .trn-section--player-comp {
        grid-template-columns: minmax(120px, 1fr) 90px 72px 90px 44px;
    }

    .trn-section--player-inc {
        grid-template-columns: minmax(120px, 1fr) 90px 72px 90px 80px;
    }

    .trn-section--host-inc {
        grid-template-columns: minmax(120px, 1fr) 72px 100px 48px 52px;
    }

    .trn-section--host-comp {
        grid-template-columns: minmax(120px, 1fr) 72px 72px 100px minmax(90px, 140px);
    }

    @supports not (grid-template-columns: subgrid) {

        .trn-section--player-comp .trn-grid-head,
        .trn-section--player-comp .trn-row {
            grid-template-columns: minmax(120px, 1fr) 90px 72px 90px 44px;
        }

        .trn-section--player-inc .trn-grid-head,
        .trn-section--player-inc .trn-row {
            grid-template-columns: minmax(120px, 1fr) 90px 72px 90px 80px;
        }

        .trn-section--host-inc .trn-grid-head,
        .trn-section--host-inc .trn-row {
            grid-template-columns: minmax(120px, 1fr) 72px 100px 48px 52px;
        }

        .trn-section--host-comp .trn-grid-head,
        .trn-section--host-comp .trn-row {
            grid-template-columns: minmax(120px, 1fr) 72px 72px 100px minmax(90px, 140px);
        }
    }
}

@media only screen and (max-width: 700px) {
    .trn-section-title {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .trn-thumb-wrap {
        width: 32px;
        height: 32px;
    }

    .trn_name {
        font-size: 12px;
    }

    .trn_date {
        font-size: 9.5px;
    }

    .trn-cell {
        font-size: 12px;
    }

    .tournaments-wrapper {
        padding: 14px;
    }

    .trn-section {
        padding: 14px 0;
    }

    .post-text {
        font-size: 13px;
    }

    .post-controls button {
        font-size: 11px;
    }

    .post-controls {
        gap: 10px;
    }
}

@media only screen and (max-width: 460px) {
    .trn-cell--game img {
        max-height: 14px;
    }

    .ranktd img {
        height: 20px;
    }

    .trn-thumb-wrap {
        width: 28px;
        height: 28px;
    }

    .tournaments-wrapper {
        padding: 12px;
    }

    .trn-section {
        padding: 12px 0;
    }
}