/*
 * ChatMe Updates Widget — v1.0
 * Glassmorphism dark theme, matches chatme-chat-app design tokens.
 *
 * Depth layers inherit the page's --cm-* variables when rendered inside
 * a ChatMe dark page. Falls back to opaque surfaces on light pages.
 */

/* ── Root ─────────────────────────────────────────────── */
.chatme-updates {
    --upd-primary:   var(--cm-primary, #2563eb);
    --upd-bg:        var(--cm-bg,      #060e1e);
    --upd-surface:   var(--cm-surface, rgba(8,18,40,.8));
    --upd-border:    var(--cm-border,  rgba(59,130,246,.12));
    --upd-text:      var(--cm-text,    #e2e8f0);
    --upd-muted:     var(--cm-text-muted, rgba(148,163,184,.65));
    --upd-radius:    14px;
    --upd-blur:      18px;

    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    font-family: var(--chatme-font-family, 'Inter', sans-serif);
    color: var(--upd-text);
}

/* ── Tab bar ──────────────────────────────────────────── */
.chatme-updates__tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(6,14,30,.55);
    border: 1px solid var(--upd-border);
    border-radius: calc(var(--upd-radius) + 4px);
    backdrop-filter: blur(var(--upd-blur));
    -webkit-backdrop-filter: blur(var(--upd-blur));
    margin-bottom: 20px;
}

.chatme-updates__tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--upd-radius);
    background: transparent;
    color: var(--upd-muted);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.chatme-updates__tab:hover {
    color: var(--upd-text);
    background: rgba(59,130,246,.07);
}

.chatme-updates__tab.is-active {
    background: rgba(37,99,235,.18);
    color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
}

.chatme-updates__tab svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.chatme-updates__tab.is-active svg {
    opacity: 1;
}

.chatme-updates__tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--upd-primary);
    color: #fff;
    border-radius: 9px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

/* ── Panels ───────────────────────────────────────────── */
.chatme-updates__panel--hidden {
    display: none !important;
}

/* ── Loading skeletons ────────────────────────────────── */
.chatme-updates__loading {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 0;
}

.chatme-updates__skeleton {
    height: 80px;
    border-radius: 12px;
    background: linear-gradient(
        90deg,
        rgba(15,28,60,.4) 25%,
        rgba(37,99,235,.08) 50%,
        rgba(15,28,60,.4) 75%
    );
    background-size: 200% 100%;
    animation: chatme-upd-shimmer 1.4s ease-in-out infinite;
}

.chatme-updates__skeleton--short {
    width: 60%;
    height: 48px;
}

@keyframes chatme-upd-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Empty state ──────────────────────────────────────── */
.chatme-updates__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 3rem 1rem;
    color: var(--upd-muted);
    text-align: center;
}

.chatme-updates__empty svg {
    opacity: 0.25;
}

.chatme-updates__empty p {
    margin: 0;
    font-size: 0.875rem;
}

/* ── Novidade list ────────────────────────────────────── */
.chatme-updates__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Novidade item card ───────────────────────────────── */
.chatme-update-item {
    background: rgba(15,28,60,.55);
    border: 1px solid var(--upd-border);
    border-radius: var(--upd-radius);
    padding: 1.1rem 1.25rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.04);
    transition: border-color .2s, box-shadow .2s;
}

.chatme-update-item:hover {
    border-color: rgba(59,130,246,.25);
    box-shadow: 0 6px 28px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}

.chatme-update-item__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

/* Type badges */
.chatme-update-item__type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chatme-update-item__type-badge--feature {
    background: rgba(37,99,235,.2);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,.3);
}

.chatme-update-item__type-badge--improvement {
    background: rgba(5,150,105,.18);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,.25);
}

.chatme-update-item__type-badge--fix {
    background: rgba(217,119,6,.18);
    color: #fcd34d;
    border: 1px solid rgba(245,158,11,.25);
}

.chatme-update-item__version {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(148,163,184,.55);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.chatme-update-item__date {
    font-size: 0.72rem;
    color: var(--upd-muted);
    margin-left: auto;
}

.chatme-update-item__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--upd-text);
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

