/* study-grade.css -- Grade tabs, result detail, history cards, AI detection, humanizer */

        /* ── Grade View (Redesigned) ── */
        .grade-container { max-width: 1200px; margin: 0 auto; padding: 68px 40px 42px; width: 100%; flex: 1; display: flex; flex-direction: column; }
        .grade-heading { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 4px; }
        .grade-sub { font-size: 14px; color: var(--study-text-secondary); text-align: center; margin-bottom: 28px; }
        .grade-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
        .grade-cards-v2 { grid-template-columns: 1fr 1.2fr; align-items: stretch; }
        .grade-card {
            display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
            padding: 36px 28px; background: var(--study-bg-card, #fff); border: 1px solid var(--study-border);
            border-radius: 20px; cursor: pointer; transition: all 0.2s ease; position: relative; min-height: 200px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        }
        .grade-card:hover { border-color: var(--study-accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
        .grade-card.active { border-color: var(--study-accent); }
        .grade-card i { width: 32px; height: 32px; color: var(--study-text-tertiary); stroke-width: 1.5; }
        .grade-card-label { font-size: 18px; font-weight: 800; }
        .grade-card-sub { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.5; }
        .grade-card input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
        /* V2 Paper Checker cards */
        .grade-card-upload { align-items: flex-start; cursor: default; }
        .grade-card-icon-wrap { width: 52px; height: 52px; border-radius: 14px; background: rgba(144,71,44,.08); display: flex; align-items: center; justify-content: center; }
        .grade-choose-file-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 10px; border: 1px solid var(--study-border); background: linear-gradient(180deg, var(--study-bg-card, #fff) 0%, color-mix(in srgb, var(--study-bg-card, #fff) 95%, #000) 100%); color: var(--study-text); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; margin-top: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.5); }
        .grade-choose-file-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6); border-color: var(--study-accent); }
        .grade-card-paste { cursor: default; }
        .grade-card-paste-header { display: flex; align-items: center; justify-content: space-between; width: 100%; }
        .grade-paste-inline { width: 100%; flex: 1; min-height: 100px; border: 1px solid var(--study-border); border-radius: 12px; padding: 14px; font-size: 14px; font-family: inherit; background: var(--study-bg); color: var(--study-text); resize: none; outline: none; transition: border-color .2s; }
        .grade-paste-inline:focus { border-color: var(--study-accent); }
        .grade-paste-inline::placeholder { color: var(--study-text-tertiary); }
        .grade-paste-stats { display: flex; gap: 12px; font-size: 11px; color: var(--study-text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
        .grade-analyze-btn { display: inline-flex !important; align-items: center; gap: 8px; }
        .grade-input-area { display: none; margin-bottom: 16px; }
        .grade-input-area.visible { display: block; }
        .grade-rubric { margin-bottom: 16px; }
        .grade-rubric-row { display: flex; gap: 12px; align-items: flex-start; }
        .grade-rubric-left { flex: 1; }
        .grade-rubric-left textarea { width: 100%; min-height: 80px; padding: 12px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 10px; color: var(--study-text); font-family: inherit; font-size: 14px; resize: vertical; outline: none; }
        .grade-rubric-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: var(--study-bg-secondary); border: 2px dashed var(--study-border-light); border-radius: 10px; cursor: pointer; position: relative; min-width: 120px; transition: all 0.2s; }
        .grade-rubric-upload:hover { border-color: var(--study-accent); }
        .grade-rubric-upload.has-file { border-color: var(--study-accent); border-style: solid; }
        .grade-rubric-upload i { width: 20px; height: 20px; color: var(--study-text-secondary); margin-bottom: 4px; }
        .grade-rubric-upload span { font-size: 11px; color: var(--study-text-tertiary); text-align: center; }
        .grade-rubric-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
        .grade-submit { padding: 14px 32px; background: linear-gradient(135deg, var(--study-accent), var(--study-accent-hover, #c4703a)); color: #fff; border: none; border-radius: 14px; font-weight: 700; font-size: 15px; cursor: pointer; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15); transition: all 0.2s; }
        .grade-submit:disabled { opacity: 0.5; cursor: not-allowed; }
        /* Upload buttons row */
        .grade-upload-btns { display: flex; gap: 10px; margin-top: auto; }
        .grade-rubric-btn { border-style: dashed !important; }
        /* Recent History Section */
        .grade-recent-section { margin-top: 32px; }
        .grade-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--study-accent); margin-bottom: 4px; }
        .grade-recent-title { font-size: 22px; font-weight: 800; margin: 0; color: var(--study-text); }
        .grade-recent-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
        .grade-recent-list { display: flex; flex-direction: column; gap: 10px; }
        .grade-recent-item { border-bottom: none; }
        .grade-recent-item:hover { transform: translateY(-1px); }
        .grade-recent-item:last-child { border-bottom: none; }
        .grade-recent-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(144,71,44,.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .grade-recent-icon i { width: 20px; height: 20px; color: #90472c; }
        .grade-recent-info { flex: 1; min-width: 0; }
        .grade-recent-info-title { font-size: 14px; font-weight: 600; color: var(--study-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .grade-recent-info-meta { font-size: 12px; color: var(--study-text-tertiary); margin-top: 2px; display: flex; gap: 12px; }
        .grade-recent-score { width: 52px; height: 52px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
        .grade-recent-score.high { background: rgba(88,129,87,.1); color: #588157; }
        .grade-recent-score.mid { background: rgba(221,161,94,.1); color: #dda15e; }
        .grade-recent-score.low { background: rgba(188,71,73,.1); color: #bc4749; }
        .grade-recent-score-label { font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
        /* Grade result detail view */
        .grade-result { margin-top: 0; }
        .grade-result-header { display: flex; align-items: center; gap: 12px; padding: 12px 0 16px; border-bottom: 1px solid var(--study-border); margin-bottom: 20px; }
        .grade-result-title { font-size: 18px; font-weight: 700; }
        .grade-result-back { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: none; border: none; color: var(--study-text); cursor: pointer; flex-shrink: 0; transition: background 0.15s; }
        .grade-result-back:hover { background: var(--study-bg-tertiary); }
        .grade-result-back i { width: 18px; height: 18px; }
        .grade-result-layout { display: flex; gap: 24px; }
        .grade-result-left { width: 280px; flex-shrink: 0; }
        .grade-result-right { flex: 1; min-width: 0; background: var(--bg-card, var(--study-bg-secondary)); border: 1px solid var(--study-border); border-radius: 16px; padding: 28px 32px; }
        .grade-score-card { background: var(--bg-card, var(--study-bg-secondary)); border: 1px solid var(--study-border); border-radius: 16px; padding: 28px; text-align: center; margin-bottom: 20px; }
        .grade-score-num { font-size: 56px; font-weight: 800; color: var(--study-text); line-height: 1; }
        .grade-score-label { font-size: 14px; color: var(--study-text-secondary); margin-top: 4px; font-weight: 500; }
        .grade-breakdown { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 14px; padding: 20px; }
        .grade-breakdown-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
        .grade-criteria { margin-bottom: 14px; }
        .grade-criteria:last-child { margin-bottom: 0; }
        .grade-criteria-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
        .grade-criteria-name { font-size: 12.5px; color: var(--study-text-secondary); max-width: 170px; }
        .grade-criteria-score { font-size: 12px; color: var(--study-text-secondary); }
        .grade-criteria-pct { font-size: 13px; font-weight: 700; }
        .grade-criteria-bar { height: 6px; background: var(--study-bg-tertiary); border-radius: 3px; overflow: hidden; }
        .grade-criteria-fill { height: 100%; border-radius: 3px; background: #3b5bdb; transition: width 0.5s ease; }
        .grade-feedback-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
        .grade-feedback-pill { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; margin-bottom: 12px; }
        .grade-pill-strengths { background: rgba(34,197,94,0.15); color: #22c55e; }
        .grade-pill-improve { background: rgba(45,138,78,0.15); color: #2d8a4e; }
        .grade-pill-analysis { background: rgba(139,92,246,0.15); color: #8b5cf6; }
        .grade-feedback-list { list-style: none; padding: 0; margin: 0 0 24px 0; }
        .grade-feedback-list li { padding: 6px 0; font-size: 14px; line-height: 1.6; color: var(--study-text-secondary); }
        .grade-feedback-list li strong { color: var(--study-text); margin-right: 4px; }
        .grade-analysis-text { font-size: 14px; line-height: 1.7; color: var(--study-text-secondary); margin-bottom: 24px; }
        /* Grade history cards */
        .grade-history { margin-top: 32px; }
        .grade-history h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
        .grade-history-card { padding: 16px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 12px; margin-bottom: 10px; cursor: pointer; transition: all 0.15s; }
        .grade-history-card:hover { border-color: var(--study-accent); }
        .grade-history-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
        .grade-history-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--study-accent-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .grade-history-icon i { width: 20px; height: 20px; color: var(--study-accent); }
        .grade-history-title { font-size: 14px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .grade-history-more { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 4px; }
        .grade-history-more i { width: 18px; height: 18px; }
        .grade-history-preview { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
        .grade-history-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--study-border); }
        .grade-history-view { font-size: 13px; font-weight: 600; color: var(--study-text); display: flex; align-items: center; gap: 4px; }
        .grade-history-view i { width: 14px; height: 14px; }
        .grade-history-pct { font-size: 15px; font-weight: 700; }
        /* Grade tabs, exact copy of .hero-filter-btn */
        .grade-tabs { display: inline-flex; gap: 8px; margin-bottom: 28px; background: none; border: none; padding: 0; max-width: none; margin-left: 0; margin-right: 0; box-shadow: none; }
        .grade-tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px; border-radius: 999px; border: 1px solid var(--study-border); background: var(--study-bg-card, var(--bg-card, #fff)); color: var(--study-text-secondary); font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; }
        .grade-tab i { width: 14px; height: 14px; }
        .grade-tab:hover { border-color: var(--study-accent); color: var(--study-text); }
        .grade-tab.active { background: linear-gradient(180deg, #a0583c 0%, #7a3a22 100%); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(120,58,34,0.2); }
        .grade-tab-content { display: none; }
        .grade-tab-content.active { display: block; }
        /* AI Detection section in grade results */
        .grade-ai-detection { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 14px; padding: 20px; margin-top: 20px; }
        .grade-ai-detection-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
        .grade-ai-detection-header i { width: 20px; height: 20px; color: var(--study-accent); }
        .grade-ai-detection-title { font-size: 15px; font-weight: 700; }
        .grade-ai-meter { height: 10px; background: var(--study-bg-tertiary); border-radius: 5px; overflow: hidden; margin-bottom: 10px; }
        .grade-ai-meter-fill { height: 100%; border-radius: 5px; transition: width 0.8s ease; }
        .grade-ai-pct { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
        .grade-ai-label { font-size: 12px; color: var(--study-text-tertiary); margin-bottom: 12px; }
        .grade-ai-patterns { list-style: none; padding: 0; margin: 0; }
        .grade-ai-patterns li { padding: 5px 0; font-size: 13px; color: var(--study-text-secondary); display: flex; align-items: flex-start; gap: 8px; }
        .grade-ai-patterns li::before { content: '•'; color: var(--study-accent); font-weight: 700; flex-shrink: 0; }
        /* Hallucinations & fake sources */
        .grade-issues { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: 14px; padding: 20px; margin-top: 16px; }
        .grade-issues-title { font-size: 15px; font-weight: 700; color: #ef4444; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
        .grade-issues-title i { width: 18px; height: 18px; }
        .grade-issues-list { list-style: none; padding: 0; margin: 0; }
        .grade-issues-list li { padding: 6px 0; font-size: 13px; color: var(--study-text-secondary); line-height: 1.5; border-bottom: 1px solid var(--study-border); }
        .grade-issues-list li:last-child { border-bottom: none; }
        /* Humanizer, container stays same width, no layout shift */
        .humanizer-wrapper { margin: 0; height: calc(100vh - 180px); display: flex; flex-direction: column; min-height: 0; }
        .humanizer-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex: 1; min-height: 0; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 20px; overflow: hidden; }
        @media (max-width: 768px) { .humanizer-split { grid-template-columns: 1fr; } }
        .humanizer-panel { display: flex; flex-direction: column; padding: 28px 28px 20px; min-height: 0; overflow: hidden; }
        .humanizer-panel + .humanizer-panel { border-left: 1px solid var(--study-border); }
        @media (max-width: 768px) { .humanizer-panel + .humanizer-panel { border-left: none; border-top: 1px solid var(--study-border); } }
        .humanizer-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
        .humanizer-panel-title { font-size: 18px; font-weight: 800; color: var(--study-accent); margin: 0; letter-spacing: -0.01em; }
        .humanizer-panel-sub { font-size: 12.5px; color: var(--study-text-tertiary); margin: 2px 0 16px 0; }
        .humanizer-textarea { flex: 1; min-height: 0; padding: 18px 20px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; color: var(--study-text); font-size: 15px; line-height: 1.8; resize: none; outline: none; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; overflow-y: auto; }
        .humanizer-textarea::placeholder { color: var(--study-text-tertiary); }
        .humanizer-textarea:focus { border-color: var(--study-accent); box-shadow: 0 0 0 3px rgba(var(--study-accent-rgb, 255,159,28), 0.12); }
        .humanizer-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; }
        .humanizer-toolbar-left { display: flex; align-items: center; gap: 12px; }
        .humanizer-word-count { font-size: 13px; font-weight: 700; color: var(--study-text-secondary); }
        .humanizer-clear-btn { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; transition: all 0.15s; }
        .humanizer-clear-btn:hover { color: var(--study-red, #ef4444); background: rgba(239,68,68,0.1); }
        .humanizer-clear-btn i { width: 16px; height: 16px; }
        .humanizer-toolbar-right { display: flex; align-items: center; gap: 12px; }
        .humanizer-submit { padding: 14px 32px; background: linear-gradient(180deg, #a0583c 0%, #7a3a22 100%); color: #fff; border: none; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15); }
        .humanizer-submit:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15); }
        .humanizer-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
        .humanizer-submit i { width: 15px; height: 15px; }
        .humanizer-output { flex: 1; min-height: 0; padding: 18px 20px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; font-size: 15px; line-height: 1.8; color: var(--study-text); white-space: pre-wrap; overflow-y: auto; }
        .humanizer-placeholder { color: var(--study-text-tertiary); font-style: italic; text-align: center; display: block; padding-top: 30%; font-size: 14px; }
        .humanizer-result-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; }
        .humanizer-status-badge { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
        .humanizer-status-badge.success { color: #22c55e; }
        .humanizer-status-badge i { width: 16px; height: 16px; }
        .humanizer-result-actions { display: flex; align-items: center; gap: 8px; }
        .humanizer-rehumanize-btn { padding: 9px 18px; background: var(--study-text); color: var(--study-bg); border: none; border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
        .humanizer-rehumanize-btn:hover { opacity: 0.85; }
        .humanizer-rehumanize-btn i { width: 14px; height: 14px; }
        .humanizer-copy-btn { padding: 9px 18px; background: transparent; color: var(--study-text); border: 1px solid var(--study-border); border-radius: 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
        .humanizer-copy-btn:hover { background: var(--study-bg-secondary); }
        .humanizer-copy-btn i { width: 14px; height: 14px; }
        .humanizer-tip { text-align: center; margin-top: 16px; font-size: 12px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .humanizer-tip strong { color: var(--study-text-secondary); font-weight: 700; }
        .humanizer-limit-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 10px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 12px; font-size: 12px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .humanizer-limit-bar .limit-count { font-weight: 700; color: var(--study-text-secondary); }
        .humanizer-limit-bar .limit-upgrade { color: var(--study-accent); font-weight: 700; text-decoration: none; cursor: pointer; }
        .humanizer-limit-bar .limit-upgrade:hover { text-decoration: underline; }
        .humanizer-streaming-cursor { display: inline-block; width: 2px; height: 1em; background: var(--study-accent); animation: blink 0.8s infinite; vertical-align: text-bottom; margin-left: 2px; }
        @keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

