/**
 * Антиплагиат Checker — Styles
 * Universal styles that work on any WordPress theme
 */

/* ========== Reset & Container ========== */

/* Защита от глобальных сбросов темы (svg {display:block}, button {background:none} и т.д.) */
.apc-checker svg {
    display: inline-block;
    max-width: none;
    width: auto;
    height: auto;
    vertical-align: middle;
    flex-shrink: 0;
}
.apc-checker button {
    background: revert;
    border: revert;
    cursor: pointer;
    font-family: inherit;
}

.apc-checker {
    --apc-primary: #6f5cf3;
    --apc-primary-hover: #5a44ea;
    --apc-primary-dark: #4a36d2;
    --apc-mint: #00d3a8;
    --apc-accent: #0f172a;
    --apc-green: #22c55e;
    --apc-yellow: #eab308;
    --apc-orange: #f97316;
    --apc-red: #ef4444;
    --apc-purple: #a855f7;
    --apc-slate-50: #f8fafc;
    --apc-slate-100: #f1f5f9;
    --apc-slate-200: #e2e8f0;
    --apc-slate-300: #cbd5e1;
    --apc-slate-400: #94a3b8;
    --apc-slate-500: #64748b;
    --apc-slate-700: #334155;
    --apc-slate-900: #0f172a;
    --apc-radius: 16px;
    --apc-radius-lg: 24px;
    --apc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, sans-serif;

    font-family: var(--apc-font);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    line-height: 1.6;
    color: var(--apc-slate-900);
}

.apc-checker *, .apc-checker *::before, .apc-checker *::after {
    box-sizing: border-box;
}

.apc-view {
    display: none;
}

.apc-view.apc-active {
    display: block;
}

/* ========== Buttons ========== */
.apc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    line-height: 1.2;
    font-family: var(--apc-font);
    white-space: nowrap;
}

.apc-btn-primary {
    background: linear-gradient(135deg, var(--apc-primary-dark) 0%, var(--apc-primary-hover) 100%);
    color: #fff;
    box-shadow: 0 12px 26px rgba(111, 92, 243, 0.22);
}

.apc-btn-primary:hover {
    background: linear-gradient(135deg, #3f2dbb 0%, var(--apc-primary-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 15px 30px rgba(111, 92, 243, 0.28);
    color: #fff;
    text-decoration: none;
}

.apc-btn-secondary {
    background: #fff;
    color: var(--apc-primary-dark);
    border-color: rgba(111, 92, 243, 0.28);
}

.apc-btn-secondary:hover {
    background: rgba(111, 92, 243, 0.08);
    border-color: var(--apc-primary);
    color: var(--apc-primary-dark);
}

/* ========== Upload View ========== */
.apc-upload-card {
    background: #fff;
    border-radius: var(--apc-radius-lg);
    padding: 40px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--apc-slate-100);
}

.apc-dropzone {
    border: 2px dashed var(--apc-slate-200);
    border-radius: var(--apc-radius-lg);
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apc-dropzone:hover,
.apc-dropzone.apc-drag-over {
    border-color: var(--apc-primary);
    background: rgba(59, 130, 246, 0.03);
}

.apc-dropzone.apc-drag-over {
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.apc-dropzone-icon {
    display: inline-flex;
    width: 80px;
    height: 80px;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 20px;
    color: var(--apc-primary);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.apc-dropzone:hover .apc-dropzone-icon {
    transform: scale(1.1);
}

.apc-dropzone-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--apc-slate-900);
    margin: 0 0 8px 0;
}

.apc-dropzone-desc {
    font-size: 15px;
    color: var(--apc-slate-500);
    margin: 0 0 6px 0;
}

.apc-dropzone-formats {
    font-size: 13px;
    color: var(--apc-slate-400);
    margin: 0 0 24px 0;
}

.apc-file-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 18px;
    background: var(--apc-slate-50);
    border-radius: 10px;
    font-size: 14px;
    color: var(--apc-slate-700);
    border: 1px solid var(--apc-slate-200);
}

.apc-file-info #apc-file-size {
    color: var(--apc-slate-400);
    font-size: 12px;
}

/* ========== Checking View ========== */
.apc-checking-card {
    background: #fff;
    border-radius: var(--apc-radius-lg);
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--apc-slate-100);
}

