/*
  company-mobile.css — Mobile responsiveness for company pages
  Author: toxadab · Date: 2026-03-05
  Fixes: tabs, header block, cards, text readability on mobile
*/

/* ===== TABS wrapper ===== */
.tb-tabs-wrapper {
  margin-top: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .tb-tabs-wrapper {
    margin-top: 1rem;
  }
}

.tb-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0;
  margin-bottom: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.tb-tab-btn {
  appearance: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  width: 50%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .tb-tab-btn {
    width: 50%;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
  }
  
  .tb-tabs {
    gap: 0.25rem;
  }
}

.tb-tab-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.tb-tab-btn.active {
  background: var(--accent);
  color: var(--text-primary);
  border-color: rgba(79,124,255,0.4);
  box-shadow: 0 4px 12px rgba(79,124,255,0.3);
}

.tb-tab-content {
  display: none;
  animation: tbFadeIn 0.3s ease;
}

.tb-tab-content.active {
  display: block;
}

@keyframes tbFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ===== Header block ===== */
/* Стили теперь в show.html.twig для точного контроля */

/* ===== Company page sections ===== */
.company-page {
  margin-top: 1.5rem;
}

.company-card {
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .company-card {
    padding: 1.5rem;
  }
}

/* Company name inside card */
.company-card .company-name {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  word-break: break-word;
}

@media (min-width: 480px) {
  .company-card .company-name {
    font-size: 1.35rem;
  }
}

@media (min-width: 768px) {
  .company-card .company-name {
    font-size: 1.5rem;
  }
}

/* ===== Company full description (overrides inner styles) ===== */
.company-full-desc {
  color: var(--text-primary);
  line-height: 1.7;
}

/* Убираем стили внутреннего .wrap контейнера */
.company-full-desc .wrap,
.company-full-desc > .wrap {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: visible !important;
}

/* Адаптируем внутреннюю .header секцию */
.company-full-desc .header {
  padding: 1rem !important;
  margin-bottom: 1rem !important;
}

@media (min-width: 640px) {
  .company-full-desc .header {
    padding: 1.25rem !important;
  }
}

/* Чипсы в одну строку с переносом */
.company-full-desc .chips {
  gap: 0.4rem !important;
  margin-bottom: 1rem !important;
}

.company-full-desc .chip {
  font-size: 0.7rem !important;
  padding: 0.35rem 0.6rem !important;
}

@media (min-width: 480px) {
  .company-full-desc .chip {
    font-size: 0.75rem !important;
  }
}

/* Verdict grid - адаптивный */
.company-full-desc .verdict-grid {
  gap: 1rem !important;
}

@media (min-width: 900px) {
  .company-full-desc .verdict-grid {
    grid-template-columns: 1fr 320px !important;
  }
}

/* Заголовки внутри контента */
.company-full-desc h1 {
  font-size: 1.2rem !important;
  margin-bottom: 0.75rem !important;
}

@media (min-width: 480px) {
  .company-full-desc h1 {
    font-size: 1.35rem !important;
  }
}

.company-full-desc h2 {
  font-size: 1.05rem !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.75rem !important;
}

@media (min-width: 480px) {
  .company-full-desc h2 {
    font-size: 1.15rem !important;
  }
}

/* KPI box - адаптивный */
.company-full-desc .kpi-box {
  padding: 1rem !important;
}

.company-full-desc .kpi-grid {
  grid-template-columns: 1fr !important;
  gap: 0.75rem !important;
  font-size: 0.85rem !important;
}

