/* ================================================================
   Trial Badge & Upgrade Modal — Stitch Design System
   ================================================================ */

/* ── Trial Badge Banner ── */
.rep-trial-badge {
    --rep-trial-accent: var(--rep-color-semantic-warning-base);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-left: 4px solid var(--rep-trial-accent);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--rep-trial-accent) 18%, transparent),
        color-mix(in srgb, var(--rep-trial-accent) 6%, transparent)
    );
    border-bottom: 1px solid color-mix(in srgb, var(--rep-trial-accent) 30%, transparent);
    font-family: var(--rep-font-base);
}

.rep-trial-badge--expired {
    --rep-trial-accent: var(--rep-color-semantic-error-base);
}

/* Progressive urgency states */
.rep-trial-badge--warning {
    --rep-trial-accent: #f59e0b; /* amber-500 */
}

.rep-trial-badge--urgent {
    --rep-trial-accent: #ef4444; /* red-500 */
    animation: rep-trial-pulse 3s ease-in-out infinite;
}

.rep-trial-badge--critical {
    --rep-trial-accent: #dc2626; /* red-600 */
    animation: rep-trial-pulse 1.5s ease-in-out infinite;
}

.rep-trial-badge--critical .rep-trial-badge__cta {
    background: var(--rep-trial-accent);
    color: #fff;
    box-shadow: 0 0 20px color-mix(in srgb, var(--rep-trial-accent) 40%, transparent);
}

@keyframes rep-trial-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.rep-trial-badge__info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rep-trial-badge__icon {
    color: var(--rep-trial-accent);
    font-size: 1.375rem;
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--rep-trial-accent) 40%, transparent));
}

.rep-trial-badge__text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

@media (min-width: 640px) {
    .rep-trial-badge__text {
        flex-direction: row;
        align-items: baseline;
        gap: 0.75rem;
    }
}

.rep-trial-badge__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--rep-color-text-primary);
    margin: 0;
}

.rep-trial-badge__sep {
    display: none;
    color: var(--rep-color-text-secondary);
    font-size: 0.75rem;
}

@media (min-width: 640px) {
    .rep-trial-badge__sep {
        display: inline;
    }
}

.rep-trial-badge__detail {
    font-size: 0.75rem;
    color: var(--rep-color-text-secondary);
    margin: 0;
}

@media (min-width: 640px) {
    .rep-trial-badge__detail {
        font-size: 0.875rem;
    }
}

.rep-trial-badge__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border: none;
    border-radius: 0.375rem;
    background: var(--rep-color-primary-base);
    color: var(--rep-text-inverse);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--rep-color-primary-base) 30%, transparent);
    text-decoration: none;
}

.rep-trial-badge__cta:hover {
    opacity: 0.9;
}

.rep-trial-badge__cta .material-symbols-outlined {
    font-size: 0.875rem;
}

/* ── Read-only Banner (replaces the old rep-banner--warning) ── */
.rep-readonly-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    background: color-mix(in srgb, var(--rep-color-semantic-error-base) 10%, transparent);
    border-left: 4px solid var(--rep-color-semantic-error-base);
    font-size: 0.8125rem;
    color: var(--rep-color-text-primary);
    font-family: var(--rep-font-base);
}

.rep-readonly-banner .material-symbols-outlined {
    color: var(--rep-color-semantic-error-base);
    font-size: 1.125rem;
}

.rep-readonly-banner__link {
    margin-left: auto;
    color: var(--rep-color-primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.rep-readonly-banner__link:hover {
    text-decoration: underline;
}

/* ── Upgrade Modal ── */
.rep-upgrade-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--rep-bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
    font-family: var(--rep-font-base);
}

.rep-upgrade-overlay--open {
    display: flex;
}

.rep-upgrade-modal {
    position: relative;
    width: 100%;
    max-width: 56rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid var(--rep-border-subtle);
    background: var(--rep-color-surface);
    box-shadow: var(--rep-shadow-modal);
}

@media (min-width: 768px) {
    .rep-upgrade-modal {
        flex-direction: row;
    }
}

/* Left panel */
.rep-upgrade-modal__visual {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border-bottom: 1px solid var(--rep-border-subtle);
    background: var(--rep-color-bg);
}

@media (min-width: 768px) {
    .rep-upgrade-modal__visual {
        width: 41.666%;
        border-bottom: none;
        border-right: 1px solid var(--rep-border-subtle);
    }
}

.rep-upgrade-modal__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--rep-color-primary) 20%, transparent);
    color: var(--rep-color-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.rep-upgrade-modal__heading {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--rep-text-inverse);
    margin: 0 0 0.75rem;
    letter-spacing: -0.01em;
}