.apc-progress-ring-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 30px;
}

.apc-progress-ring {
    width: 100%;
    height: 100%;
}

.apc-progress-bar {
    transition: stroke-dashoffset 0.3s ease-out;
}

.apc-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.apc-progress-number {
    display: block;
    font-size: 36px;
    font-weight: 900;
    color: var(--apc-accent);
    line-height: 1;
}

.apc-progress-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--apc-slate-400);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

.apc-checking-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--apc-slate-900);
    margin: 0 0 8px 0;
}

.apc-checking-filename {
    font-size: 14px;
    color: var(--apc-slate-500);
    margin: 0 0 30px 0;
}

/* Steps */
.apc-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
    text-align: left;
}

.apc-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--apc-slate-400);
    transition: color 0.3s;
}

.apc-step.apc-step-active {
    color: var(--apc-primary);
}

.apc-step.apc-step-done {
    color: var(--apc-green);
}

.apc-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--apc-slate-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
    position: relative;
}

.apc-step-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--apc-slate-300);
    transition: background 0.3s;
}

.apc-step-active .apc-step-dot {
    background: rgba(59, 130, 246, 0.1);
}

.apc-step-active .apc-step-pulse {
    background: var(--apc-primary);
    animation: apc-pulse 1.5s infinite;
}

.apc-step-done .apc-step-dot {
    background: var(--apc-green);
}

.apc-step-done .apc-step-pulse {
    background: transparent;
}

.apc-step-done .apc-step-dot::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
    position: absolute;
    top: 7px;
    left: 7px;
}

@keyframes apc-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.5; }
}

/* ========== Result View ========== */
.apc-result-card {
    background: #fff;
    border-radius: var(--apc-radius-lg);
    padding: 40px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--apc-slate-100);
}

.apc-result-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 30px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--apc-slate-100);
    flex-wrap: wrap;
}

.apc-result-ring-wrap {
    position: relative;
    width: clamp(120px, 28vw, 160px);  /* кольцо ужимается на узких экранах */
    height: clamp(120px, 28vw, 160px);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.apc-result-ring {
    width: 100%;
    height: 100%;
}

.apc-result-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;            /* не даём цифре вылезать за круг */
    overflow: hidden;
}

.apc-result-percent {
    font-size: clamp(22px, 5vw, 32px);  /* «100%» теперь всегда влезает */
    font-weight: 900;
    color: var(--apc-slate-900);
    line-height: 1;
    letter-spacing: -0.03em;
    display: inline-block;
}

.apc-result-info {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.apc-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--apc-green);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;     /* было 1.5px — слишком широко */
    border-radius: 20px;
    margin-bottom: 10px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apc-result-title {
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 900;
    color: var(--apc-slate-900);
    margin: 0 0 4px 0;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.apc-result-filename {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
    color: var(--apc-slate-500);
    margin: 0;
    max-width: 100%;
    min-width: 0;
}

.apc-result-filename strong {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apc-result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
    max-width: 100%;
}

/* ========== Stats Grid ========== */
.apc-stats-grid {
    display: grid;
    /* Минимум 150px → длинные русские лейблы («ЗАИМСТВОВАНИЯ» = 13 букв) гарантированно
       помещаются в одну строку. На ПК даёт 4 колонки на ≥1280px, 3 на 980-1280, 2 на 600-980,
       1 на ≤600. */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.apc-stat-card {
    padding: 18px 12px;
    background: var(--apc-slate-50);
    border-radius: var(--apc-radius);
    border: 1px solid var(--apc-slate-100);
    text-align: center;
    min-width: 0;            /* разрешаем сжимать под содержимое */
    overflow: hidden;
}

.apc-stat-label {
    font-size: 10px;          /* было 11px — теперь «ЗАИМСТВОВАНИЯ» точно в строку */
    font-weight: 700;
    color: var(--apc-slate-400);
    text-transform: uppercase;
    letter-spacing: .3px;     /* было .5px */
    margin-bottom: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.apc-stat-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--apc-slate-900);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.apc-stat-uniqueness .apc-stat-value { color: var(--apc-green); }
.apc-stat-borrowings .apc-stat-value { color: var(--apc-orange); }
.apc-stat-ai .apc-stat-value { color: var(--apc-purple); }

/* Sources */
.apc-sources-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--apc-slate-100);
}

