/*======= CLIENTCORE · TICKETS DE SOPORTE (CC_TICKETS_V77) =======*/
/* Abrir ticket (pasos 1-3) y ver ticket. Solo colores de brand.css. */

.cc-tk { font-size: 14px; color: var(--brand-ink); }

/* ---------- Pasos ---------- */
.cc-tk-steps {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.cc-tk-steps li {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    background: var(--neutral-white);
    color: var(--brand-muted);
    font-size: 13px;
    font-weight: 600;
}

.cc-tk-steps li span {
    display: grid;
    flex: 0 0 26px;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-muted);
    font-size: 12px;
    font-weight: 800;
}

.cc-tk-steps li b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.cc-tk-steps li.is-active { border-color: var(--brand-primary); color: var(--brand-dark); }
.cc-tk-steps li.is-active span { background: var(--brand-primary); color: var(--neutral-white); }
.cc-tk-steps li.is-done { background: var(--brand-soft-1); color: var(--brand-primary); }
.cc-tk-steps li.is-done span { background: var(--brand-primary); color: var(--brand-accent); }

/* ---------- Tarjeta base ---------- */
.cc-tk-card {
    margin-bottom: 16px;
    border: 1px solid var(--brand-border);
    border-radius: 16px;
    background: var(--neutral-white);
}

.cc-tk-card-body { padding: 24px; }

.cc-tk-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--brand-border);
}

.cc-tk-head-ico {
    display: grid;
    flex: 0 0 46px;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--brand-primary);
    color: var(--brand-accent);
    font-size: 19px;
}

.cc-tk-head h2 {
    margin: 0 0 4px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--brand-dark);
}

.cc-tk-head p { margin: 0; color: var(--brand-muted); font-size: 13.5px; line-height: 1.5; }

/* ---------- Paso 1: departamentos ---------- */
.cc-tk-depts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    padding: 22px 24px 24px;
}

.cc-tk .cc-tk-dept {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--brand-border);
    border-radius: 14px;
    background: var(--neutral-white);
    color: var(--brand-ink);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.cc-tk .cc-tk-dept:hover,
.cc-tk .cc-tk-dept:focus {
    border-color: var(--brand-primary);
    background: var(--brand-tint);
    color: var(--brand-ink);
    text-decoration: none;
    transform: translateY(-1px);
}

.cc-tk-dept-ico {
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--brand-soft-1);
    color: var(--brand-primary);
    font-size: 17px;
}

.cc-tk-dept-txt { flex: 1 1 auto; min-width: 0; }

.cc-tk-dept-txt b {
    display: block;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-dark);
}

.cc-tk-dept-txt small { display: block; margin-top: 2px; color: var(--brand-muted); font-size: 12.5px; line-height: 1.45; }

.cc-tk-dept-go { flex: 0 0 auto; color: var(--brand-primary); font-size: 14px; transition: transform .15s ease; }
.cc-tk .cc-tk-dept:hover .cc-tk-dept-go { transform: translateX(3px); }

/* Aviso inferior */
.cc-tk-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px dashed var(--brand-border-6);
    border-radius: 14px;
    background: var(--brand-tint);
    color: var(--brand-ink);
    font-size: 13.5px;
    line-height: 1.5;
}

.cc-tk-hint > i { color: var(--brand-primary); font-size: 17px; }
.cc-tk-hint a { color: var(--brand-primary); font-weight: 700; }

/* ---------- Paso 2: formulario ---------- */
.cc-tk-dept-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 5px 12px;
    border-radius: 99px;
    background: var(--brand-soft-1);
    color: var(--brand-primary);
    font-size: 12.5px;
    font-weight: 700;
}

.cc-tk-dept-chip a { color: var(--brand-primary); font-weight: 600; text-decoration: underline; }

.cc-tk-replyto {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius: 11px;
    background: var(--brand-tint);
    color: var(--brand-muted);
    font-size: 13px;
}

.cc-tk-replyto i { color: var(--brand-primary); }
.cc-tk-replyto b { color: var(--brand-dark); }

.cc-tk label,
.cc-tk .cc-tk-label {
    display: block;
    margin-bottom: 6px;
    color: var(--brand-dark);
    font-size: 12.5px;
    font-weight: 600;
}

.cc-tk .form-group { margin-bottom: 18px; }

.cc-tk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 16px;
}

/* Prioridad como botones */
.cc-tk-prio {
    display: flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--brand-border-6);
    border-radius: 11px;
    background: var(--brand-tint);
}

.cc-tk-prio label {
    position: relative;
    flex: 1 1 0;
    margin: 0;
    cursor: pointer;
}

.cc-tk-prio input { position: absolute; opacity: 0; pointer-events: none; }

.cc-tk-prio span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    border-radius: 8px;
    color: var(--brand-muted);
    font-size: 13px;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease;
}

