/* =========================================================
   TakeIQTest – Profile extras (dark cards + mobile-safe tables)
   ========================================================= */

/* --- ROOT (profil) --- */
.tqe-profile-extras,
#tqe-profile,
.tqe-profile{
  /* dark-on-card palette */
  --card-bg-1:    #0f172a;
  --card-bg-2:    #0b1423;
  --card-text:    #eaf2ff;
  --card-muted:   #9fb4cb;
  --card-border:  rgba(255,255,255,.14);
  --card-shadow:  0 14px 36px rgba(2,6,23,.45);
  --card-radius:  18px;

  --chip-bg:      rgba(255,255,255,.06);
  --chip-br:      rgba(255,255,255,.22);
  --accent:       #4da3ff;

  isolation: isolate;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;      /* cała sekcja nigdy nie rozszerza body */
  padding-inline: 0;
}

/* na mobile body bywa „rozpychane” przez sticky/border – zapobiegamy */
@media (max-width: 768px){
  body{ overflow-x: hidden; }
}

/* --- Nagłówki sekcji (poza kartami) --- */
.tqe-profile-extras h3,
#tqe-profile h3,
.tqe-profile h3{ font-size: 24px; font-weight: 800; letter-spacing:.2px; margin: 0 0 8px; color:#0b1120; }
.tqe-profile-extras .tqe-practice-hint,
#tqe-profile .tqe-practice-hint{ color:#6b7280; margin:4px 0 10px; }

/* =========================================================
   KAFLE (ciemne), identyczny styl dla sekcji kategorii i kart
   ========================================================= */
.tqe-cat-section,
.tqe-card{
  background: linear-gradient(180deg, var(--card-bg-1), var(--card-bg-2));
  color: var(--card-text);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 16px 18px;
  max-width: 100%;
  overflow: hidden;
margin-bottom: 31px;
}

.tqe-cat-title,
.tqe-card-title{
  color: var(--card-text);
  margin: 6px 0 12px;
  font-size: 22px; font-weight: 900;
}

/* chipy/przełączniki w kaflu */
.tqe-level-switcher,
.tqe-toggle{ display:flex; gap:8px; flex-wrap:wrap; margin: 6px 0 10px; }

.tqe-level-btn,
.tqe-toggle-btn{
  appearance:none; cursor:pointer;
  background: var(--chip-bg);
  color: var(--card-text);
  border:1px solid var(--chip-br);
  border-radius: 999px;
  padding: 6px 12px; font-weight: 800; line-height:1;
  transition: filter .15s, transform .05s, background .2s, border-color .2s;
  white-space: nowrap;
}
.tqe-level-btn:hover, .tqe-toggle-btn:hover{ filter: brightness(1.06); }
.tqe-level-btn.active, .tqe-toggle-btn.active{
  background: var(--accent); border-color: var(--accent); color:#00152b;
}

/* drobne teksty w kaflu */
.tqe-record-info, .tqe-cta-msg, .tqe-mini-cell small{ color: var(--card-muted); }

/* =========================================================
   WYKRES – 100% szerokości kafla, bez rozpychania
   ========================================================= */
.tqe-chart-wrap{
  position: relative;
  height: 380px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  max-width: 100%;
  overflow: hidden;
  contain: layout paint;         /* izolacja layoutu – zero h-scrolla */
}
.tqe-chart-wrap canvas{
  display:block;
  width:100% !important;
  max-width:100% !important;
  height:auto !important;
}

/* =========================================================
   TABELA – scroll tylko wewnątrz; szerokość = karty
   Obsługujemy 2 warianty markupu:
   A) <div class="tqe-history__table"><table>...</table></div>
   B) <table class="tqe-history__table">...</table>
   ========================================================= */

/* --- Wrapper DIV (wariant A) --- */
.tqe-history__table,
.tqe-overall-table{
  background: linear-gradient(180deg, var(--card-bg-1), var(--card-bg-2));
  color: var(--card-text);
  border:1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 0;
  max-width: 100%;
  overflow: hidden;              /* trzyma zaokrąglenie */
}

/* właściwa tabela w środku wrappera */
.tqe-history__table > table,
.tqe-overall-table > table{
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  table-layout: fixed;           /* komórki się zawijają, nie rozpychają */
  color: var(--card-text);
}

/* Na mobile – horyzontalny scroll TYLKO wewnątrz wrappera */
@media (max-width: 700px){
  .tqe-history__table,
  .tqe-overall-table{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tqe-history__table > table,
  .tqe-overall-table > table{
    min-width: 560px;            /* nie schodzimy poniżej czytelnego minimum */
    table-layout: auto;          /* naturalne kolumny */
  }
}

/* --- Fallback: klasa bezpośrednio na <table> (wariant B) --- */
table.tqe-history__table,
table.tqe-overall-table{
  width: 100%;
  background: linear-gradient(180deg, var(--card-bg-1), var(--card-bg-2));
  color: var(--card-text);
  border:1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  border-collapse: separate; border-spacing:0;
  table-layout: fixed;
overflow-x: scroll;
}
@media (max-width: 700px){
  table.tqe-history__table,
  table.tqe-overall-table{
    display: block;              /* tworzymy viewport */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 560px;
  }
  table.tqe-history__table thead,
  table.tqe-history__table tbody,
  table.tqe-overall-table thead,
  table.tqe-overall-table tbody{
    display: table; width:100%; table-layout: fixed;
  }
}

/* Headery/komórki – ciemny styl + sticky header */
.tqe-history__table thead th,
.tqe-overall-table thead th,
table.tqe-history__table thead th,
table.tqe-overall-table thead th{
  position: sticky; top: 0; z-index: 1;
  background: rgba(255,255,255,.06);
  color: var(--card-text);
  font-weight: 900; text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;           /* daty/nagłówki w 1 linii */
}

.tqe-history__table tbody td,
.tqe-overall-table tbody td,
table.tqe-history__table tbody td,
table.tqe-overall-table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--card-text);
  word-break: break-word; overflow-wrap: anywhere;
  white-space: nowrap;           /* liczby czytelnie */
}
.tqe-history__table tbody tr:nth-child(odd),
.tqe-overall-table tbody tr:nth-child(odd),
table.tqe-history__table tbody tr:nth-child(odd),
table.tqe-overall-table tbody tr:nth-child(odd){
  background: rgba(255,255,255,.025);
}