@media (min-width: 480px) {
  .company-full-desc .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Score bar */
.company-full-desc .scorebar {
  height: 10px !important;
}

/* Карточки внутри контента */
.company-full-desc .card {
  padding: 1rem !important;
  margin-top: 1rem !important;
}

@media (min-width: 480px) {
  .company-full-desc .card {
    padding: 1.25rem !important;
  }
}

/* Таблицы - горизонтальный скролл */
.company-full-desc .table-wrap {
  border-radius: 0.75rem !important;
  margin: 1rem 0 !important;
}

.company-full-desc table {
  font-size: 0.8rem !important;
  min-width: 100% !important;
}

@media (min-width: 480px) {
  .company-full-desc table {
    font-size: 0.85rem !important;
  }
}

.company-full-desc th,
.company-full-desc td {
  padding: 0.6rem 0.75rem !important;
}

/* Grid-2 внутри контента */
.company-full-desc .grid-2 {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

@media (min-width: 768px) {
  .company-full-desc .grid-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Timeline */
.company-full-desc .timeline {
  gap: 1rem !important;
  font-size: 0.85rem !important;
}

.company-full-desc .tl-item {
  padding-left: 1rem !important;
}

.company-full-desc .tl-item::before {
  width: 8px !important;
  height: 8px !important;
  left: -5px !important;
}

/* Chart cards */
.company-full-desc .chart-card {
  padding: 1rem !important;
  margin: 1rem 0 !important;
}

.company-full-desc .chart-card canvas {
  height: 200px !important;
}

@media (min-width: 480px) {
  .company-full-desc .chart-card canvas {
    height: 250px !important;
  }
}

/* Заметки */
.company-full-desc .note {
  font-size: 0.75rem !important;
  margin-top: 0.75rem !important;
}

@media (min-width: 480px) {
  .company-full-desc .note {
    font-size: 0.8rem !important;
  }
}

/* Paragraphs и текст */
.company-full-desc p {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (min-width: 480px) {
  .company-full-desc p {
    font-size: 0.95rem;
  }
}

.company-full-desc ul,
.company-full-desc ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.company-full-desc li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* ===== Description block ===== */
.desc-block {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: rgba(255,255,255,0.02);
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.04);
}

.desc-head {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.desc-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ===== Categories block ===== */
.categories-block {
  margin-top: 1.25rem;
}

.block-head {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.cat-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cat-chip {
  display: inline-block;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.2s ease;
}

.cat-chip:hover {
  background: rgba(79,124,255,0.15);
  border-color: rgba(79,124,255,0.4);
  color: #7dd3fc;
}

/* ===== Meta grid ===== */
.meta-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

@media (min-width: 480px) {
  .meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.meta-item {
  background: rgba(255,255,255,0.02);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255,255,255,0.04);
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-word;
}

/* ===== Analytics cards ===== */
.company-analytics-card {
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .company-analytics-card {
    padding: 1.5rem;
  }
}

.analytics-head-row {
  margin-bottom: 1.25rem;
}

.analytics-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* Analytics KPI grid */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

/* Analytics 2-col grids */
.analytics-grid-2 {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .analytics-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.analytics-box {
  background: rgba(255,255,255,0.02);
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.04);
  padding: 1rem;
}

.analytics-box-head {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.analytics-donut-wrap {
  display: grid;
  gap: 1rem;
  align-items: center;
}

@media (min-width: 480px) {
  .analytics-donut-wrap {
    grid-template-columns: 1fr auto;
  }
}

.analytics-donut {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.analytics-legend {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.analytics-bars {
  display: grid;
  gap: 0.75rem;
}

.analytics-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.analytics-list li {
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border-radius: 0.5rem;
  border-left: 3px solid var(--accent);
}

.analytics-hint-block {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 1rem;
  padding: 1rem;
  margin-top: 1rem;
}

.analytics-hint-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 0.5rem;
}

.analytics-hint-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.analytics-hint-list li {
  margin-bottom: 0.4rem;
}

/* ===== Company about section ===== */
.company-about {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.section-headline {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.company-short {
  color: var(--text-muted, #aaa);
  line-height: 1.6;
}

/* ===== Account blocks (reviews tab) ===== */
.account-block {
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .account-block {
    padding: 1.5rem;
  }
}

.account-block .block-subtitle {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Dashboard summary stats - адаптация под мобилку */
.dashboard-summary {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.75rem !important;
}

@media (min-width: 480px) {
  .dashboard-summary {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

.dash-stat {
  text-align: center;
  padding: 0.75rem !important;
}

.dash-stat > div:first-child {
  font-size: 0.7rem !important;
}

.dash-stat > div:nth-child(2) {
  font-size: 1.25rem !important;
}

.dash-stat > div:last-child {
  font-size: 0.6rem !important;
}

/* Widgets grid - на мобилке в 1 колонку */
.widgets-grid {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 1rem;
}

@media (min-width: 640px) {
  .widgets-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* KPI виджеты - адаптация */
.tb-company-kpis-widget {
  padding: 1rem !important;
}

.tb-company-kpis-title {
  font-size: 0.9rem !important;
  margin-bottom: 0.5rem !important;
}

.tb-company-kpis-sub {
  font-size: 0.7rem !important;
  display: block;
  margin-top: 0.25rem !important;
}

.tb-kpi {
  margin-bottom: 1rem !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}

.tb-kpi:last-child {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.tb-kpi-label {
  font-size: 0.75rem !important;
  margin-bottom: 0.4rem !important;
}

.tb-kpi-value {
  font-size: 1.25rem !important;
  margin-bottom: 0.4rem !important;
}

.tb-kpi-note {
  font-size: 0.7rem !important;
  line-height: 1.4 !important;
}

/* ===== Charts grid - на мобилке в 1 колонку ===== */
.tb-charts-grid {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 1rem;
}

@media (min-width: 900px) {
  .tb-charts-grid {
    grid-template-columns: 70% 30%;
  }
}

.tb-charts-card {
  padding: 1rem !important;
}

.tb-charts-title {
  font-size: 0.85rem !important;
}

.tb-chart-canvas-wrap {
  height: 220px !important;
}

@media (min-width: 480px) {
  .tb-chart-canvas-wrap {
    height: 280px !important;
  }
}

/* ===== Modal ===== */
.tb-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.tb-modal[aria-hidden="false"] {
  display: flex;
}

.tb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.tb-modal__panel {
  position: relative;
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 1.5rem;
  max-width: 90%;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: tbModalSlide 0.3s ease;
}

@media (min-width: 640px) {
  .tb-modal__panel {
    max-width: 500px;
    padding: 2rem;
  }
}

@keyframes tbModalSlide {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.tb-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  appearance: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.tb-modal__close:hover {
  color: var(--text-primary);
}

.tb-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  padding-right: 2rem;
}

.tb-modal__content {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.tb-modal__content p {
  margin-bottom: 0.75rem;
}

.tb-modal__content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.tb-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .tb-modal__actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.tb-btn {
  appearance: none;
  display: inline-block;
  background: var(--accent);
  color: var(--text-primary);
  border: 1px solid rgba(79,124,255,0.4);
  border-radius: 0.75rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tb-btn:hover {
  filter: brightness(1.1);
}

.tb-btn--ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.12);
}

.tb-btn--ghost:hover {
  background: rgba(255,255,255,0.08);
}

/* ===== Responsive adjustments for small screens ===== */
@media (max-width: 480px) {
  /* Increase base font size for readability */
  .company-card,
  .account-block,
  .company-analytics-card {
    padding: 1rem;
  }

  /* Make company name slightly smaller on very small screens */
  .company-name {
    font-size: 1.25rem;
  }

  /* Adjust logo size */
  .company-logo-big__img {
    width: 80px;
    height: 80px;
  }

  /* Stack KPI grid in single column */
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }

  /* Ensure charts are readable */
  .tb-chart-canvas-wrap {
    height: 220px;
  }

  /* Make modal actions full width */
  .tb-btn {
    width: 100%;
  }

  /* Adjust header block padding */
  .header-block {
    padding: 1rem;
  }
}

/* ===== Utility classes ===== */
.prose-block {
  color: var(--text-primary);
  line-height: 1.7;
}

.prose-block p {
  margin-bottom: 1rem;
}

.prose-block h1,
.prose-block h2,
.prose-block h3,
.prose-block h4,
.prose-block h5,
.prose-block h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.prose-block h1 { font-size: 1.4rem; }
.prose-block h2 { font-size: 1.25rem; }
.prose-block h3 { font-size: 1.1rem; }

.prose-block ul,
.prose-block ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.prose-block li {
  margin-bottom: 0.5rem;
}

.prose-block a {
  color: #7dd3fc;
  text-decoration: underline;
}

.prose-block a:hover {
  color: #bae6fd;
}

.prose-block code {
  background: rgba(255,255,255,0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.prose-block pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.prose-block pre code {
  background: transparent;
  padding: 0;
}

.prose-block blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-dim);
  font-style: italic;
}

.prose-block img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* ===== Print styles ===== */
@media print {
  .tb-tabs,
  .tb-modal,
  header.site-header,
  footer.site-footer {
    display: none !important;
  }

  .tb-tab-content {
    display: block !important;
  }

  body {
    background: white;
    color: black;
  }

  .company-card,
  .account-block {
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}


@media (max-width: 932px) {
    .header-block .company-name {
        position: absolute;
        left: 25px;
        margin-top: -110px!important;
    }
    .header-block .header-info {
        margin-top: 40px!important;
    }
}