.cc-tk-prio span::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.cc-tk-prio .is-low span::before { background: var(--brand-primary-600); }
.cc-tk-prio .is-medium span::before { background: var(--state-warning-ink); }
.cc-tk-prio .is-high span::before { background: var(--state-danger); }

.cc-tk-prio input:checked + span {
    background: var(--neutral-white);
    color: var(--brand-dark);
    box-shadow: 0 1px 3px rgba(var(--brand-dark-rgb), .12);
}

.cc-tk-prio input:focus-visible + span { outline: 2px solid var(--brand-primary); outline-offset: 1px; }

/* Consejos para el mensaje */
.cc-tk-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: -8px 0 18px;
    color: var(--brand-muted);
    font-size: 12.5px;
}

.cc-tk-tips b { color: var(--brand-dark); font-weight: 600; }
.cc-tk-tips span i { margin-right: 4px; color: var(--brand-primary); }

/* Adjuntos */
.cc-tk .attachment-group .custom-file-label,
.cc-tk .attachment-group .btn { min-height: 44px; }

.cc-tk .attachment-group .input-group-append .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Barra de acciones */
.cc-tk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--brand-border);
    border-radius: 0 0 16px 16px;
    background: var(--brand-tint);
}

.cc-tk-actions-note { display: flex; align-items: center; gap: 8px; color: var(--brand-muted); font-size: 12.5px; }
.cc-tk-actions-note i { color: var(--brand-primary); }
.cc-tk-actions-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.cc-tk-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; }
.cc-tk-actions .btn-primary i { margin-left: 6px; }

/* Sugerencias de artículos */
.cc-tk #autoAnswerSuggestions:not(.w-hidden) {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--brand-lime-border);
    border-radius: 14px;
    background: var(--brand-lime-soft);
}

.cc-tk #autoAnswerSuggestions .card-title { margin: 0 0 4px; padding: 0; border: 0; font-size: 15px; }

/* ---------- Paso 3: ticket creado ---------- */
.cc-tk-done { padding: 40px 24px 32px; text-align: center; }

.cc-tk-done-ico {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-accent);
    font-size: 30px;
    box-shadow: 0 0 0 10px var(--brand-soft-1);
}

.cc-tk-done h2 {
    margin: 0 0 8px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--brand-dark);
}

.cc-tk-done p { max-width: 460px; margin: 0 auto 6px; color: var(--brand-muted); line-height: 1.6; }

.cc-tk-done-num {
    display: inline-block;
    margin: 6px 0 22px;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--brand-soft-1);
    color: var(--brand-primary);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .02em;
}

.cc-tk-done-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cc-tk-done-btns .btn { min-height: 44px; padding: 0 22px; display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Ver ticket ---------- */
.cc-tk-view-head { padding: 22px 24px; }

.cc-tk-view-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.cc-tk-view-id { color: var(--brand-muted); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; }

.cc-tk-view-head h2 {
    margin: 4px 0 0;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--brand-dark);
    word-break: break-word;
}

.cc-tk-view-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-tk-view-btns .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; }

.cc-tk .cc-tk-btn-close {
    border: 1px solid var(--state-danger-border);
    background: var(--neutral-white);
    color: var(--state-danger);
}

.cc-tk .cc-tk-btn-close:hover,
.cc-tk .cc-tk-btn-close:focus { border-color: var(--state-danger); background: var(--state-danger-bg); color: var(--state-danger); }
.cc-tk .cc-tk-btn-close[disabled] { opacity: .6; }

.cc-tk-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.cc-tk-meta div {
    padding: 10px 14px;
    border-radius: 11px;
    background: var(--brand-tint);
}

.cc-tk-meta small {
    display: block;
    color: var(--brand-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.cc-tk-meta b { display: block; margin-top: 2px; color: var(--brand-dark); font-size: 13.5px; font-weight: 700; }

.cc-tk-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cc-tk-status::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-primary-600);
    content: "";
}

.cc-tk-status.is-closed::before { background: var(--brand-muted); }
.cc-tk-status.is-wait::before { background: var(--state-warning-border); }

/* Conversación */
.cc-tk-thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }

.cc-tk-msg { display: flex; gap: 12px; }

.cc-tk-avatar {
    display: grid;
    flex: 0 0 40px;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-soft-1);
    color: var(--brand-primary);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
}

.cc-tk-msg.is-staff .cc-tk-avatar { background: var(--brand-primary); color: var(--brand-accent); }

.cc-tk-bubble {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--brand-border);
    border-radius: 4px 16px 16px 16px;
    background: var(--neutral-white);
}

.cc-tk-msg.is-staff .cc-tk-bubble { border-color: var(--brand-lime-border); }

.cc-tk-bubble-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--brand-border);
    background: var(--brand-tint);
    font-size: 12.5px;
    color: var(--brand-muted);
}

.cc-tk-msg.is-staff .cc-tk-bubble-head { border-bottom-color: var(--brand-lime-border); background: var(--brand-lime-soft); }

