/* =========================================
   Arquivo: filex/css/minhas-assinaturas.css
   XONA — MINHAS ASSINATURAS
   Requer main.css carregado antes.
   ========================================= */

/* =========================================
   BODY — garante que nada ultrapassa o main-content
   ========================================= */
body.subscriptions-body .main-content,
body.subscriptions-body .subscriptions-page,
body.subscriptions-body .subscriptions-table-wrapper,
body.subscriptions-body .subscriptions-table {
    box-sizing: border-box;
    max-width: 100%;
}

/* =========================================
   PÁGINA
   ========================================= */
.subscriptions-page {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 24px;
    margin-top: 2%;
    min-width: 0;
}

/* =========================================
   TÍTULO + PESQUISA
   ========================================= */
.subscriptions-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.subscriptions-title-block h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}
.subscriptions-title-block p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.subscriptions-search {
    min-width: 280px;
}

/* =========================================
   TABS
   ========================================= */
.subscriptions-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;
}
.subscriptions-tabs::-webkit-scrollbar { height: 4px; }
.subscriptions-tabs::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 999px;
}

.sub-tab {
    flex-shrink: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    padding: 9px 18px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.sub-tab:hover {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
}
.sub-tab.active {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
    color: #fff;
}

/* =========================================
   CONTADOR
   ========================================= */
.subscriptions-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 14px;
    align-self: flex-start;
}
.subscriptions-count-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}
.subscriptions-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-pink);
}

/* =========================================
   TABELA (DESKTOP)
   — table-layout: fixed para controlar larguras
   ========================================= */
.subscriptions-table-wrapper {
    width: 100%;
    max-width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.subscriptions-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13.5px;
}

/* Larguras das colunas (total = 100%) */
.subscriptions-table col.col-subscrito   { width: 32%; }
.subscriptions-table col.col-data        { width: 14%; }
.subscriptions-table col.col-intervalo   { width: 15%; }
.subscriptions-table col.col-termina     { width: 22%; }
.subscriptions-table col.col-estado      { width: 17%; }

.subscriptions-table thead {
    background-color: var(--bg-dark);
}

