/*
 * TCG Manager - Estilos Globais de Responsividade
 *
 * Breakpoints padrão (AntDesign):
 * - xs: <576px (mobile portrait)
 * - sm: >=576px (mobile landscape)
 * - md: >=768px (tablet)
 * - lg: >=992px (desktop small)
 * - xl: >=1200px (desktop)
 * - xxl: >=1600px (desktop large)
 */

/* ==========================================================================
   TCGTable - Tabela responsiva
   ========================================================================== */

.tcg-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tcg-table {
    width: 100%;
}

/* Mobile: texto menor e padding reduzido */
@media (max-width: 575px) {
    .tcg-table .ant-table-thead > tr > th,
    .tcg-table .ant-table-tbody > tr > td {
        padding: 8px 8px;
        font-size: 12px;
    }

    .tcg-table .ant-table-thead > tr > th {
        font-weight: 600;
    }

    /* Esconde colunas menos importantes em mobile */
    .tcg-table .tcg-hide-mobile {
        display: none !important;
    }
}

/* Tablet: padding moderado */
@media (min-width: 576px) and (max-width: 767px) {
    .tcg-table .ant-table-thead > tr > th,
    .tcg-table .ant-table-tbody > tr > td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tcg-table .tcg-hide-tablet {
        display: none !important;
    }
}

/* ==========================================================================
   TCGRow - Grid responsivo
   ========================================================================== */

.tcg-row {
    width: 100%;
}

/* Garante que colunas não ultrapassem 100% */
.tcg-row > .tcg-col,
.tcg-row > .ant-col {
    max-width: 100%;
}

/* ==========================================================================
   TCGCol - Coluna responsiva
   ========================================================================== */

.tcg-col {
    box-sizing: border-box;
}

/* Mobile: margem inferior padrão */
@media (max-width: 575px) {
    .tcg-col {
        margin-bottom: 12px;
    }

    .tcg-col:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================================================
   TCGStatisticCard - Card de estatísticas responsivo
   ========================================================================== */

.tcg-statistic-card {
    height: 100%;
    transition: all 0.3s ease;
}

.tcg-statistic-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.tcg-statistic-icon {
    flex-shrink: 0;
}

.tcg-statistic {
    flex: 1;
    min-width: 0;
}

.tcg-statistic-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Mobile: layout vertical para cards de estatísticas */
@media (max-width: 575px) {
    .tcg-statistic-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .tcg-statistic-card {
        min-height: 100px;
    }

    .tcg-statistic .ant-statistic-title {
        font-size: 12px;
    }

    .tcg-statistic .ant-statistic-content-value {
        font-size: 20px !important;
    }
}

/* ==========================================================================
   Utilitários de Responsividade
   ========================================================================== */

/* ==========================================================================
   AVATAR TRIGGER - Estilos globais e responsivos
   ========================================================================== */

/* Avatar trigger base styles */
.tcg-avatar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 0;
    transition: background-color 0.3s;
}

.tcg-avatar-trigger:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

