/* ============================================================
   redflag.css — Writing Red Flag Detector page
   Matches global.css variables. Dating-app aesthetic twist.
   ============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.rf-page {
    padding: 1rem 0 2rem;
}

.rf-wrap {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Page header ──────────────────────────────────────────── */
.rf-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.rf-header-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ff4d6d;
    background: rgba(255, 77, 109, 0.08);
    border: 1px solid rgba(255, 77, 109, 0.22);
    border-radius: 20px;
    padding: 0.28rem 0.8rem;
    margin-bottom: 0.75rem;
}

.rf-header h1 {
    font-size: 2rem;
}

.rf-header p {
    color: var(--muted);
    font-size: 1.2rem;
}

/* ── Points bar ───────────────────────────────────────────── */
/* #topPointsBar {
  background: linear-gradient(135deg,rgba(232,184,75,0.07),rgba(232,184,75,0.03));
  border: 1px solid rgba(232,184,75,0.22);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem 0.55rem;
  position: relative;
  overflow: hidden;
}
#topPointsBar::before {
  content:''; position:absolute; top:0; left:0;
  width:3px; height:100%;
  background:linear-gradient(180deg,var(--gold),var(--gold-dim));
  border-radius:3px 0 0 3px;
}
.tpb-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.45rem; }
.tpb-label { font-size:0.67rem; font-weight:800; letter-spacing:0.1em; text-transform:uppercase; color:var(--gold); }
.tpb-count { font-size:0.78rem; font-weight:800; color:var(--parchment); }
.tpb-count--empty { color:var(--ember); }
.tpb-track { height:5px; background:rgba(255,255,255,0.06); border-radius:10px; overflow:hidden; margin-bottom:0.38rem; }
.tpb-fill { height:100%; border-radius:10px; background:linear-gradient(90deg,var(--gold),#f0c060); transition:width 0.5s cubic-bezier(0.4,0,0.2,1); }
.tpb-fill--empty { background:linear-gradient(90deg,var(--ember),#e87a5a); }
.tpb-reset { font-size:0.63rem; color:var(--muted); display:block; text-align:right; } */

/* ── Card ─────────────────────────────────────────────────── */
.rf-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
}

/* ── Labels ───────────────────────────────────────────────── */
.rf-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--parchment-dim);
    margin-bottom: 0.75rem;
}

.rf-sublabel {
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
}

/* ── Textarea ─────────────────────────────────────────────── */
.rf-textarea-wrap {
    position: relative;
}

.rf-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--ink-mid);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem 2rem;
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: var(--transition);
    appearance: none;
}

.rf-textarea::placeholder {
    color: var(--muted);
}

.rf-textarea:focus {
    border-color: #ff4d6d;
    box-shadow: 0 0 0 2px rgba(255, 77, 109, 0.12);
    background: var(--surface-soft);
}

.rf-char-counter {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    pointer-events: none;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}

.rf-char-counter.warn {
    color: var(--ember);
}

/* ── Scan depth selector ──────────────────────────────────── */
.rf-levels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.rf-levels input[type="radio"] {
    display: none;
}

.rf-level-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.9rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--ink-mid);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    user-select: none;
}

.rf-level-card:hover {
    border-color: var(--border-light);
    background: var(--surface-soft);
}

.level-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.level-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--parchment-dim);
    letter-spacing: 0.03em;
}

.level-desc {
    font-size: 0.67rem;
    color: var(--muted);
    line-height: 1.3;
}

#level-casual:checked+.rf-level-card {
    border-color: var(--teal);
    background: rgba(45, 212, 191, 0.07);
}

#level-casual:checked+.rf-level-card .level-name {
    color: var(--teal);
}

#level-deep:checked+.rf-level-card {
    border-color: #ff4d6d;
    background: rgba(255, 77, 109, 0.07);
}

#level-deep:checked+.rf-level-card .level-name {
    color: #ff4d6d;
}

#level-obsessive:checked+.rf-level-card {
    border-color: var(--ember);
    background: rgba(224, 92, 58, 0.07);
}

#level-obsessive:checked+.rf-level-card .level-name {
    color: var(--ember);
}

.rf-cost-hint {
    font-size: 0.7rem;
    font-weight: 600;
    color: #ff4d6d;
    letter-spacing: 0.02em;
    margin-top: 0.75rem;
    padding: 0.28rem 0.6rem;
    background: rgba(255, 77, 109, 0.07);
    border: 1px solid rgba(255, 77, 109, 0.2);
    border-radius: 20px;
    width: fit-content;
}

/* ── Main button ──────────────────────────────────────────── */
.rf-btn {
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: #ff4d6d;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.rf-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transition: left 0.5s ease;
}