/* „pusta” informacja */
.tqe-history__table .tqe-empty-row td,
.tqe-overall-table .tqe-empty-row td{ color: var(--card-muted); text-align:center; }

/* =========================================================
   Drobne bloki w kaflu (mini chart / statsy)
   ========================================================= */
.tqe-mini-chart-wrap{
  position: relative; min-height: 240px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid var(--card-border);
  overflow: hidden; max-width: 100%; contain: layout paint;
}
.tqe-mini-chart-wrap canvas{
  display:block; width:100% !important; max-width:100% !important; height:auto !important;
}
.tqe-mini-table{ margin-top: 10px; }
.tqe-mini-row{ display:flex; gap: 16px; flex-wrap:wrap; }
.tqe-mini-cell{ font-weight:800; color: var(--card-text); }
.tqe-mini-cell small{ color: var(--card-muted); }

/* =========================================================
   Spacing sekcji + grid kart
   ========================================================= */
.tqe-cards{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:18px; align-items:stretch; margin-bottom:12px; }
@media (max-width: 900px){ .tqe-cards{ grid-template-columns: 1fr; } }

.tqe-section{ margin-top: 14px; }

/* ====== MOBILE TABLE: szerzej + swipe w obrębie tabeli ====== */
@media (max-width: 780px){
  /* WARIANT A: wrapper DIV jest scroll-containerem */
  .tqe-profile-extras .tqe-history__table,
  .tqe-profile-extras .tqe-overall-table{
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
  }
  .tqe-profile-extras .tqe-history__table > table,
  .tqe-profile-extras .tqe-overall-table > table{
    /* ZWIĘKSZAMY realną szerokość treści, by była czytelna */
    min-width: 740px;               /* było 560px – możesz podnieść do 800-860 */
    width: auto;                    /* pozwala min-width zadziałać */
    table-layout: auto;             /* naturalne kolumny */
    font-size: 16px;
  }

  /* WARIANT B: klasa bezpośrednio na <table> – sama tabela jest scroll-containerem */
  .tqe-profile-extras table.tqe-history__table,
  .tqe-profile-extras table.tqe-overall-table{
    display: block !important;      /* własny viewport */
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;

    width: auto !important;         /* KLUCZ: nie 100%, żeby min-width mogło rozszerzyć */
    min-width: 740px;               /* jak wyżej */
    table-layout: auto;
    font-size: 16px;
  }

  /* Czytelniejsze komórki na mobile */
  .tqe-profile-extras .tqe-history__table thead th,
  .tqe-profile-extras .tqe-overall-table thead th,
  .tqe-profile-extras table.tqe-history__table thead th,
  .tqe-profile-extras table.tqe-overall-table thead th{
    font-size: 15px;
    padding: 12px 14px;
    white-space: nowrap;
  }
  .tqe-profile-extras .tqe-history__table tbody td,
  .tqe-profile-extras .tqe-overall-table tbody td,
  .tqe-profile-extras table.tqe-history__table tbody td,
  .tqe-profile-extras table.tqe-overall-table tbody td{
    font-size: 16px;
    padding: 12px 14px;
    white-space: nowrap;            /* daty/liczby w jednej linii */
  }

  /* Delikatna podpowiedź, że można przesuwać (cieniuśki „glow” po prawej) */
  .tqe-profile-extras .tqe-history__table,
  .tqe-profile-extras .tqe-overall-table,
  .tqe-profile-extras table.tqe-history__table,
  .tqe-profile-extras table.tqe-overall-table{
    background-clip: padding-box;
    position: relative;
  }
  .tqe-profile-extras .tqe-history__table::after,
  .tqe-profile-extras .tqe-overall-table::after,
  .tqe-profile-extras table.tqe-history__table::after,
  .tqe-profile-extras table.tqe-overall-table::after{
    content:"";
    position:absolute; top:0; right:0; bottom:0; width:10px;
    pointer-events:none;
    background: linear-gradient(to right, transparent, rgba(0,0,0,.25));
    opacity:.25;
  }
}