.tcg-avatar-name {
    color: var(--tcg-text-primary, #201e1d);
    font-size: 14px;
}

/* Classes para ocultar em diferentes breakpoints */
@media (max-width: 768px) {
    .tcg-hide-mobile { display: none !important; }

    /* RoleSwitcher: esconde texto e seta, mostra só ícone */
    .role-switcher-trigger .role-name,
    .role-switcher-trigger .dropdown-arrow {
        display: none !important;
    }

    .role-switcher-trigger {
        padding: 4px 8px !important;
        min-width: auto !important;
    }

    /* Avatar trigger: esconde nome em mobile */
    .tcg-avatar-name {
        display: none !important;
    }

    .tcg-avatar-trigger {
        padding: 4px !important;
        gap: 0 !important;
    }
}

@media (max-width: 575px) {
    .tcg-hide-xs { display: none !important; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .tcg-hide-sm { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .tcg-hide-md { display: none !important; }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .tcg-hide-lg { display: none !important; }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .tcg-hide-xl { display: none !important; }
}

@media (min-width: 1600px) {
    .tcg-hide-xxl { display: none !important; }
}

/* Classes para mostrar apenas em breakpoints específicos */
.tcg-show-xs,
.tcg-show-sm,
.tcg-show-md,
.tcg-show-lg,
.tcg-show-xl,
.tcg-show-xxl {
    display: none !important;
}

@media (max-width: 575px) {
    .tcg-show-xs { display: block !important; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .tcg-show-sm { display: block !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .tcg-show-md { display: block !important; }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .tcg-show-lg { display: block !important; }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .tcg-show-xl { display: block !important; }
}

@media (min-width: 1600px) {
    .tcg-show-xxl { display: block !important; }
}

/* ==========================================================================
   Espaçamento Responsivo
   ========================================================================== */

/* Padding responsivo */
.tcg-p-responsive {
    padding: 24px;
}

@media (max-width: 767px) {
    .tcg-p-responsive {
        padding: 16px;
    }
}

@media (max-width: 575px) {
    .tcg-p-responsive {
        padding: 12px;
    }
}

/* Margem responsiva */
.tcg-m-responsive {
    margin: 24px;
}

@media (max-width: 767px) {
    .tcg-m-responsive {
        margin: 16px;
    }
}

@media (max-width: 575px) {
    .tcg-m-responsive {
        margin: 12px;
    }
}

/* ==========================================================================
   Tipografia Responsiva
   ========================================================================== */

.tcg-title-responsive {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 767px) {
    .tcg-title-responsive {
        font-size: 20px;
    }
}

@media (max-width: 575px) {
    .tcg-title-responsive {
        font-size: 18px;
    }
}

.tcg-subtitle-responsive {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 575px) {
    .tcg-subtitle-responsive {
        font-size: 14px;
    }
}

/* ==========================================================================
   Botões Responsivos
   ========================================================================== */

/* Botão que vira full-width em mobile */
.tcg-btn-mobile-full {
    min-width: auto;
}

@media (max-width: 575px) {
    .tcg-btn-mobile-full {
        width: 100%;
        margin-bottom: 8px;
    }

    .tcg-btn-mobile-full:last-child {
        margin-bottom: 0;
    }
}

/* Grupo de botões responsivo */
.tcg-btn-group-responsive {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 575px) {
    .tcg-btn-group-responsive {
        flex-direction: column;
    }

    .tcg-btn-group-responsive > * {
        width: 100%;
    }
}

/* ==========================================================================
   Cards Responsivos
   ========================================================================== */

.tcg-card-responsive {
    border-radius: 0;
    margin-bottom: 16px;
}

@media (max-width: 575px) {
    .tcg-card-responsive {
        margin-bottom: 12px;
        border-radius: 0;
    }

    .tcg-card-responsive .ant-card-head {
        padding: 12px 16px;
    }

    .tcg-card-responsive .ant-card-body {
        padding: 12px 16px;
    }
}

/* ==========================================================================
   Formulários Responsivos
   ========================================================================== */

.tcg-form-responsive .ant-form-item {
    margin-bottom: 16px;
}

@media (max-width: 575px) {
    .tcg-form-responsive .ant-form-item {
        margin-bottom: 12px;
    }

    .tcg-form-responsive .ant-form-item-label {
        padding-bottom: 4px;
    }

    .tcg-form-responsive .ant-form-item-label > label {
        font-size: 13px;
    }
}

/* ==========================================================================
   Modais Responsivos
   ========================================================================== */

@media (max-width: 575px) {
    .tcg-modal-responsive .ant-modal {
        max-width: calc(100vw - 32px) !important;
        margin: 16px auto;
    }

    .tcg-modal-responsive .ant-modal-body {
        padding: 16px;
    }

    .tcg-modal-responsive .ant-modal-footer {
        padding: 12px 16px;
    }
}

/* ==========================================================================
   Containers Responsivos
   ========================================================================== */

.tcg-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 767px) {
    .tcg-container {
        padding: 0 16px;
    }
}

@media (max-width: 575px) {
    .tcg-container {
        padding: 0 12px;
    }
}

/* Container fluido (sem max-width) */
.tcg-container-fluid {
    width: 100%;
    padding: 0 24px;
}

@media (max-width: 767px) {
    .tcg-container-fluid {
        padding: 0 16px;
    }
}

@media (max-width: 575px) {
    .tcg-container-fluid {
        padding: 0 12px;
    }
}

/* ==========================================================================
   Flex Utilities Responsivos
   ========================================================================== */

.tcg-flex-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

@media (max-width: 575px) {
    .tcg-flex-responsive {
        flex-direction: column;
        gap: 12px;
    }
}

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

.tcg-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 575px) {
    .tcg-flex-between-responsive {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

/* ==========================================================================
   LAYOUT E PROLAYOUT - Correções Mobile
   ========================================================================== */

/* Força o conteúdo principal a usar mais largura em mobile */
@media (max-width: 768px) {
    .ant-layout.ant-layout-has-sider > section.ant-layout {
        padding-left: 0 !important;
    }

    /* Section wrapper do layout - só quando sidebar está collapsed */
    section.ant-layout:has(+ .ant-layout-sider-collapsed),
    section.ant-layout:has(.ant-layout-sider-collapsed) {
        padding-left: 0 !important;
    }

    /* Remove padding extra do layout principal */
    .ant-layout-content {
        padding: 8px !important;
    }

    /* ProLayout: sidebar collapsed ocupa zero espaço */
    .ant-pro-sider.ant-layout-sider-collapsed,
    .ant-layout-sider.ant-layout-sider-collapsed {
        flex: 0 0 0 !important;
        max-width: 0 !important;
        min-width: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    /* Sidebar aberto: overlay por cima do conteúdo */
    .ant-pro-sider:not(.ant-layout-sider-collapsed),
    .ant-layout-sider:not(.ant-layout-sider-collapsed) {
        position: fixed !important;
        z-index: 100 !important;
        height: 100vh !important;
        left: 0 !important;
        top: 0 !important;
        border-right: 2px solid var(--tcg-ink, #201e1d) !important;
    }

    /* Conteúdo ocupa 100% da largura quando sidebar collapsed */
    .ant-pro-basicLayout-content {
        margin: 0 !important;
        margin-left: 0 !important;
        padding: 8px !important;
        width: 100% !important;
    }

    /* Container principal sem margens */
    .ant-pro-basicLayout {
        padding: 0 !important;
    }

    /* Header usa toda largura e sem padding left */
    .ant-pro-global-header,
    .ant-layout-header {
        padding: 0 8px !important;
        left: 0 !important;
        width: 100% !important;
    }

    /* ESCONDE EMAIL/NOME - mostra só avatar */
    .ant-pro-global-header .ant-dropdown-trigger > span:not(.anticon):not(.ant-avatar),
    .ant-pro-global-header .ant-space-item > span:not(.anticon),
    .avatar-dropdown-name,
    .ant-pro-global-header-avatar-dropdown .name,
    /* Seletor específico para o texto do email ao lado do avatar */
    .ant-pro-global-header .ant-space-item .ant-dropdown-trigger span[style*="color"],
    .ant-pro-global-header span[style*="viallyisrael"] {
        display: none !important;
    }

    /* Remove margins extras */
    .ant-page-header {
        padding: 8px !important;
        margin: 0 !important;
    }

    .ant-page-header-heading-title {
        font-size: 16px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .ant-page-header-heading-sub-title {
        font-size: 11px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    /* Cards e containers sem margin lateral */
    .ant-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Wrapper de conteúdo */
    .ant-pro-basicLayout-children-content-wrap {
        padding: 8px !important;
        margin: 0 !important;
    }
}

@media (max-width: 576px) {
    .ant-layout {
        padding-left: 0 !important;
        padding: 0 !important;
    }

    .ant-layout-content {
        padding: 4px !important;
    }

    .ant-pro-basicLayout-content {
        padding: 4px !important;
    }

    .ant-pro-global-header,
    .ant-layout-header {
        padding: 0 4px !important;
        padding-left: 4px !important;
    }

    .ant-page-header {
        padding: 4px !important;
    }

    .ant-page-header-heading-title {
        font-size: 14px !important;
        max-width: 140px;
    }

    .ant-page-header-heading-sub-title {
        display: none !important;
    }

    /* Esconde search e outros itens menos importantes */
    .ant-pro-global-header .action.search,
    .ant-pro-global-header .header-search {
        display: none !important;
    }

    .ant-pro-basicLayout-children-content-wrap {
        padding: 4px !important;
    }
}

/* ==========================================================================
   HEADER DROPDOWN (RoleSwitcher) - Correções Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Esconde texto do role, mostra só ícone */
    .role-switcher-trigger .role-name {
        display: none !important;
    }

    .role-switcher-trigger {
        min-width: auto !important;
        padding: 8px !important;
    }

    /* Header icons menores */
    .ant-pro-global-header .ant-space {
        gap: 8px !important;
    }

    .ant-pro-global-header .ant-space-item {
        margin-right: 0 !important;
    }

    /* Esconde elementos menos importantes no header */
    .ant-pro-global-header .action.search {
        display: none !important;
    }
}

@media (max-width: 576px) {
    /* Esconde mais itens do header em telas muito pequenas */
    .ant-pro-global-header .ant-tooltip {
        display: none !important;
    }

    .role-switcher-trigger {
        padding: 6px !important;
    }
}

/* ==========================================================================
   TABELAS E DESCRIPTIONS - Prevenir quebra de texto
   ========================================================================== */

/* Força nowrap em células de tabela e descriptions */
.ant-descriptions-item-content,
.ant-table-cell {
    word-break: keep-all !important;
}

@media (max-width: 768px) {
    /* Descriptions em mobile: layout vertical */
    .ant-descriptions-item {
        padding: 8px !important;
    }

    .ant-descriptions-item-label {
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    .ant-descriptions-item-content {
        font-size: 13px !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    /* Tabelas em mobile */
    .ant-table {
        font-size: 12px !important;
    }

    .ant-table-thead > tr > th {
        padding: 8px 4px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    .ant-table-tbody > tr > td {
        padding: 8px 4px !important;
        font-size: 12px !important;
    }

    /* Previne texto quebrado em colunas específicas */
    .ant-table-cell span[style*="white-space: nowrap"] {
        white-space: nowrap !important;
    }
}

/* ==========================================================================
   CARD GAME SELECTION GRID - Correções
   ========================================================================== */

@media (max-width: 768px) {
    /* Grid de seleção de card game */
    .card-game-grid,
    div[style*="display: grid"][style*="grid-template-columns: repeat"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Cards de seleção menores */
    .card-game-item,
    .ant-card.card-game-card {
        min-height: 120px !important;
    }

    .card-game-item .ant-card-body,
    .card-game-card .ant-card-body {
        padding: 12px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 576px) {
    /* Em telas muito pequenas, 1 coluna */
    .card-game-grid,
    div[style*="display: grid"][style*="grid-template-columns: repeat"] {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   TOURNAMENT DETAILS - Layout Responsivo
   ========================================================================== */

@media (max-width: 992px) {
    /* Grid de 2 colunas vira 1 coluna */
    .tournament-content-grid,
    div[style*="display: grid"][style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 768px) {
    /* Hero section */
    .tournament-hero {
        padding: 24px 16px !important;
        border-radius: 0 !important;
    }

    .tournament-hero div[style*="min-width: 300px"] {
        min-width: 100% !important;
    }

    .tournament-hero div[style*="min-width: 200px"] {
        min-width: 100% !important;
    }

    /* Estatísticas no hero */
    .tournament-hero .ant-statistic-content-value {
        font-size: 24px !important;
    }

    /* Tags */
    .tournament-hero .ant-tag {
        font-size: 12px !important;
        padding: 2px 8px !important;
    }
}

@media (max-width: 576px) {
    .tournament-hero {
        padding: 16px 12px !important;
        border-radius: 0 !important;
    }

    .tournament-hero h1 {
        font-size: 20px !important;
    }

    .tournament-hero .ant-statistic-content-value {
        font-size: 20px !important;
    }
}

/* ==========================================================================
   STATISTICS CARDS - Layout Responsivo
   ========================================================================== */

@media (max-width: 768px) {
    /* Cards de estatísticas */
    .ant-statistic-title {
        font-size: 12px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .ant-statistic-content {
        font-size: 20px !important;
    }

    .ant-statistic-content-value {
        font-size: 20px !important;
    }

    /* Cards dentro de Row/Col */
    .ant-card .ant-statistic {
        text-align: center;
    }
}

/* ==========================================================================
   BUTTONS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    /* Botões em grupos */
    .ant-space[style*="gap"] {
        flex-wrap: wrap !important;
    }

    /* Botões block em mobile */
    .ant-btn-block {
        margin-bottom: 8px;
    }

    /* Botões cortados */
    .ant-btn span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

@media (max-width: 576px) {
    /* Botões menores */
    .ant-btn {
        padding: 4px 12px !important;
        font-size: 13px !important;
    }

    .ant-btn-lg {
        padding: 6px 16px !important;
        font-size: 14px !important;
    }
}

/* ==========================================================================
   FORMS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    /* Labels em cima do campo */
    .ant-form-item .ant-form-item-label {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: left !important;
        padding-bottom: 4px !important;
    }

    .ant-form-item .ant-form-item-control {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .ant-form-horizontal .ant-form-item-label {
        padding: 0 0 4px 0 !important;
    }
}

/* ==========================================================================
   MODALS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    .ant-modal {
        max-width: calc(100vw - 32px) !important;
        margin: 16px auto !important;
    }

    .ant-modal-body {
        padding: 16px !important;
    }

    .ant-modal-footer {
        padding: 12px 16px !important;
    }

    .ant-modal-title {
        font-size: 16px !important;
    }
}

@media (max-width: 576px) {
    .ant-modal {
        max-width: calc(100vw - 16px) !important;
        margin: 8px auto !important;
    }

    .ant-modal-body {
        padding: 12px !important;
    }
}

/* ==========================================================================
   MANAGE TOURNAMENT PAGE - Correções Específicas
   ========================================================================== */

@media (max-width: 768px) {
    /* Botões de ação do torneio */
    .tournament-actions .ant-btn,
    .ant-card-body .ant-btn {
        font-size: 12px !important;
        padding: 4px 8px !important;
    }

    /* Info cards do torneio */
    .tournament-info-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 576px) {
    .tournament-info-grid {
        grid-template-columns: 1fr !important;
    }

    /* Esconde ícones em botões pequenos */
    .ant-btn .anticon + span {
        margin-left: 4px !important;
    }
}

/* ==========================================================================
   TIMELINE E LISTS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    .ant-timeline-item {
        padding-bottom: 12px !important;
    }

    .ant-timeline-item-content {
        font-size: 13px !important;
    }

    .ant-list-item {
        padding: 12px 0 !important;
    }
}

/* ==========================================================================
   TABS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    .ant-tabs-nav {
        margin-bottom: 12px !important;
    }

    .ant-tabs-tab {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* Tabs scrolláveis */
    .ant-tabs-nav-list {
        flex-wrap: nowrap !important;
    }

    .ant-tabs-nav-wrap {
        overflow-x: auto !important;
    }
}

/* ==========================================================================
   ALERTS - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    .ant-alert {
        padding: 8px 12px !important;
    }

    .ant-alert-message {
        font-size: 13px !important;
    }

    .ant-alert-description {
        font-size: 12px !important;
    }
}

/* ==========================================================================
   BREADCRUMB - Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    .ant-breadcrumb {
        font-size: 12px !important;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .ant-breadcrumb-link {
        white-space: nowrap;
    }

    /* PageContainer breadcrumb */
    .ant-page-container .ant-breadcrumb,
    .ant-pro-page-container .ant-breadcrumb {
        font-size: 12px !important;
    }
}

@media (max-width: 576px) {
    .ant-breadcrumb {
        font-size: 11px !important;
    }

    /* Esconde Home breadcrumb em telas muito pequenas para economizar espaço */
    .ant-breadcrumb > span:first-child,
    .ant-breadcrumb-item:first-child {
        display: none !important;
    }

    /* Mostra separador corretamente */
    .ant-breadcrumb-separator {
        margin: 0 4px !important;
    }
}