.rf-btn:hover:not(:disabled) {
    background: #e8325a;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(255, 77, 109, 0.3);
}

.rf-btn:hover:not(:disabled)::before {
    left: 100%;
}

.rf-btn:active:not(:disabled) {
    transform: translateY(0);
}

.rf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rf-btn.limit-reached {
    background: rgba(255, 77, 109, 0.1);
    color: #ff4d6d;
    border: 1.5px solid rgba(255, 77, 109, 0.3);
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.rf-btn.generating {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.rf-btn-cost {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

/* ── Limit alert ──────────────────────────────────────────── */
.rf-limit-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: rgba(224, 92, 58, 0.08);
    border: 1.5px solid rgba(224, 92, 58, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font-size: 0.82rem;
}

.rf-limit-alert strong {
    display: block;
    color: var(--ember);
    margin-bottom: 0.2rem;
}

.rf-limit-alert p {
    font-size: 0.75rem;
    color: var(--parchment-dim);
    margin: 0;
}

/* ── Loader ───────────────────────────────────────────────── */
.rf-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
}

.rf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff4d6d;
    border-radius: 50%;
    animation: rfSpin 0.85s linear infinite;
    flex-shrink: 0;
}

@keyframes rfSpin {
    to {
        transform: rotate(360deg);
    }
}

.rf-loader-text {
    font-size: 0.88rem;
    color: var(--parchment-dim);
    font-style: italic;
    animation: rfPulse 1.8s ease-in-out infinite;
}

@keyframes rfPulse {

    0%,
    100% {
        opacity: 0.5
    }

    50% {
        opacity: 1
    }
}

/* ══════════════════════════════════════════════════════════
   OUTPUT CARD
   ══════════════════════════════════════════════════════════ */
.rf-output-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: rfSlideIn 0.38s ease;
}

@keyframes rfSlideIn {
    from {
        opacity: 0;
        transform: translateY(14px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ── Dating app profile header ────────────────────────────── */
.rf-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.4rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 77, 109, 0.06), rgba(255, 77, 109, 0.02));
    border-bottom: 1px solid rgba(255, 77, 109, 0.15);
    flex-wrap: wrap;
}

.rf-profile-avatar {
    width: 52px;
    height: 52px;
    background: rgba(255, 77, 109, 0.1);
    border: 2px solid rgba(255, 77, 109, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rf-profile-info {
    flex: 1;
    min-width: 0;
}

.rf-profile-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--parchment);
    line-height: 1.3;
    margin-bottom: 0.1rem;
}

.rf-profile-archetype {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ff4d6d;
    margin-bottom: 0.35rem;
}

.rf-profile-verdict {
    font-size: 0.78rem;
    color: var(--muted);
    font-style: italic;
}

/* ── Score ring ───────────────────────────────────────────── */
.rf-score-ring-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rf-score-ring {
    width: 72px;
    height: 72px;
    transform: rotate(-90deg);
    position: absolute;
    top: 0;
    left: 0;
}

.rf-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 5;
}

.rf-ring-fill {
    fill: none;
    stroke: #ff4d6d;
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rf-score-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.rf-score-num {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--parchment);
}

.rf-score-label {
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.1rem;
}

/* ── Actions bar ──────────────────────────────────────────── */
.rf-output-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0.7rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--ink-mid);
}

.rf-level-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid currentColor;
}

.rf-level-badge.badge-casual {
    color: var(--teal);
}

.rf-level-badge.badge-deep {
    color: #ff4d6d;
}

.rf-level-badge.badge-obsessive {
    color: var(--ember);
}

.rf-output-actions {
    display: flex;
    gap: 0.45rem;
    margin-left: auto;
}

.rf-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--parchment-dim);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition);
}

.rf-action-btn:hover {
    border-color: #ff4d6d;
    color: #ff4d6d;
}

/* ── Sections ─────────────────────────────────────────────── */
.rf-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.rf-section:last-child {
    border-bottom: none;
}

.rf-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.rf-section-icon {
    font-size: 1rem;
}

.rf-section-title {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    flex: 1;
}

.rf-flag-count {
    font-size: 0.68rem;
    font-weight: 700;
    color: #ff4d6d;
    background: rgba(255, 77, 109, 0.1);
    border: 1px solid rgba(255, 77, 109, 0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

/* ── Red flag items ───────────────────────────────────────── */
.rf-flags-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.rf-flag-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--ink-mid);
    border: 1px solid rgba(255, 77, 109, 0.12);
    border-left: 3px solid #ff4d6d;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--parchment-dim);
    line-height: 1.55;
    animation: rfFlagPop 0.3s ease backwards;
}

