/**
 * VisionLogic AI - Analyze Aesthetics (Scoped Version)
 * All global styles removed to prevent interference with Footer/Sidebar.
 */

/* --- Selection & Editor UI --- */
::selection {
    background: rgba(112, 100, 255, 0.3);
    color: #00F2FE;
}

.editor-btn:hover,
.editor-btn.active {
    color: #7064FF !important;
    background: rgba(112, 100, 255, 0.1) !important;
}

#descriptionText ul {
    list-style-type: disc !important;
    padding-left: 1.5rem !important;
    margin: 0.5rem 0 !important;
}

#descriptionText ol {
    padding-left: 1.5rem !important;
    margin: 0.5rem 0 !important;
}

#descriptionText ol:not([style*="list-style-type"]) {
    list-style-type: decimal !important;
}

/* 🌟 强化版：Placeholder 逻辑 🌟 */
/* 只有当输入框完全为空，且没有 'has-content' 类时才显示提示 */
#descriptionText[data-placeholder]:not(.has-content):empty:before,
#descriptionText[data-placeholder]:not(.has-content):has(> br:only-child):before {
    content: attr(data-placeholder);
    color: rgba(255, 255, 255, 0.3); /* 调暗一点，更像提示 */
    pointer-events: none;
    position: absolute;
    left: 1.5rem; /* 匹配你的 px-6 */
    top: 1rem;    /* 匹配你的 py-4 */
    font-style: normal;
    cursor: text;
    z-index: 1;
}

/* 🌟 核心修复：只要有了 has-content 类，强行让提示文字消失，绝对不重叠 */
#descriptionText.has-content:before {
    content: "" !important;
    display: none !important;
}

/* 修复浏览器残留 br 导致的高度塌陷问题 */
#descriptionText[data-placeholder] br:only-child {
    display: none;
}


/* --- Dynamic Upload Logic --- */
#upload-box.has-image #uploadContent {
    opacity: 0;
    transform: translateY(10px);
}

#innerPreview {
    transition: all 0.5s ease;
    pointer-events: none;
    z-index: 10;
}

#upload-box.has-image #innerPreview {
    opacity: 1;
}

#upload-box.has-image:hover #innerPreview {
    filter: blur(4px) brightness(0.4);
    transform: scale(1.01);
}

#upload-box.has-image:hover #uploadContent {
    opacity: 1;
    transform: translateY(0);
}

/* --- Scanner Animation --- */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(10, 18, 36, 0.5);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #00F2FE, #7064FF);
    border-radius: 10px;
}

@keyframes scan-move {
    from {
        top: 0%;
    }

    to {
        top: 100%;
    }
}

.scanner-line {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #00F2FE !important;
    box-shadow: 0 0 20px 2px rgba(0, 242, 254, 0.8);
    z-index: 100;
    pointer-events: none;
}

.is-scanning .scanner-line {
    display: block !important;
    animation: scan-move 2.5s ease-in-out infinite alternate;
}

/* --- Visuals --- */
#finalScore {
    background-clip: text;
    -webkit-background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 242, 254, 0.4));
}

#analysisChart {
    width: 100% !important;
    height: 100% !important;
    max-width: 95% !important;
    max-height: 95% !important;
    transform: scale(1.1) translateX(-2%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-container {
    overflow: visible !important;
}

#imagePreview {
    transition: all 0.5s ease;
    background: rgba(0, 0, 0, 0.3);
}

/* --- 📱 Mobile Responsive Fixes (Flow-Safe Centering Edition) --- */
@media (max-width: 768px) {

    /* 1. Chart Container: Force a fixed height so it holds space and pushes the text down */
    .chart-container {
        position: relative !important;
        width: 100% !important;
        height: 380px !important;
        /* 🌟 CORE FIX: Reserve 380px vertical space to prevent overlapping */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 auto !important;
    }

    /* 2. Chart Canvas: Keep it in the flow, scale it to 85% to fit long words safely */
    #analysisChart {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: scale(0.85) !important;
        /* Gently shrink to 85% so it fits perfectly */
        transform-origin: center center !important;
        margin: 0 auto !important;
        display: block !important;
    }

    /* 3. Result Section Cards: Center alignment for mobile */
    .score-card,
    #result-section .bg-gray-800,
    #result-section .border-gray-700,
    #result-section .flex-col {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* --- 🌟 AI Analysis Result Formatting (Tailwind Reset Fix) --- */

/* 1. 强制恢复 AI Evaluation 的段落间距与行高 */
#ai-evaluation p {
    margin-bottom: 1.2rem !important; /* 段落之间的呼吸感 */
    display: block !important;
    line-height: 1.65 !important;    /* 让文字读起来不拥挤 */
    color: rgba(255, 255, 255, 0.9); /* 稍微提亮文字颜色 */
}

/* 2. 强制恢复 AI Suggestions 的数字列表序号 */
#ai-suggestions ol {
    list-style-type: decimal !important; /* 强制显示 1, 2, 3 */
    padding-left: 1.8rem !important;    /* 给左侧数字留出空间 */
    margin-top: 1rem !important;
    display: block !important;
}

#ai-suggestions li {
    margin-bottom: 1rem !important;     /* 每个建议条目之间的间距 */
    display: list-item !important;      /* 确保浏览器将其视为列表项 */
    line-height: 1.6 !important;
    padding-left: 0.5rem !important;    /* 文字与数字之间的微调 */
    color: rgba(255, 255, 255, 0.9);
}

/* 3. 针对最后一段/最后一项去除多余间距 */
#ai-evaluation p:last-child,
#ai-suggestions li:last-child {
    margin-bottom: 0 !important;
}

/* 4. 优化滚动条在结果框的表现 */
#ai-evaluation, #ai-suggestions {
    scrollbar-width: thin;
    scrollbar-color: #00F2FE rgba(255, 255, 255, 0.05);
}
