/* ================= MODAL BACKDROP ================= */
#analysis-modal.sub-modal-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 999999 !important;

    align-items: center !important;
    justify-content: center !important;
    padding: 24px;
}

#analysis-modal.sub-modal-backdrop.open {
    display: flex !important;
}

/* ================= CARD ================= */
.sub-modal-card {
    background: #ffffff;
    border-radius: 20px;
    max-width: 820px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: hidden;
}

/* ================= LAYOUT ================= */
.sub-modal-layout {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    min-height: 480px;
}

/* ================= LEFT ================= */
.sub-modal-left {
    background: linear-gradient(150deg, #4f46e5, #7c3aed);
    padding: 32px;
    color: #fff;
}

.sub-modal-left-heading {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.sub-modal-left-sub {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ================= SCORE ================= */
.analysis-score-block {
    margin-top: 30px;
    text-align: center;
}

.analysis-score-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: #fff;
}

.analysis-score-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

/* ================= RIGHT ================= */
.sub-modal-right {
    padding: 28px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* CLOSE BUTTON */
.sub-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

/* ================= CONTENT ================= */
.analysis-content {
    margin-top: 20px;
}

/* ================= SUMMARY ================= */
.analysis-summary {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ================= LINES ================= */
.analysis-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.analysis-line {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
}

.analysis-line.ai-line {
    background: #fff1f2;
    border-color: #fecaca;
}

.analysis-line.human-line {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.analysis-line-text {
    margin-bottom: 6px;
    color: #0f172a;
}

.analysis-line-meta {
    font-size: 0.7rem;
    display: flex;
    gap: 10px;
    color: #64748b;
}

/* ================= LOADING ================= */
.sub-modal-loading {
    text-align: center;
    padding: 40px 0;
}

.sub-modal-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

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

/* ================= STATES ================= */
.analysis-error {
    text-align: center;
    color: #ef4444;
    font-size: 0.9rem;
}

.analysis-loading-state {
    text-align: center;
    padding: 30px;
}

/* ================= MOBILE ================= */
@media (max-width: 600px) {
    .sub-modal-layout {
        grid-template-columns: 1fr;
    }

    .sub-modal-card {
        border-radius: 12px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .sub-modal-left {
        padding: 20px;
    }

    .sub-modal-right {
        padding: 16px;
    }
}