.cc-tk-bubble-head b { color: var(--brand-dark); font-size: 13.5px; }

.cc-tk-role {
    padding: 2px 9px;
    border-radius: 99px;
    background: var(--brand-soft-1);
    color: var(--brand-primary);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.cc-tk-msg.is-staff .cc-tk-role { background: var(--brand-primary); color: var(--brand-accent); }

.cc-tk-date { margin-left: auto; white-space: nowrap; }

.cc-tk-body { padding: 16px 18px; font-size: 14px; line-height: 1.7; color: var(--brand-ink); word-wrap: break-word; }
.cc-tk-body > :last-child { margin-bottom: 0; }
.cc-tk-body img { max-width: 100%; height: auto; border-radius: 8px; }
.cc-tk-body pre { padding: 12px; border-radius: 10px; background: var(--brand-tint); white-space: pre-wrap; }
.cc-tk-body hr { border-color: var(--brand-border); }
.cc-tk-ip { color: var(--brand-muted); font-size: 12px; }

.cc-tk-files {
    padding: 12px 18px 14px;
    border-top: 1px solid var(--brand-border);
    background: var(--brand-tint);
    font-size: 12.5px;
}

.cc-tk-files > b { display: block; margin-bottom: 8px; color: var(--brand-dark); }
.cc-tk-files ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }

.cc-tk-files li a,
.cc-tk-files li > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    padding: 7px 12px;
    border: 1px solid var(--brand-border-6);
    border-radius: 10px;
    background: var(--neutral-white);
    color: var(--brand-primary);
    font-weight: 600;
}

.cc-tk-files li a span,
.cc-tk-files li > span span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tk-files li a:hover { border-color: var(--brand-primary); text-decoration: none; }
.cc-tk-files li > span { color: var(--brand-muted); }

/* Valoración de respuestas (estrellas de WHMCS; el orden rtl lo necesita el efecto hover) */
.cc-tk .ticket-reply .rating,
.cc-tk .ticket-reply .rating-done {
    display: flex;
    float: none;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--brand-lime-border);
    direction: rtl;
}

.cc-tk .ticket-reply .rating::after,
.cc-tk .ticket-reply .rating-done .rated {
    margin-right: auto;
    padding-right: 4px;
    color: var(--brand-muted);
    font-size: 12.5px;
    font-weight: 600;
    direction: ltr;
}

.cc-tk .ticket-reply .rating::after { content: "¿Te sirvió esta respuesta?"; }
.cc-tk .ticket-reply .rating-done .rated { order: 99; }

.cc-tk .ticket-reply .rating span.star,
.cc-tk .ticket-reply .rating-done span.star {
    font-family: "Font Awesome 6 Pro", "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-size: 17px;
    font-weight: 900;
}

.cc-tk .ticket-reply .rating span.star::before,
.cc-tk .ticket-reply .rating-done span.star::before { color: var(--brand-border-6); }

.cc-tk .ticket-reply .rating span.star:hover::before,
.cc-tk .ticket-reply .rating span.star:hover ~ span.star::before,
.cc-tk .ticket-reply .rating-done span.star.active::before { color: var(--state-warning-border); }

/* Respuesta */
.cc-tk-reply .cc-tk-head-ico { background: var(--brand-soft-1); color: var(--brand-primary); }

/* ---------- Móvil ---------- */
@media (max-width: 767.98px) {
    .cc-tk-steps li { justify-content: center; padding: 9px 8px; }
    .cc-tk-steps li b { display: none; }
    .cc-tk-steps li.is-active b { display: block; }
    .cc-tk-head, .cc-tk-card-body, .cc-tk-view-head { padding: 18px; }
    .cc-tk-depts { grid-template-columns: 1fr; padding: 18px; }
    .cc-tk-actions { padding: 14px 18px; }
    .cc-tk-actions-btns { width: 100%; }
    .cc-tk-actions-btns .btn { flex: 1 1 auto; }
    .cc-tk-actions-btns .btn-primary { order: -1; flex-basis: 100%; }
    .cc-tk-view-btns { width: 100%; }
    .cc-tk-view-btns .btn { flex: 1 1 0; justify-content: center; }
    .cc-tk-meta { grid-template-columns: 1fr 1fr; }
    .cc-tk-msg { gap: 8px; }
    .cc-tk-avatar { flex-basis: 32px; width: 32px; height: 32px; font-size: 13px; }
    .cc-tk-bubble-head { padding: 10px 14px; }
    .cc-tk-body { padding: 14px; }
    .cc-tk-date { width: 100%; margin-left: 0; }
}

/* La burbuja conserva la clase ticket-reply (la usa WHMCS para valorar respuestas);
   se anula el estilo genérico de pages-cc.css */
.cc-skin .primary-content .cc-tk-msg.ticket-reply,
.cc-tk-msg.ticket-reply {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
}