@keyframes rfFlagPop {
    from {
        opacity: 0;
        transform: translateX(-8px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.rf-flag-emoji {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.rf-flag-content {
    flex: 1;
}

.rf-flag-title {
    font-weight: 700;
    color: var(--parchment);
    margin-bottom: 0.2rem;
    font-size: 0.88rem;
}

.rf-flag-detail {
    font-size: 0.83rem;
    color: var(--parchment-dim);
    line-height: 1.5;
}

.rf-flag-severity {
    flex-shrink: 0;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.sev-mild {
    color: var(--gold);
    background: rgba(232, 184, 75, 0.1);
    border: 1px solid rgba(232, 184, 75, 0.25);
}

.sev-mid {
    color: var(--ember);
    background: rgba(224, 92, 58, 0.1);
    border: 1px solid rgba(224, 92, 58, 0.25);
}

.sev-fatal {
    color: #ff4d6d;
    background: rgba(255, 77, 109, 0.1);
    border: 1px solid rgba(255, 77, 109, 0.3);
}

/* ── Green flags ──────────────────────────────────────────── */
.rf-section--green {
    background: rgba(45, 212, 191, 0.02);
}

.rf-green-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rf-green-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    background: rgba(45, 212, 191, 0.05);
    border: 1px solid rgba(45, 212, 191, 0.15);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    color: var(--parchment-dim);
    line-height: 1.55;
}

.rf-green-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.rf-green-title {
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 0.15rem;
    font-size: 0.88rem;
}

/* ── Archetype card ───────────────────────────────────────── */
.rf-section--archetype {
    background: rgba(232, 184, 75, 0.02);
}

.rf-archetype-card {
    padding: 1rem 1.1rem;
    background: rgba(232, 184, 75, 0.06);
    border: 1px solid rgba(232, 184, 75, 0.18);
    border-radius: var(--radius-sm);
}

.rf-archetype-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 0.4rem;
}

.rf-archetype-desc {
    font-size: 0.88rem;
    color: var(--parchment-dim);
    line-height: 1.7;
}

.rf-archetype-traits {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rf-trait-pill {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
    background: rgba(232, 184, 75, 0.1);
    border: 1px solid rgba(232, 184, 75, 0.25);
    color: var(--gold);
}

/* ── Verdict ──────────────────────────────────────────────── */
.rf-section--verdict {
    background: rgba(255, 77, 109, 0.02);
}

.rf-verdict-text {
    font-size: 0.92rem;
    color: var(--parchment-dim);
    line-height: 1.85;
    white-space: pre-wrap;
}

.rf-verdict-text strong {
    color: #ff4d6d;
    font-weight: 700;
}

.rf-verdict-text em {
    color: var(--gold);
}

/* ── Autopsy CTA ──────────────────────────────────────────── */
.rf-autopsy-cta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.5rem;
    background: rgba(45, 212, 191, 0.04);
    border-top: 1px solid rgba(45, 212, 191, 0.15);
    border-bottom: 1px solid var(--border);
}

.rf-cta-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.rf-cta-text {
    flex: 1;
    min-width: 0;
}

.rf-cta-text strong {
    display: block;
    color: var(--parchment);
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
}

.rf-cta-text span {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.4;
}

.rf-cta-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1.5px solid var(--teal);
    border-radius: var(--radius-sm);
    color: var(--teal);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.rf-cta-btn:hover {
    background: rgba(45, 212, 191, 0.1);
    transform: translateX(2px);
}

/* ── Footer ───────────────────────────────────────────────── */
.rf-output-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--ink-mid);
    border-top: 1px solid var(--border);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.rf-word-count {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── Inline quote highlight ───────────────────────────────── */
.rf-inline-quote {
    font-weight: 700;
    color: #ff6b6b;
    background: rgba(255, 80, 80, 0.08);
    padding: 2px 5px;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .rf-page {
        padding: 1rem 0 2rem;
    }
    .rf-wrap{
        gap: 0.6rem;
    }
    .rf-header h1{
        font-size: 1.6rem;
    }

    .rf-header p{
        font-size: 0.7rem;
    }

    .rf-profile-header {
    display: flex; 
    flex-direction: column;
    align-items: center;
}

    .rf-header {
    margin-bottom: -1rem;
}
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .rf-levels {
        grid-template-columns: 1fr;
    }

    .rf-card {
        padding: 1.1rem;
    }

    .rf-section {
        padding: 1rem 1.1rem;
    }

    .rf-profile-header {
        padding: 1.1rem;
    }

    .rf-output-footer {
        padding: 0.65rem 1.1rem;
    }

    .rf-autopsy-cta {
        padding: 0.9rem 1.1rem;
    }

    .rf-score-ring-wrap {
        width: 60px;
        height: 60px;
    }

    .rf-score-ring {
        width: 60px;
        height: 60px;
    }

    .rf-score-num {
        font-size: 1.15rem;
    }
}