/* ===== MOBILE TABLE: szerzej + pewny swipe ===== */
@media (max-width: 780px){
  /* WARIANT A – wrapper DIV jest scrollerem */
  .tqe-profile-extras .tqe-history__table,
  .tqe-profile-extras .tqe-overall-table{
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;          /* iOS/Safari: pozwól na poziomy gest */
    overscroll-behavior-x: contain;
    scrollbar-width: thin;              /* FF */
    -webkit-mask-image: -webkit-radial-gradient(white, black); /* iOS glitch fix */
  }
  .tqe-profile-extras .tqe-history__table > table,
  .tqe-profile-extras .tqe-overall-table > table{
    /* szerzej = czytelniej; podbij jeśli chcesz (np. 800-880px) */
    min-width: 760px;
    width: auto;                        /* nie przyklejaj do 100% wrappera */
    table-layout: auto;
    font-size: 16px;
  }

  /* WARIANT B – klasa bezpośrednio na <table> */
  .tqe-profile-extras table.tqe-history__table,
  .tqe-profile-extras table.tqe-overall-table{
    display: block !important;          /* własny viewport */
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;

    width: auto !important;             /* klucz: pozwól wyjść poza kartę wewnątrz scroller-a */
    min-width: 760px;                   /* podbijaj, jeśli chcesz szerzej */
    table-layout: auto;
    font-size: 16px;
  }

  /* zapobiegamy „łapaniu” zaznaczenia podczas przesuwania na iOS */
  .tqe-profile-extras .tqe-history__table *,
  .tqe-profile-extras .tqe-overall-table *,
  .tqe-profile-extras table.tqe-history__table *,
  .tqe-profile-extras table.tqe-overall-table *{
    -webkit-user-select: none;
    user-select: none;
  }

  /* czytelniejsze odstępy */
  .tqe-profile-extras .tqe-history__table thead th,
  .tqe-profile-extras .tqe-overall-table thead th,
  .tqe-profile-extras table.tqe-history__table thead th,
  .tqe-profile-extras table.tqe-overall-table thead th{
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 15px;
  }
  .tqe-profile-extras .tqe-history__table tbody td,
  .tqe-profile-extras .tqe-overall-table tbody td,
  .tqe-profile-extras table.tqe-history__table tbody td,
  .tqe-profile-extras table.tqe-overall-table tbody td{
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 16px;
  }

  /* delikatna wskazówka „można przewinąć” (fade po prawej) */
  .tqe-profile-extras .tqe-history__table,
  .tqe-profile-extras .tqe-overall-table,
  .tqe-profile-extras table.tqe-history__table,
  .tqe-profile-extras table.tqe-overall-table{
    position: relative;
  }
  .tqe-profile-extras .tqe-history__table::after,
  .tqe-profile-extras .tqe-overall-table::after,
  .tqe-profile-extras table.tqe-history__table::after,
  .tqe-profile-extras table.tqe-overall-table::after{
    content:"";
    position:absolute; top:0; right:0; bottom:0; width:14px;
    pointer-events:none;
    background: linear-gradient(to right, transparent, rgba(0,0,0,.22));
  }

  /* estetyka: kursor „grab” na urządzeniach z myszką */
  @media (hover: hover){
    .tqe-profile-extras .tqe-history__table,
    .tqe-profile-extras .tqe-overall-table,
    .tqe-profile-extras table.tqe-history__table,
    .tqe-profile-extras table.tqe-overall-table{
      cursor: grab;
    }
    .tqe-profile-extras .is-grabbing{ cursor: grabbing; }
  }
}

