/* ===== Tool Navigation ===== */
.tool-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 60px;
    z-index: 40;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.85);
}

.tool-nav .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tool-nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.tool-nav-back:hover {
    color: var(--primary);
}

.tool-nav-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

/* ===== Main Wrapper ===== */
.calculator-wrapper {
    padding: 24px 0 60px;
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.calc-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    color: var(--primary);
}

.calc-icon svg {
    width: 28px;
    height: 28px;
}

.calc-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.calc-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1024px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Form ===== */
.calc-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 140px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 1024px) {
    .calc-form {
        position: static;
    }
}

/* ===== Settings ===== */
.settings-group {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.settings-group h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-row {
    margin-bottom: 8px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-label strong {
    color: var(--text);
}

/* ===== Upload Area (простая кнопка) ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.upload-icon {
    color: var(--text-muted);
}

.upload-icon svg {
    width: 40px;
    height: 40px;
}

.upload-btn {
    padding: 12px 36px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

/* ===== Buttons ===== */
.calc-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
}

.calc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== File List ===== */
.file-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    max-height: 460px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.file-list::-webkit-scrollbar {
    width: 4px;
}

.file-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    display: block;
    margin-top: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: var(--bg);
    border-radius: 8px;
}

.file-item .file-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border);
}

.file-item .file-icon svg {
    width: 20px;
    height: 20px;
}

.file-item .info {
    flex: 1;
    min-width: 0;
}

.file-item .info .name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item .info .size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-item .info .status {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.file-item .info .status.cleaned {
    color: #10b981;
}

.file-item .info .status.error {
    color: #ef4444;
}

.file-item .info .status.processing {
    color: #f59e0b;
    animation: pulse 1s ease-in-out infinite;
}

.file-item .info .status.ready {
    color: var(--text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.file-item .info .metadata-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.file-item .info .metadata-preview .tag {
    font-weight: 600;
    color: var(--primary);
}

.file-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.file-item .actions button {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.file-item .actions .download-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.file-item .actions .remove-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Result Actions ===== */
.result-actions {
    display: flex;
    gap: 10px;
}

.result-action-btn {
    padding: 10px 20px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    text-align: center;
}

.result-action-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.result-action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.result-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

/* ===== SEO Content ===== */
.seo-content {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.seo-inner {
    max-width: 760px;
}

.seo-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.seo-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--text);
}

.seo-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.seo-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 14px;
}

.seo-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.seo-content ul li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 4px 0 4px 24px;
    position: relative;
}

.seo-content ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

.seo-content strong {
    color: var(--text);
}

.seo-content code {
    font-size: 0.85rem;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ===== Highlight Box ===== */
.highlight-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
}

.highlight-box p {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--text);
}

/* ===== Screenshot Figure ===== */
.screenshot-figure {
    margin: 20px 0 30px;
}

.screenshot-figure img {
    width: 100%;
    max-width: 760px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    display: block;
}

.screenshot-figure figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .calc-header {
        flex-direction: column;
        text-align: center;
    }

    .calc-header h1 {
        font-size: 1.4rem;
    }

    .calc-grid {
        gap: 16px;
    }

    .result-actions {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .calculator-wrapper {
        padding: 16px 0 40px;
    }

    .calc-form {
        padding: 16px;
    }

    .calc-grid {
        gap: 12px;
    }

    .upload-area {
        padding: 18px 14px;
    }

    .upload-icon svg {
        width: 32px;
        height: 32px;
    }

    .upload-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }

    .file-list {
        max-height: 320px;
        padding: 10px;
    }

    .file-item {
        flex-wrap: wrap;
    }

    .file-item .actions {
        width: 100%;
        justify-content: flex-end;
    }

    .seo-content {
        margin-top: 30px;
        padding-top: 24px;
    }

    .seo-content h2 {
        font-size: 1.2rem;
    }

    .seo-content h3 {
        font-size: 1rem;
    }

    .seo-content p,
    .seo-content ul li {
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .upload-icon svg {
        width: 28px;
        height: 28px;
    }

    .upload-btn {
        padding: 8px 18px;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .file-item .info .name {
        font-size: 0.78rem;
    }

    .file-item .info .size {
        font-size: 0.7rem;
    }

    .file-item .info .status {
        font-size: 0.7rem;
    }

    .file-item .actions button {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}

/* ===== Clean Upload Button ===== */
.upload-btn-clean {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    width: 100%;
}

.upload-btn-clean svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.upload-btn-clean:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.upload-btn-clean:active {
    transform: scale(0.98);
}

/* ===== Status with SVG icons ===== */
.file-item .status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.file-item .status svg {
    flex-shrink: 0;
}

.file-item .status.cleaned {
    color: #10b981;
}

.file-item .status.cleaned svg {
    stroke: #10b981;
}

.file-item .status.error {
    color: #ef4444;
}

.file-item .status.error svg {
    stroke: #ef4444;
}

.file-item .status.processing {
    color: #f59e0b;
}

.file-item .status.processing svg {
    stroke: #f59e0b;
}

.file-item .status.ready {
    color: var(--text-muted);
}

.file-item .status.ready svg {
    stroke: var(--text-muted);
}

/* ===== Metadata preview with icon ===== */
.file-item .info .metadata-preview {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.file-item .info .metadata-preview .tag {
    font-weight: 600;
    color: var(--primary);
}

/* ===== Action buttons with SVG ===== */
.file-item .actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.file-item .actions button svg {
    width: 16px;
    height: 16px;
    display: block;
}

.file-item .actions .download-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.file-item .actions .download-btn:hover svg {
    stroke: var(--primary);
}

.file-item .actions .remove-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.file-item .actions .remove-btn:hover svg {
    stroke: #ef4444;
}

/* ===== Process button with spinner ===== */
.calc-btn svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}