.rep-upgrade-modal__desc {
    color: var(--rep-color-text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

.rep-upgrade-modal__illustration {
    margin-top: auto;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--rep-color-primary) 20%, transparent), transparent);
    border: 1px solid var(--rep-border-subtle);
    position: relative;
    overflow: hidden;
}

.rep-upgrade-modal__illustration-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--rep-color-primary) 30%, transparent);
    filter: blur(3rem);
}

.rep-upgrade-modal__illustration-card {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--rep-border-subtle);
    background: var(--rep-bg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.rep-upgrade-modal__illustration-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    background: color-mix(in srgb, var(--rep-color-primary) 20%, transparent);
    color: var(--rep-color-primary);
    flex-shrink: 0;
}

.rep-upgrade-modal__illustration-icon .material-symbols-outlined {
    font-size: 1.25rem;
}

.rep-upgrade-modal__illustration-label {
    font-size: 0.6875rem;
    color: var(--rep-color-text-secondary);
}

.rep-upgrade-modal__illustration-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--rep-text-inverse);
}

/* Right panel */
.rep-upgrade-modal__content {
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .rep-upgrade-modal__content {
        width: 58.333%;
    }
}

.rep-upgrade-modal__features-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--rep-text-inverse);
    margin: 0 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rep-upgrade-modal__features-title .material-symbols-outlined {
    color: var(--rep-color-primary);
}

.rep-upgrade-modal__features {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rep-upgrade-modal__feature {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.rep-upgrade-modal__feature-check {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--rep-color-primary) 10%, transparent);
    color: var(--rep-color-primary);
    margin-top: 0.125rem;
    transition: background 0.2s, color 0.2s;
}

.rep-upgrade-modal__feature:hover .rep-upgrade-modal__feature-check {
    background: var(--rep-color-primary);
    color: var(--rep-text-inverse);
}

.rep-upgrade-modal__feature-check .material-symbols-outlined {
    font-size: 0.875rem;
    font-weight: 700;
}

.rep-upgrade-modal__feature-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rep-text-secondary);
    margin: 0;
}

.rep-upgrade-modal__feature-desc {
    font-size: 0.75rem;
    color: var(--rep-text-muted);
    margin: 0.125rem 0 0;
}

/* Footer: price + actions */
.rep-upgrade-modal__footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rep-border-subtle);
}

.rep-upgrade-modal__price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.rep-upgrade-modal__price {
    font-size: 1.875rem;
    font-weight: 900;
    color: var(--rep-text-inverse);
    letter-spacing: -0.02em;
}

.rep-upgrade-modal__price-period {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--rep-color-text-secondary);
    margin-left: 0.25rem;
}

.rep-upgrade-modal__guarantee {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--rep-color-text-secondary);
    margin-top: 0.25rem;
}

.rep-upgrade-modal__guarantee .material-symbols-outlined {
    font-size: 0.875rem;
    color: var(--rep-color-status-ready);
}

.rep-upgrade-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rep-upgrade-modal__btn-primary {
    width: 100%;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--rep-color-primary);
    color: var(--rep-text-inverse);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--rep-color-primary) 39%, transparent);
    text-decoration: none;
}

.rep-upgrade-modal__btn-primary:hover {
    background: color-mix(in srgb, var(--rep-color-primary) 90%, #000);
}

.rep-upgrade-modal__btn-primary .material-symbols-outlined {
    font-size: 0.875rem;
}

.rep-upgrade-modal__btn-secondary {
    width: 100%;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--rep-color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.rep-upgrade-modal__btn-secondary:hover {
    background: var(--rep-bg-hover);
    color: var(--rep-text-inverse);
}

/* Close button */
.rep-upgrade-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--rep-color-text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 1;
}

.rep-upgrade-modal__close:hover {
    background: var(--rep-bg-hover);
    color: var(--rep-text-inverse);
}

/* ── Disabled action buttons (read-only mode) ── */
[data-trigger="upgrade-modal"][disabled],
.rep-readonly-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

[data-trigger="upgrade-modal"]:not([disabled]) {
    cursor: pointer;
}
