/* =====================================================================
   Copytrading module — visual language pegado al tema gProfit
   Mismas variables/luces/glassmorphism que .chartzella-modal y .cz-card.
   Todos los selectores llevan prefijo .ct- para no chocar con .cz- ni .bot-.
   ===================================================================== */

.ct-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 15, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.ct-modal {
    background: rgba(13, 17, 29, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(30, 158, 90, 0.25);
    border-radius: 16px;
    padding: 14px 18px 18px 18px;
    width: 92vw;
    max-width: 1400px;
    height: 85vh;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ct-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: #1e9e5a;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}
.ct-close:hover { background: rgba(30, 158, 90, 0.15); }

/* ---------- header ---------- */
.ct-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 6px 6px 0 6px;
    border-bottom: 1px solid rgba(30, 158, 90, 0.15);
    flex: 0 0 auto;
}
.ct-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #f5c9a6;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.1;
}
.ct-header-meta {
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    color: rgba(232, 241, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
}

.ct-tabs {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.ct-tab {
    padding: 7px 18px 8px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(30, 158, 90, 0.15);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: rgba(232, 241, 255, 0.6);
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: all 0.15s;
}
.ct-tab:hover { color: rgba(232, 241, 255, 0.85); }
.ct-tab.is-active {
    background: linear-gradient(180deg, rgba(30, 158, 90, 0.18), rgba(30, 158, 90, 0.04));
    border-color: rgba(30, 158, 90, 0.5);
    color: #e2e8f0;
}
.ct-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
    transition: all 0.2s;
}
.ct-tab.is-active .ct-tab-dot {
    background: #3ec77a;
    box-shadow: 0 0 8px #1e9e5a;
}

/* ---------- body grid ----------
   Layout: left col (perfil + KPIs + charts) | right col (live + config)
   Debajo, fila completa con la tabla de trades.
   El right col NO hace span 2: el alto lo define su contenido natural.
   La tabla tiene flex:1 para absorber el espacio sobrante. */
.ct-body {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px 6px 6px 6px;
    overflow: auto;
    min-height: 0;
}
.ct-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    min-height: 0;
}
.ct-col--right { grid-column: 2; grid-row: 1; min-height: 0; }
.ct-col--left  { grid-column: 1; grid-row: 1; min-height: 0; }
.ct-col--bottom {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 0;
}

/* scrollbar styled igual que .chartzella-body */
.ct-body::-webkit-scrollbar { width: 8px; }
.ct-body::-webkit-scrollbar-track { background: transparent; }
.ct-body::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 4px; }
.ct-body { scrollbar-color: rgba(148, 163, 184, 0.22) transparent; }

/* ---------- card (mismo lenguaje que .cz-card) ---------- */
.ct-card {
    background: rgba(15, 16, 25, 0.85);
    border: 1px solid rgba(30, 158, 90, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}
.ct-card-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #3ec77a;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.ct-card-sub {
    font-size: 10px;
    font-weight: 500;
    color: rgba(232, 241, 255, 0.55);
    text-transform: none;
    letter-spacing: 0;
}