.chatme-update-item__content {
    font-size: 0.875rem;
    color: rgba(203,213,225,.75);
    line-height: 1.7;
}

.chatme-update-item__content p     { margin: 0 0 0.5em; }
.chatme-update-item__content p:last-child { margin-bottom: 0; }
.chatme-update-item__content ul,
.chatme-update-item__content ol    { margin: 0.25em 0 0.5em 1.25em; }
.chatme-update-item__content li    { margin-bottom: 0.2em; }
.chatme-update-item__content strong { color: #bfdbfe; }
.chatme-update-item__content a     { color: #60a5fa; text-underline-offset: 2px; }
.chatme-update-item__content code  {
    background: rgba(37,99,235,.15);
    border: 1px solid rgba(59,130,246,.18);
    color: #93c5fd;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ── Auth notice (unauthenticated) ────────────────────── */
.chatme-updates__auth-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 3rem 1rem;
    color: var(--upd-muted);
    text-align: center;
}

.chatme-updates__auth-notice svg { opacity: 0.35; }
.chatme-updates__auth-notice p   { margin: 0; font-size: 0.9rem; }

/* ── Feedback form ────────────────────────────────────── */
.chatme-feedback-intro {
    font-size: 0.875rem;
    color: var(--upd-muted);
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

.chatme-feedback-notice {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.chatme-feedback-notice--success {
    background: rgba(5,150,105,.15);
    border: 1px solid rgba(16,185,129,.3);
    color: #6ee7b7;
}

.chatme-feedback-notice--error {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}

/* Type selector */
.chatme-feedback-form__types {
    display: flex;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.chatme-feedback-type {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.65rem 1rem;
    border: 1px solid var(--upd-border);
    border-radius: 10px;
    background: rgba(15,28,60,.4);
    color: var(--upd-muted);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
}

.chatme-feedback-type input { display: none; }

.chatme-feedback-type:hover {
    background: rgba(37,99,235,.1);
    border-color: rgba(59,130,246,.25);
    color: var(--upd-text);
}

.chatme-feedback-type.is-active {
    background: rgba(37,99,235,.18);
    border-color: rgba(59,130,246,.45);
    color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.2);
}

.chatme-feedback-type__icon { font-size: 1rem; }
.chatme-feedback-type__label { font-size: 0.875rem; font-weight: 500; }

/* Fields */
.chatme-feedback-form__field {
    margin-bottom: 1rem;
    position: relative;
}

.chatme-feedback-form__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(148,163,184,.8);
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.chatme-feedback-form__label span[aria-hidden] {
    color: rgba(239,68,68,.7);
    margin-left: 2px;
}

.chatme-feedback-form__input,
.chatme-feedback-form__textarea {
    width: 100%;
    background: rgba(15,28,60,.55);
    border: 1px solid rgba(59,130,246,.12);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    color: var(--upd-text);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.55;
    outline: none;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.chatme-feedback-form__input:focus,
.chatme-feedback-form__textarea:focus {
    border-color: rgba(59,130,246,.4);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.chatme-feedback-form__input::placeholder,
.chatme-feedback-form__textarea::placeholder {
    color: rgba(100,116,139,.45);
}

.chatme-feedback-form__counter {
    display: block;
    text-align: right;
    font-size: 0.7rem;
    color: rgba(100,116,139,.4);
    margin-top: 4px;
}

.chatme-feedback-form__counter--warn {
    color: #fcd34d;
}

/* Submit button */
.chatme-feedback-form__submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(37,99,235,.3);
    transition: box-shadow .2s, opacity .2s;
    margin-top: 0.5rem;
}

.chatme-feedback-form__submit:hover:not(:disabled) {
    box-shadow: 0 5px 20px rgba(37,99,235,.45);
}

.chatme-feedback-form__submit:disabled,
.chatme-feedback-form__submit.is-loading {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 520px) {
    .chatme-updates__tab {
        font-size: 0.8rem;
        padding: 0.55rem 0.5rem;
        gap: 5px;
    }

    .chatme-update-item {
        padding: 0.9rem 1rem;
    }

    .chatme-feedback-form__types {
        flex-direction: column;
    }

    .chatme-feedback-form__submit {
        width: 100%;
        justify-content: center;
    }
}