.subscriptions-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.subscriptions-table td {
    padding: 14px 18px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subscriptions-table tbody tr:last-child td {
    border-bottom: none;
}

.sub-row {
    cursor: pointer;
    transition: background-color 0.15s;
}
.sub-row:hover {
    background-color: var(--bg-dark);
}

.subscriptions-table th.right,
.subscriptions-table td.right {
    text-align: right;
    overflow: visible;
}

/* Coluna "Termina em" — permite quebra controlada */
.subscriptions-table td.sub-cell[data-label="Termina em"] {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
}

/* Coluna "Estado" — nunca corta */
.subscriptions-table td.sub-cell.right {
    white-space: nowrap;
}

/* =========================================
   CÉLULA — CRIADOR (desktop)
   ========================================= */
.sub-creator-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.sub-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}
.sub-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-pink);
    background-color: var(--bg-dark);
}
.sub-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.sub-creator-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.sub-creator-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.sub-creator-username {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================
   ESTADO (base — usada desktop e mobile)
   ========================================= */
.sub-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
    max-width: 100%;
}
.sub-status.active {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.sub-status.expired {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.sub-status.cancelled {
    background-color: rgba(138, 143, 152, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.sub-status.expiring {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* =========================================
   CLASSES MOBILE (ocultas no desktop)
   ========================================= */
.sub-mobile-actions,
.sub-mobile-meta {
    display: none;
}

/* =========================================
   BREAKPOINT — 1201px a 1400px
   (sidebar esquerda + conteúdo + sidebar direita = aperto)
   → reduzir paddings, fontes, avatar mas manter 5 colunas
   ========================================= */
@media (min-width: 1201px) and (max-width: 1400px) {

    .subscriptions-table th,
    .subscriptions-table td {
        padding: 10px 10px;
    }

    .subscriptions-table th {
        font-size: 10.5px;
        letter-spacing: 0.3px;
    }

    .subscriptions-table {
        font-size: 12.5px;
    }

    .sub-avatar {
        width: 36px;
        height: 36px;
    }

    .sub-creator-name { font-size: 13px; }
    .sub-creator-username { font-size: 11px; }
    .sub-creator-cell { gap: 10px; }

    .sub-status {
        font-size: 11px;
        padding: 3px 9px;
        gap: 5px;
    }
    .sub-status i { font-size: 6px; }

    /* Larguras ajustadas para caber com sidebar direita */
    .subscriptions-table col.col-subscrito { width: 30%; }
    .subscriptions-table col.col-data      { width: 15%; }
    .subscriptions-table col.col-intervalo { width: 15%; }
    .subscriptions-table col.col-termina   { width: 23%; }
    .subscriptions-table col.col-estado    { width: 17%; }
}

/* =========================================
   BREAKPOINT — 1025px a 1200px
   (sidebar direita ainda visível mas mais estreita)
   → reduzir ainda mais e deixar a tabela respirar
   ========================================= */
@media (min-width: 1025px) and (max-width: 1200px) {

    .subscriptions-table th,
    .subscriptions-table td {
        padding: 10px 8px;
    }

    .subscriptions-table {
        font-size: 12.5px;
    }

    .sub-avatar {
        width: 34px;
        height: 34px;
    }

    .sub-creator-name { font-size: 13px; }
    .sub-creator-username { font-size: 11px; }
    .sub-creator-cell { gap: 9px; }

    .sub-status {
        font-size: 11px;
        padding: 3px 9px;
    }

    .subscriptions-table col.col-subscrito { width: 30%; }
    .subscriptions-table col.col-data      { width: 14%; }
    .subscriptions-table col.col-intervalo { width: 14%; }
    .subscriptions-table col.col-termina   { width: 24%; }
    .subscriptions-table col.col-estado    { width: 18%; }
}

/* =========================================
   BREAKPOINT — 769px a 1024px
   (sidebar direita já escondida pelo main.css)
   → tabela ocupa toda a largura, layout confortável
   ========================================= */
@media (min-width: 769px) and (max-width: 1024px) {

    body.subscriptions-body .main-content {
        margin-right: 0 !important;
    }

    .subscriptions-table th,
    .subscriptions-table td {
        padding: 12px 14px;
    }

    .subscriptions-table {
        font-size: 13px;
    }

    .sub-avatar {
        width: 40px;
        height: 40px;
    }

    .sub-creator-name { font-size: 13.5px; }
    .sub-creator-username { font-size: 11.5px; }

    .sub-status {
        font-size: 11.5px;
        padding: 4px 10px;
    }
}

/* =========================================
   MOBILE
   ========================================= */
@media (max-width: 768px) {

    body.subscriptions-body .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
    }

    .subscriptions-page {
        padding: 0 10px 130px;
        gap: 14px;
    }

    /* Header */
    .subscriptions-top { flex-direction: column; gap: 12px; }
    .subscriptions-title-block h1 { font-size: 22px; }
    .subscriptions-title-block p { font-size: 12px; }
    .subscriptions-search {
        min-width: 0;
        width: 100%;
        padding: 11px 16px;
    }

    /* Tabs */
    .subscriptions-tabs {
        gap: 6px;
        padding-bottom: 8px;
        scrollbar-width: thin;
        scrollbar-color: var(--border-color) transparent;
    }
    .subscriptions-tabs::-webkit-scrollbar { height: 4px; }
    .subscriptions-tabs::-webkit-scrollbar-track { background: transparent; }
    .subscriptions-tabs::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 999px;
    }
    .sub-tab {
        font-size: 12.5px;
        padding: 8px 14px;
    }

    /* Contador */
    .subscriptions-counter { padding: 5px 12px; }
    .subscriptions-count-label { font-size: 11px; }
    .subscriptions-count { font-size: 12px; }

    /* =====================================
       TABELA → CARDS
       ===================================== */
    .subscriptions-table-wrapper {
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }
    .subscriptions-table {
        table-layout: auto;
    }
    .subscriptions-table thead { display: none; }
    .subscriptions-table,
    .subscriptions-table tbody,
    .subscriptions-table tr,
    .subscriptions-table td {
        display: block;
        width: 100%;
    }
    .subscriptions-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Card */
    .sub-row {
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        cursor: pointer;
        transition: border-color 0.2s;
    }
    .sub-row:hover { background-color: var(--bg-card); }
    .sub-row:active { border-color: var(--accent-pink); }

    .subscriptions-table td {
        padding: 0;
        border-bottom: none;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    /* =====================================
       PRIMEIRA <td> = CABEÇALHO + META
       ===================================== */
    .sub-row > td:first-child {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    /* =====================================
       CABEÇALHO (avatar + nome + ações)
       ===================================== */
    .sub-creator-cell {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    .sub-avatar-wrapper {
        position: relative;
        flex-shrink: 0;
        width: 46px;
        height: 46px;
    }
    .sub-avatar {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--accent-pink);
        background-color: var(--bg-dark);
        display: block;
    }
    .sub-online {
        position: absolute;
        bottom: 1px;
        right: 1px;
        width: 12px;
        height: 12px;
        background-color: #22c55e;
        border-radius: 50%;
        border: 2px solid var(--bg-card);
    }

    .sub-creator-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .sub-creator-name {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-primary);
        display: inline-flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sub-creator-username {
        font-size: 12px;
        color: var(--text-secondary);
    }

    /* Ações à direita: ⋮ e › */
    .sub-mobile-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
        margin-left: auto;
    }
    .sub-mobile-menu,
    .sub-mobile-arrow {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        font-size: 15px;
        cursor: pointer;
        transition: all 0.2s;
    }
    .sub-mobile-menu:hover,
    .sub-mobile-arrow:hover {
        color: var(--accent-pink);
        background-color: var(--bg-dark);
    }

    /* =====================================
       META (Data / Intervalo / Termina em)
       ===================================== */
    .sub-mobile-meta {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }
    .sub-mobile-meta-row {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    .sub-mobile-meta-icon {
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--accent-pink);
        font-size: 13px;
        flex-shrink: 0;
    }
    .sub-mobile-meta-label {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
    }
    .sub-mobile-meta-value {
        font-size: 13px;
        color: var(--text-primary);
        font-weight: 500;
        margin-left: auto;
        text-align: right;
        min-width: 0;
    }

    /* =====================================
       CÉLULAS DESKTOP — esconder
       ===================================== */
    .sub-row > td.sub-cell {
        display: none;
    }

    /* =====================================
       ESTADO — mostrar só a última <td>
       ===================================== */
    .sub-row > td.sub-cell.right {
        display: flex;
        justify-content: flex-end;
        width: 100%;
    }

    .sub-status {
        font-size: 12px;
        font-weight: 600;
        padding: 5px 12px;
        gap: 6px;
    }
    .sub-status i { font-size: 7px; }
}