.apc-sources-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    color: var(--apc-slate-900);
    margin: 0 0 16px 0;
}

.apc-sources-title svg {
    color: var(--apc-primary);
}

.apc-sources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apc-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--apc-slate-50);
    border-radius: 14px;
    border: 1px solid var(--apc-slate-100);
    transition: border-color 0.2s;
    gap: 12px;
}

.apc-source-item:hover {
    border-color: var(--apc-primary);
}

.apc-source-info {
    overflow: hidden;
    flex-grow: 1;
}

.apc-source-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--apc-slate-400);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.apc-source-url {
    font-size: 14px;
    font-weight: 700;
    color: var(--apc-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.apc-source-url:hover {
    text-decoration: underline;
}

.apc-source-percent {
    flex-shrink: 0;
    padding: 4px 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--apc-slate-100);
    font-size: 14px;
    font-weight: 900;
    color: var(--apc-orange);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* AI Section */
.apc-ai-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--apc-slate-100);
}

.apc-ai-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    color: var(--apc-slate-900);
    margin: 0 0 16px 0;
}

.apc-ai-title svg { color: var(--apc-purple); }

.apc-ai-details {
    padding: 20px;
    background: var(--apc-slate-50);
    border-radius: var(--apc-radius);
    border: 1px solid var(--apc-slate-100);
}

.apc-ai-level {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
}

.apc-ai-stats {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: var(--apc-slate-500);
    flex-wrap: wrap;
}

.apc-ai-stats strong { color: var(--apc-slate-900); }

/* Error View */
.apc-error-card {
    background: #fff;
    border-radius: var(--apc-radius-lg);
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--apc-slate-100);
}

.apc-error-icon {
    display: inline-flex;
    width: 80px;
    height: 80px;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 20px;
    color: var(--apc-red);
    margin-bottom: 20px;
}

.apc-error-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--apc-slate-900);
    margin: 0 0 10px 0;
}

.apc-error-message {
    font-size: 15px;
    color: var(--apc-slate-500);
    margin: 0 0 24px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.apc-limit-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.apc-limit-actions .apc-btn {
    min-width: 170px;
}

/* ========== Dark Theme ========== */
.apc-theme-dark {
    --apc-slate-50: #1e293b;
    --apc-slate-100: #334155;
    --apc-slate-200: #475569;
    --apc-slate-400: #94a3b8;
    --apc-slate-500: #cbd5e1;
    --apc-slate-700: #e2e8f0;
    --apc-slate-900: #f8fafc;
    color: #f8fafc;
}

.apc-theme-dark .apc-upload-card,
.apc-theme-dark .apc-checking-card,
.apc-theme-dark .apc-result-card,
.apc-theme-dark .apc-error-card {
    background: #1e293b;
    border-color: #334155;
}

.apc-theme-dark .apc-dropzone {
    border-color: #475569;
}

.apc-theme-dark .apc-source-percent {
    background: #334155;
    border-color: #475569;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .apc-checker {
        padding: 10px;
    }

    .apc-upload-card,
    .apc-checking-card,
    .apc-result-card,
    .apc-error-card {
        padding: 24px 16px;
    }

    .apc-dropzone {
        padding: 30px 16px;
    }

    .apc-result-header {
        flex-direction: column;
        text-align: center;
        gap: 18px;                       /* было 30px → меньше пустоты при переносе */
    }

    .apc-result-info {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 480px) {
    .apc-result-card {
        padding: 20px 12px;
        border-radius: 18px;
    }

    .apc-stat-card {
        padding: 14px 10px;
    }

    .apc-stat-value {
        font-size: 18px;                 /* было 22px */
    }

    .apc-stat-label {
        font-size: 10px;
        letter-spacing: .25px;
    }

    .apc-ai-stats {
        flex-direction: column;
        gap: 8px;
    }

    /* Кольцо: на iPhone SE / Galaxy Fold должно остаться видимым, но компактным */
    .apc-result-ring-wrap {
        width: 120px;
        height: 120px;
    }
}

/* Совсем узкие — Galaxy Fold (≤360px) */
@media (max-width: 360px) {
    .apc-result-ring-wrap {
        width: 104px;
        height: 104px;
    }
    .apc-result-percent {
        font-size: 20px;
    }
}