/* ---------- trader header ---------- */
.ct-trader {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ct-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e9e5a, #34d399);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #02040a;
    border: 2px solid rgba(30, 158, 90, 0.5);
    box-shadow: 0 0 18px rgba(30, 158, 90, 0.35);
    flex: 0 0 auto;
}
.ct-avatar--alt {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}
.ct-trader-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.1;
}
.ct-trader-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.ct-style-badge {
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #3ec77a;
    background: rgba(30, 158, 90, 0.12);
    border: 1px solid rgba(30, 158, 90, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ct-following-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #34d399;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.35);
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ct-following-pill .ct-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    animation: ctPulse 1.4s ease-in-out infinite;
}
@keyframes ctPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.ct-following-pill.is-off {
    color: rgba(232, 241, 255, 0.45);
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
}
.ct-following-pill.is-off .ct-live-dot { display: none; }

/* ---------- KPI grid ---------- */
.ct-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.ct-kpi {
    background: rgba(10, 12, 20, 0.7);
    border: 1px solid rgba(30, 158, 90, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 0;
}
.ct-kpi-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #3ec77a;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ct-kpi-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.2;
    margin-top: 2px;
}
.ct-kpi-sub {
    font-size: 10px;
    color: rgba(232, 241, 255, 0.55);
    margin-top: 2px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ct-pos { color: #34d399; }
.ct-neg { color: #ff6b6b; }

/* ---------- live panel (right column) ---------- */
.ct-live {
    background: linear-gradient(180deg, rgba(30, 158, 90, 0.10), rgba(15, 16, 25, 0.85));
}
.ct-live-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    margin-bottom: 10px;
}
.ct-live-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: rgba(232, 241, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.2;
}
.ct-live-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.2;
    margin-top: 2px;
}
.ct-risk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.ct-risk-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(30, 158, 90, 0.15);
    border: 1px solid rgba(30, 158, 90, 0.4);
    transition: all 0.2s;
}
.ct-risk-dot.is-on {
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}
.ct-risk-label {
    margin-left: 6px;
    font-size: 11px;
    color: rgba(232, 241, 255, 0.6);
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- buttons ---------- */
.ct-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}
.ct-btn {
    padding: 9px 12px;
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.ct-btn-primary {
    background: linear-gradient(180deg, #1e9e5a, #178a4d);
    color: #02040a;
    border-color: #1e9e5a;
    box-shadow: 0 4px 12px rgba(30, 158, 90, 0.3);
}
.ct-btn-primary:hover {
    background: linear-gradient(180deg, #22b568, #1e9e5a);
    box-shadow: 0 6px 16px rgba(30, 158, 90, 0.45);
}
.ct-btn-primary:active { transform: translateY(1px); }
.ct-btn-danger {
    background: rgba(255, 107, 107, 0.06);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.4);
}
.ct-btn-danger:hover {
    background: rgba(255, 107, 107, 0.14);
    color: #ff8585;
}

/* ---------- config rows ---------- */
.ct-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
    gap: 12px;
}
.ct-config-row:last-child { border-bottom: none; padding-bottom: 0; }
.ct-config-label {
    font-size: 12px;
    color: rgba(232, 241, 255, 0.72);
}
.ct-config-input {
    background: rgba(10, 12, 20, 0.7);
    border: 1px solid rgba(30, 158, 90, 0.25);
    border-radius: 6px;
    color: #34d399;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    width: 96px;
    text-align: right;
    outline: none;
    transition: border-color 0.15s;
}
.ct-config-input:focus { border-color: rgba(30, 158, 90, 0.7); }
.ct-config-input:read-only { opacity: 0.85; cursor: not-allowed; }

/* ---------- trades table ---------- */
.ct-table-card {
    padding: 12px 14px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.ct-table-card .ct-card-title { flex: 0 0 auto; }
.ct-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-color: rgba(148, 163, 184, 0.22) transparent;
}
.ct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ct-table th {
    text-align: left;
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #3ec77a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(30, 158, 90, 0.2);
    position: sticky;
    top: 0;
    background: rgba(15, 16, 25, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1;
}
.ct-table td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}
.ct-table td.is-num {
    text-align: right;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
}
.ct-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.3px;
    line-height: 1.4;
}
.ct-tag-win  { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.ct-tag-loss { background: rgba(255, 107, 107, 0.15); color: #ff6b6b; }

/* ---------- chart svgs (no libs, inline) ---------- */
.ct-chart { width: 100%; display: block; }
.ct-charts-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 10px;
}

/* ---------- disclaimer cuando NO seguís al trader ---------- */
.ct-disclaimer {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(30, 158, 90, 0.04);
    border: 1px dashed rgba(30, 158, 90, 0.2);
    border-radius: 8px;
    font-size: 11px;
    color: rgba(232, 241, 255, 0.6);
    line-height: 1.4;
}

/* ---------- responsive chico ---------- */
@media (max-width: 1100px) {
    .ct-body { grid-template-columns: 1fr; }
    .ct-col--right { grid-row: auto; }
    .ct-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .ct-charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .ct-modal { width: 100vw; height: 100vh; border-radius: 0; }
    .ct-backdrop { padding: 0; }
    .ct-live-grid { grid-template-columns: 1fr; }
}