.tqe-history {
overflow-x: scroll;
}

/* CTA pod wykresem + przycisk "Ćwicz" */
.tqe-cat-section .tqe-cta{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-top:12px; padding:12px 14px;
  border-radius:12px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.08);
}

.tqe-cat-section .tqe-cta-msg{
  font-size:14px; line-height:1.3; opacity:.9;
}

/* przycisk */
.tqe-cat-section .tqe-cta-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:999px;
  font-weight:700; text-decoration:none; letter-spacing:.2px;
  color:#fff;
  background: linear-gradient(180deg, #4da3ff, #1f6fff);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 6px 16px rgba(77,163,255,.35), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
  white-space: nowrap;
}
.tqe-cat-section .tqe-cta-btn::after{
  content: "→"; font-weight: 700; transform: translateX(0);
  transition: transform .15s ease;
}
.tqe-cat-section .tqe-cta-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(77,163,255,.45), inset 0 1px 0 rgba(255,255,255,.25);
}
.tqe-cat-section .tqe-cta-btn:hover::after{ transform: translateX(2px); }
.tqe-cat-section .tqe-cta-btn:active{ transform: translateY(0); }
.tqe-cat-section .tqe-cta-btn:focus-visible{
  outline: 2px solid #9ccaff; outline-offset: 2px;
}

/* mobile – pełna szerokość */
@media (max-width: 640px){
  .tqe-cat-section .tqe-cta{ flex-direction: column; align-items: stretch; }
  .tqe-cat-section .tqe-cta-btn{ width: 100%; }
}

/* redukcja animacji, jeśli użytkownik nie chce */
@media (prefers-reduced-motion: reduce){
  .tqe-cat-section .tqe-cta-btn,
  .tqe-cat-section .tqe-cta-btn::after{ transition: none !important; }
}

.tqe-level-btn{
  display:inline-flex; align-items:center; gap:8px;
  position:relative; /* miejsce na ikonę po prawej */
}


/* PROFILE (MAIN): sekcje z wykresami na ciemnym tle */
#tqe-profile-main .tqe-overall-progress,
#tqe-profile-main .tqe-progress{
  /* ten selektor dotyczy TYLKO profilu – nie ruszy paska postępu w teście */
  background: linear-gradient(180deg, var(--card-bg-1), var(--card-bg-2));
  color: var(--card-text);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 14px 14px 16px;
  margin-bottom: 22px;        /* << odstęp od następnej sekcji (np. Historia) */
}

/* Tytuł sekcji wykresu */
#tqe-profile-main .tqe-overall-progress h3,
#tqe-profile-main .tqe-progress .tqe-progress__title{
  color: var(--card-text);
  margin: 6px 0 12px;
}

/* Sam „kafelek” z płótnem ma już delikatny gradient – doprecyzujmy ramkę */
#tqe-profile-main .tqe-chart-wrap{
  border-color: var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

/* Karta CTA na dole profilu */
#tqe-profile-main .tqe-cta{
  background: var(--your-dark-blue, #0b1b3a);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 18px;
  margin-top: 22px;   /* odstęp od poprzedniej sekcji */
  text-align: center;
}

#tqe-profile-main .tqe-cta .tqe-btn{
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  transition: transform .15s ease, filter .15s ease;
}

#tqe-profile-main .tqe-cta .tqe-btn-primary{
  background: linear-gradient(180deg, #2a5bff, #1c3fbf);
  color: #fff;
}

#tqe-profile-main .tqe-cta .tqe-btn-primary:hover{
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* Karta z CTA w profilu */
#tqe-profile-main .tqe-main-cta{
  background: var(--your-dark-blue, #0b1b3a);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 18px;
  margin-top: 22px;
  text-align: center;
}

/* === BAZOWY wygląd identyczny jak w Practice ===
   (grupujemy z practice, aby zachować ten sam look & feel) */
.tqe-cat-section .tqe-cta-btn,
#tqe-profile-main .tqe-main-cta-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: .2px;
  text-decoration: none;
  line-height: 1.1;
  border: 1px solid rgba(255,255,255,.10);

  /* gradient + cień jak w practice (z możliwością nadpisania) */
  --btn-bg-1: #2a5bff;
  --btn-bg-2: #1c3fbf;
  --btn-text: #fff;
  --btn-shadow: 0 12px 28px rgba(32, 78, 255, .35);
  --btn-shadow-hover: 0 14px 32px rgba(32, 78, 255, .45);

  background: linear-gradient(180deg, var(--btn-bg-1), var(--btn-bg-2));
  color: var(--btn-text);
  box-shadow: var(--btn-shadow);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.tqe-cat-section .tqe-cta-btn:hover,
#tqe-profile-main .tqe-main-cta-btn:hover{
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--btn-shadow-hover);
}

.tqe-cat-section .tqe-cta-btn:active,
#tqe-profile-main .tqe-main-cta-btn:active{
  transform: translateY(0);
  filter: brightness(.98);
}

.tqe-cat-section .tqe-cta-btn:focus-visible,
#tqe-profile-main .tqe-main-cta-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.18), var(--btn-shadow);
}

@media (max-width: 640px){
  #tqe-profile-main .tqe-main-cta-btn{ width: 100%; }
}

.tqe-table .tqe-overall-table {
overflow-x: scroll;
}

.tqe-card-points {
font-size:36px;
line-height: 44px
font-weight: 800;
}

/* Więcej miejsca dla daty/godziny */
.tqe-overall-table th:first-child,
.tqe-overall-table td:first-child { width: 23%; padding-right: 12px; white-space: nowrap; }

/* Horyzontalny scroll na wąskich ekranach */
@media (max-width: 640px) {
  .tqe-table-hscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tqe-table-hscroll > table { min-width: 700px; }
  .tqe-overall-table th, .tqe-overall-table td { white-space: nowrap; }
}